Struct wireplumber::lua::LuaVariant

source ·
pub struct LuaVariant<'a>(/* private fields */);
Available on crate feature lua only.
Expand description

A Variant that can be passed to a Lua script.

LuaVariant serves as a sort of adhoc ABI for WirePlumber modules and their configuration data.

Implementations§

source§

impl<'a> LuaVariant<'a>

source

pub fn wrap(v: Variant) -> Result<Self, LuaError>

source

pub fn borrow(v: &'a Variant) -> Result<Self, LuaError>

source

pub fn borrowed<'s>(&'s self) -> Self
where 's: 'a,

source

pub fn owned(&self) -> LuaVariant<'static>

source

pub fn as_variant(&self) -> &Variant

source

pub fn inner_ref(&self) -> Result<&'a Variant, &Variant>

source

pub fn inner_mut(&mut self) -> &mut Variant

source

pub fn into_variant(self) -> Variant

source

pub fn into_inner(self) -> Cow<'a, Variant>

source§

impl<'v> LuaVariant<'v>

source

pub fn nil() -> Self

source

pub fn convert_from(v: &Variant) -> Result<Self, LuaError>

source

pub fn with_bytes<B: AsRef<[u8]>>(bytes: B) -> Self

source

pub fn lua_type(&self) -> LuaType

source

pub fn lua_value(&self) -> LuaValue<'_>

source

pub fn flattened(&self) -> Self

source

pub fn get_nil<'a>(&'a self) -> Option<()>

source

pub fn get_bool<'a>(&'a self) -> Option<bool>

source

pub fn get_table<'a>(&'a self) -> Option<LuaTable<'a>>

source

pub fn get_string(&self) -> Option<LuaString<'_>>

source

pub fn get_float(&self) -> Option<Result<f64, LuaError>>

source

pub fn get_integer<T>(&self) -> Option<Result<T, LuaError>>

Trait Implementations§

source§

impl<'a> AsRef<Variant> for LuaVariant<'a>

source§

fn as_ref(&self) -> &Variant

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a> Clone for LuaVariant<'a>

source§

fn clone(&self) -> LuaVariant<'a>

Returns a copy 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<'a> Debug for LuaVariant<'a>

source§

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

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

impl<'de, 'v> Deserialize<'de> for LuaVariant<'v>

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a> Display for LuaVariant<'a>

source§

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

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

impl<'a> From<()> for LuaVariant<'a>

source§

fn from(v: ()) -> Self

Converts to this type from the input type.
source§

impl<'a> From<LuaTable<'a>> for LuaVariant<'a>

source§

fn from(v: LuaTable<'a>) -> Self

Converts to this type from the input type.
source§

impl<'v> From<LuaVariant<'v>> for Deserializer<'v>

source§

fn from(v: LuaVariant<'v>) -> Self

Converts to this type from the input type.
source§

impl<'v, 's, S: Into<LuaString<'s>>> From<S> for LuaVariant<'v>

source§

fn from(s: S) -> Self

Converts to this type from the input type.
source§

impl<'a> From<bool> for LuaVariant<'a>

source§

fn from(v: bool) -> Self

Converts to this type from the input type.
source§

impl<'a> From<f64> for LuaVariant<'a>

source§

fn from(v: f64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i16> for LuaVariant<'a>

source§

fn from(v: i16) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i32> for LuaVariant<'a>

source§

fn from(v: i32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<i64> for LuaVariant<'a>

source§

fn from(v: i64) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u16> for LuaVariant<'a>

source§

fn from(v: u16) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u32> for LuaVariant<'a>

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

impl<'a> From<u64> for LuaVariant<'a>

source§

fn from(v: u64) -> Self

Converts to this type from the input type.
source§

impl<'a, 'v, K: StaticVariantType + Into<LuaVariant<'v>>, V: StaticVariantType + Into<LuaVariant<'v>>> FromIterator<(K, V)> for LuaVariant<'a>

source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl<'a, 'v> FromIterator<LuaVariant<'v>> for LuaVariant<'a>

source§

fn from_iter<T: IntoIterator<Item = LuaVariant<'v>>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a> FromStr for LuaVariant<'a>

§

type Err = <Variant as FromStr>::Err

The associated error which can be returned from parsing.
source§

fn from_str(str: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<'a> FromVariant for LuaVariant<'a>

source§

fn from_variant(variant: &Variant) -> Option<Self>

Tries to extract a value. Read more
source§

impl<'a> Hash for LuaVariant<'a>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a> Into<Cow<'a, Variant>> for LuaVariant<'a>

source§

fn into(self) -> Cow<'a, Variant>

Converts this type into the (usually inferred) input type.
source§

impl<'a> Into<Variant> for LuaVariant<'a>

source§

fn into(self) -> Variant

Converts this type into the (usually inferred) input type.
source§

impl<'a, 'de, 'v> IntoDeserializer<'de, LuaError> for &'a LuaVariant<'v>

§

type Deserializer = Deserializer<'v>

The type of the deserializer being converted into.
source§

fn into_deserializer(self) -> Self::Deserializer

Convert this value into a deserializer.
source§

impl<'de, 'v> IntoDeserializer<'de, LuaError> for LuaVariant<'v>

§

type Deserializer = Deserializer<'v>

The type of the deserializer being converted into.
source§

fn into_deserializer(self) -> Self::Deserializer

Convert this value into a deserializer.
source§

impl<'a, T: AsRef<Variant>> PartialEq<T> for LuaVariant<'a>

source§

fn eq(&self, rhs: &T) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, T: AsRef<Variant>> PartialOrd<T> for LuaVariant<'a>

source§

fn partial_cmp(&self, rhs: &T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'v> Serialize for LuaVariant<'v>

source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> StaticVariantType for LuaVariant<'a>

source§

fn static_variant_type() -> Cow<'static, VariantTy>

Returns the VariantType corresponding to Self.
source§

impl<'a> ToVariant for LuaVariant<'a>

source§

fn to_variant(&self) -> Variant

Returns a Variant clone of self.
source§

impl<'a> TryFrom<&'a Variant> for LuaVariant<'a>

§

type Error = LuaError

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

fn try_from(v: &'a Variant) -> Result<Self, LuaError>

Performs the conversion.
source§

impl<'a> TryFrom<Cow<'a, Variant>> for LuaVariant<'a>

§

type Error = LuaError

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

fn try_from(v: Cow<'a, Variant>) -> Result<Self, LuaError>

Performs the conversion.
source§

impl<'a> TryFrom<LuaVariant<'a>> for LuaTable<'a>

§

type Error = LuaError

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

fn try_from(v: LuaVariant<'a>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'a> TryFrom<Variant> for LuaVariant<'a>

§

type Error = LuaError

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

fn try_from(v: Variant) -> Result<Self, LuaError>

Performs the conversion.
source§

impl<'a> UnsafeFrom<&'a Variant> for LuaVariant<'a>

source§

unsafe fn unsafe_from(v: &'a Variant) -> Self

Safety Read more
source§

impl<'a> UnsafeFrom<Cow<'a, Variant>> for LuaVariant<'a>

source§

unsafe fn unsafe_from(v: Cow<'a, Variant>) -> Self

Safety Read more
source§

impl<'a> UnsafeFrom<LuaVariant<'a>> for LuaTable<'a>

source§

unsafe fn unsafe_from(v: LuaVariant<'a>) -> Self

Safety Read more
source§

impl<'a> UnsafeFrom<Variant> for LuaVariant<'a>

source§

unsafe fn unsafe_from(v: Variant) -> Self

Safety Read more
source§

impl<'a> Eq for LuaVariant<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for LuaVariant<'a>

§

impl<'a> RefUnwindSafe for LuaVariant<'a>

§

impl<'a> Send for LuaVariant<'a>

§

impl<'a> Sync for LuaVariant<'a>

§

impl<'a> Unpin for LuaVariant<'a>

§

impl<'a> UnwindSafe for LuaVariant<'a>

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> 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> ToLuaTable for T
where T: TryInto<LuaTable<'static>>, <T as TryInto<LuaTable<'static>>>::Error: Into<LuaError>,

source§

fn to_lua_variant(self) -> Result<Option<LuaTable<'static>>, LuaError>

Available on crate feature lua only.
source§

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

§

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§

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

§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,