Closed zummenix closed 8 years ago
There's always:
let sn = if let Plist::String(s) = dict.remove("SerialNumber") { Some(s) } else { None };
But I agree; into_string
and into_data
seem like reasonable additions.
@ebarnard, what do you think about into_array
and into_dictionary
methods additional to into_string
and into_data
? I see that those are also can be helpful.
Unless you've got a use case I'd rather those them out for now.
You can already get mutable access to storage and you can't reuse the allocated memory for anything, at least not without unsafe
.
I'm happy to add them if a concrete need arises.
Actually my use case with into_dictionary
and into_array
is the same. But I think we will stick with into_string
and into_data
for now.
For example now I have:
This is somewhat unfortunate with additional allocation by
to_owned
call. I would like to have something like this:where
into_string
has signature:Maybe there is a better idea.