SemanticValue

Enum SemanticValue 

Source
pub enum SemanticValue<S: SemanticString> {
    Bool(bool),
    Int(i32),
    Float(f32),
    Double(f64),
    String(S),
}
Expand description

A value that forms part of the semantic information for a recognized phrase.

Variants§

§

Bool(bool)

§

Int(i32)

§

Float(f32)

§

Double(f64)

§

String(S)

Implementations§

Source§

impl<S: SemanticString> SemanticValue<S>

Source

pub fn into<T: SemanticString>(self) -> SemanticValue<T>
where S: Into<T>,

Converts the value from one generic type into a compatible generic type.

Source

pub fn as_bool(&self) -> Option<&bool>

Borrows the underlying value, if this is a SemanticValue::Bool.

Source

pub fn as_int(&self) -> Option<&i32>

Borrows the underlying value, if this is a SemanticValue::Int.

Source

pub fn as_float(&self) -> Option<&f32>

Borrows the underlying value, if this is a SemanticValue::Float.

Source

pub fn as_double(&self) -> Option<&f64>

Borrows the underlying value, if this is a SemanticValue::Double.

Source

pub fn as_string(&self) -> Option<&S>

Borrows the underlying value, if this is a SemanticValue::String.

Trait Implementations§

Source§

impl<S: Clone + SemanticString> Clone for SemanticValue<S>

Source§

fn clone(&self) -> SemanticValue<S>

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<S: Debug + SemanticString> Debug for SemanticValue<S>

Source§

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

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

impl<F: SemanticString + Into<T>, T: SemanticString> From<F> for SemanticValue<T>

Source§

fn from(source: F) -> Self

Converts to this type from the input type.
Source§

impl<S: SemanticString> From<bool> for SemanticValue<S>

Source§

fn from(source: bool) -> Self

Converts to this type from the input type.
Source§

impl<S: SemanticString> From<f32> for SemanticValue<S>

Source§

fn from(source: f32) -> Self

Converts to this type from the input type.
Source§

impl<S: SemanticString> From<f64> for SemanticValue<S>

Source§

fn from(source: f64) -> Self

Converts to this type from the input type.
Source§

impl<S: SemanticString> From<i32> for SemanticValue<S>

Source§

fn from(source: i32) -> Self

Converts to this type from the input type.
Source§

impl<S: SemanticString> PartialEq<&OsStr> for SemanticValue<S>

Source§

fn eq(&self, other: &&OsStr) -> 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<S: SemanticString> PartialEq<&str> for SemanticValue<S>

Source§

fn eq(&self, other: &&str) -> 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<S: SemanticString> PartialEq<OsStr> for SemanticValue<S>

Source§

fn eq(&self, other: &OsStr) -> 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<S: SemanticString> PartialEq<SemanticValue<S>> for &OsStr

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> PartialEq<SemanticValue<S>> for &str

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> PartialEq<SemanticValue<S>> for OsStr

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> PartialEq<SemanticValue<S>> for bool

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> PartialEq<SemanticValue<S>> for f32

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> PartialEq<SemanticValue<S>> for f64

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> PartialEq<SemanticValue<S>> for i32

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> PartialEq<SemanticValue<S>> for str

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> PartialEq<bool> for SemanticValue<S>

Source§

fn eq(&self, other: &bool) -> 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<S: SemanticString> PartialEq<f32> for SemanticValue<S>

Source§

fn eq(&self, other: &f32) -> 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<S: SemanticString> PartialEq<f64> for SemanticValue<S>

Source§

fn eq(&self, other: &f64) -> 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<S: SemanticString> PartialEq<i32> for SemanticValue<S>

Source§

fn eq(&self, other: &i32) -> 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<S: SemanticString> PartialEq<str> for SemanticValue<S>

Source§

fn eq(&self, other: &str) -> 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<S: PartialEq + SemanticString> PartialEq for SemanticValue<S>

Source§

fn eq(&self, other: &SemanticValue<S>) -> 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<S: SemanticString> StructuralPartialEq for SemanticValue<S>

Auto Trait Implementations§

§

impl<S> Freeze for SemanticValue<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for SemanticValue<S>
where S: RefUnwindSafe,

§

impl<S> Send for SemanticValue<S>
where S: Send,

§

impl<S> Sync for SemanticValue<S>
where S: Sync,

§

impl<S> Unpin for SemanticValue<S>
where S: Unpin,

§

impl<S> UnwindSafe for SemanticValue<S>
where S: UnwindSafe,

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, 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.