pub struct OwnedItem { /* private fields */ }Available on crate feature
alloc only.Expand description
An owned Item: the bare item’s bytes and the parameter text in one
buffer.
§Examples
use parse_net::sfv::{self, owned::OwnedItem, BareItem};
let owned: OwnedItem = {
let input = b"tok;v=2".to_vec();
sfv::parse_item(&input)?.to_owned()
};
assert_eq!(owned.as_view().params.get("v"), Some(BareItem::Integer(2)));Implementations§
Source§impl OwnedItem
impl OwnedItem
Sourcepub fn as_view(&self) -> Item<'_>
pub fn as_view(&self) -> Item<'_>
The view over the owned bytes.
§Examples
use parse_net::sfv::{self, BareItem};
let owned = sfv::parse_item(b"5;unit=s")?.to_owned();
let view = owned.as_view();
assert_eq!(view.bare, BareItem::Integer(5));
assert_eq!(view.params.get("unit"), Some(BareItem::Token("s")));Trait Implementations§
impl Eq for OwnedItem
impl StructuralPartialEq for OwnedItem
Auto Trait Implementations§
impl Freeze for OwnedItem
impl RefUnwindSafe for OwnedItem
impl Send for OwnedItem
impl Sync for OwnedItem
impl Unpin for OwnedItem
impl UnsafeUnpin for OwnedItem
impl UnwindSafe for OwnedItem
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