#[repr(transparent)]
pub struct MaybeFixedSize<T: Cast> { /* private fields */ }
Expand description

Type with same representation as GVariant “mX” type where X is any fixed size type

This is the type returned by:

gv!("mb").cast(data);
gv!("mi").cast(data);
gv!("m(yi)").cast(data);

Rust’s built in Option doesn’t have any specified byte representation so we need our own type here.

Maybes are encoded differently depending on if their element type is fixed-sized or not. MaybeNonFixedSize is used when the contained size is non-fixed, but it implements the same interface as this type

You probably just want to call .to_option() on this type.

Implementations

Convert to a rust native Option type.

Note: this doesn’t copy the data, it returns an option to a reference to the underlying data.

Trait Implementations

Get a static reference to the default value for this type. Read more

Cast slice to type Self. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

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

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

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.