Value

Enum Value 

Source
pub enum Value<'i> {
    String {
        tag: &'i str,
        value: &'i [u8],
    },
    Binary {
        tag: &'i str,
        data: &'i [u8],
    },
}
Expand description

An entry from a capability string

Variants§

§

String

A normal string

Fields

§tag: &'i str

The value name

§value: &'i [u8]

String contents

§

Binary

Raw binary data

Fields

§tag: &'i str

The value name

§data: &'i [u8]

Data contents

Implementations§

Source§

impl<'i> Value<'i>

Source

pub fn parse_nom( input: &'i [u8], previous_tag: Option<&'i str>, ) -> IResult<&'i [u8], Self>

Source

pub fn nom_parser() -> ValueParser<'i>

Source§

impl<'i> Value<'i>

Source

pub fn parse_capabilities(capability_string: &'i [u8]) -> ValueParser<'i>

Create a new iterator over the values in a capability string

Source

pub fn parse(data: &'i str) -> Result<Self>

Parse a single capability string entry

Source

pub fn parse_bytes(data: &'i [u8]) -> Result<Self>

Parse a single capability string entry

Source

pub fn tag(&self) -> &'i str

The value name

Trait Implementations§

Source§

impl<'i> Clone for Value<'i>

Source§

fn clone(&self) -> Value<'i>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'i> Debug for Value<'i>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'i> Display for Value<'i>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a UnknownTag> for Value<'a>

Source§

fn from(v: &'a UnknownTag) -> Self

Converts to this type from the input type.
Source§

impl From<Value<'_>> for UnknownTag

Source§

fn from(v: Value<'_>) -> Self

Converts to this type from the input type.
Source§

impl<'i> Parser<&'i [u8], Value<'i>, Error<&'i [u8]>> for ValueParser<'i>

Source§

fn parse(&mut self, input: &'i [u8]) -> IResult<&'i [u8], Value<'i>>

A parser takes in input type, and returns a Result containing either the remaining input and the output value, or an error
Source§

fn map<G, O2>(self, g: G) -> Map<Self, G, O>
where G: Fn(O) -> O2, Self: Sized,

Maps a function over the result of a parser
Source§

fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>
where G: FnMut(O) -> H, H: Parser<I, O2, E>, Self: Sized,

Creates a second parser from the output of the first one, then apply over the rest of the input
Source§

fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>
where G: Parser<O, O2, E>, Self: Sized,

Applies a second parser over the output of the first one
Source§

fn and<G, O2>(self, g: G) -> And<Self, G>
where G: Parser<I, O2, E>, Self: Sized,

Applies a second parser after the first one, return their results as a tuple
Source§

fn or<G>(self, g: G) -> Or<Self, G>
where G: Parser<I, O, E>, Self: Sized,

Applies a second parser over the input if the first one failed
Source§

fn into<O2, E2>(self) -> Into<Self, O, O2, E, E2>
where O2: From<O>, E2: From<E>, Self: Sized,

automatically converts the parser’s output and error values to another type, as long as they implement the From trait
Source§

impl<'i> PartialEq for Value<'i>

Source§

fn eq(&self, other: &Value<'i>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'i> Copy for Value<'i>

Source§

impl<'i> Eq for Value<'i>

Source§

impl<'i> StructuralPartialEq for Value<'i>

Auto Trait Implementations§

§

impl<'i> Freeze for Value<'i>

§

impl<'i> RefUnwindSafe for Value<'i>

§

impl<'i> Send for Value<'i>

§

impl<'i> Sync for Value<'i>

§

impl<'i> Unpin for Value<'i>

§

impl<'i> UnwindSafe for Value<'i>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.