Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserializing BDAddr from non-borrowed string without clone #415

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

ekuinox
Copy link
Contributor

@ekuinox ekuinox commented Dec 18, 2024

There was a problem with deserialization when using toml crates, so I fixed it.

I often use toml files to configure my own software, but the following deserialization using toml was failing.

#[derive(Deserialize, PartialEq, Copy, Clone, Debug)]
struct Data {
    addr: BDAddr,
}

toml::from_str(r#"addr = "ff00ff00ff00""#) // error: A colon seperated Bluetooth address, like `00:11:22:33:44:55`

@qwandor qwandor changed the base branch from master to dev December 18, 2024 16:09
@qwandor
Copy link
Collaborator

qwandor commented Dec 18, 2024

Please rebase this on the dev branch.

@ekuinox ekuinox force-pushed the feature/deserialize-bdaddr-with-toml branch from 3b7c303 to f818d7e Compare December 19, 2024 11:22
@ekuinox ekuinox force-pushed the feature/deserialize-bdaddr-with-toml branch from f818d7e to 2fad73e Compare December 19, 2024 11:25
@ekuinox
Copy link
Contributor Author

ekuinox commented Dec 19, 2024

It seems that it was already supported in the dev branch. (70ee65c #408 )
This was handled using Cow, but I don't see a problem with returning BDAddr directly in the Visitor. I think it would eliminate the need to allocate Cow.

@ekuinox ekuinox changed the title To be able to deserialize using toml crate Deserializing BDAddr from non-borrowed string without clone Dec 19, 2024
@qwandor
Copy link
Collaborator

qwandor commented Dec 19, 2024

Thanks!

@qwandor qwandor merged commit 6c3de80 into deviceplug:dev Dec 19, 2024
5 checks passed
@ekuinox ekuinox deleted the feature/deserialize-bdaddr-with-toml branch December 19, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants