pub struct ExtraData {
key: String,
value: String,
}
Expand description
Extra data associated with a package
This type wraps a key-value pair of data as String, which is separated by an equal sign (=
).
Fields§
§key: String
§value: String
Implementations§
Trait Implementations§
Source§impl FromStr for ExtraData
impl FromStr for ExtraData
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses an extra_data
from string.
The string is expected to be in the format key=value
.
§Errors
This function returns an error if the string is missing the key or value component.
§Examples
use std::str::FromStr;
use alpm_types::{Error, ExtraData, PackageType};
// create ExtraData from str
let extra_data: ExtraData = ExtraData::from_str("pkgtype=debug")?;
assert_eq!(extra_data.key(), "pkgtype");
assert_eq!(extra_data.value(), "debug");
impl StructuralPartialEq for ExtraData
Auto Trait Implementations§
impl Freeze for ExtraData
impl RefUnwindSafe for ExtraData
impl Send for ExtraData
impl Sync for ExtraData
impl Unpin for ExtraData
impl UnwindSafe for ExtraData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more