Enum objc2_encode::EncodingBox

source ·
#[non_exhaustive]
pub enum EncodingBox {
Show 31 variants Char, Short, Int, Long, LongLong, UChar, UShort, UInt, ULong, ULongLong, Float, Double, LongDouble, FloatComplex, DoubleComplex, LongDoubleComplex, Bool, Void, String, Object, Block, Class, Sel, Unknown, BitField(u8, Option<Box<(u64, Self)>>), Pointer(Box<Self>), Atomic(Box<Self>), Array(u64, Box<Self>), Struct(String, Vec<Self>), Union(String, Vec<Self>), None,
}
Expand description

The boxed version of Encoding.

This has exactly the same items as Encoding, the only difference is in where the contents of the more complex encodings like Struct are stored.

In Encoding, the data is stored in static memory, while in EncodingBox it is stored on the heap. The former allows storing in constants (which is required by the objc2::encode::Encode and objc2::encode::RefEncode traits), while the latter allows dynamic creation, such as in the case of parsing encodings.

This should be considered a temporary restriction. Encoding and EncodingBox will become equivalent once heap allocation in constants is possible.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Char

Same as Encoding::Char.

§

Short

Same as Encoding::Short.

§

Int

Same as Encoding::Int.

§

Long

Same as Encoding::Long.

§

LongLong

§

UChar

Same as Encoding::UChar.

§

UShort

§

UInt

Same as Encoding::UInt.

§

ULong

Same as Encoding::ULong.

§

ULongLong

§

Float

Same as Encoding::Float.

§

Double

§

LongDouble

§

FloatComplex

§

DoubleComplex

§

LongDoubleComplex

§

Bool

Same as Encoding::Bool.

§

Void

Same as Encoding::Void.

§

String

§

Object

§

Block

Same as Encoding::Block.

§

Class

Same as Encoding::Class.

§

Sel

Same as Encoding::Sel.

§

Unknown

§

BitField(u8, Option<Box<(u64, Self)>>)

§

Pointer(Box<Self>)

§

Atomic(Box<Self>)

§

Array(u64, Box<Self>)

Same as Encoding::Array.

§

Struct(String, Vec<Self>)

§

Union(String, Vec<Self>)

Same as Encoding::Union.

§

None

Same as Encoding::None.

Implementations§

source§

impl EncodingBox

source

pub const C_LONG: Self = _

source

pub const C_ULONG: Self = _

source

pub fn from_start_of_str(s: &mut &str) -> Result<Self, ParseError>

Parse and comsume an encoding from the start of a string.

This is can be used to parse concatenated encodings, such as those returned by method_getTypeEncoding.

from_str is simpler, use that instead if you can.

§Errors

Returns an error if the string was an ill-formatted encoding string.

Trait Implementations§

source§

impl Clone for EncodingBox

source§

fn clone(&self) -> EncodingBox

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 Debug for EncodingBox

source§

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

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

impl Display for EncodingBox

Same formatting as Encoding’s Display implementation.

source§

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

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

impl FromStr for EncodingBox

§

type Err = ParseError

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

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

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

impl Hash for EncodingBox

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 PartialEq<Encoding> for EncodingBox

source§

fn eq(&self, other: &Encoding) -> 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 PartialEq<EncodingBox> for Encoding

source§

fn eq(&self, other: &EncodingBox) -> 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 PartialEq for EncodingBox

source§

fn eq(&self, other: &EncodingBox) -> 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 Eq for EncodingBox

source§

impl StructuralPartialEq for EncodingBox

Auto Trait Implementations§

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