OwnedTerm

Enum OwnedTerm 

Source
pub enum OwnedTerm {
Show 17 variants Atom(Atom), Integer(i64), Float(f64), Pid(ExternalPid), Port(ExternalPort), Reference(ExternalReference), Binary(Vec<u8>), BitBinary { bytes: Vec<u8>, bits: u8, }, String(String), List(Vec<OwnedTerm>), ImproperList { elements: Vec<OwnedTerm>, tail: Box<OwnedTerm>, }, Map(BTreeMap<OwnedTerm, OwnedTerm>), Tuple(Vec<OwnedTerm>), BigInt(BigInt), ExternalFun(ExternalFun), InternalFun(Box<InternalFun>), Nil,
}

Variants§

§

Atom(Atom)

§

Integer(i64)

§

Float(f64)

§

Pid(ExternalPid)

§

Port(ExternalPort)

§

Reference(ExternalReference)

§

Binary(Vec<u8>)

§

BitBinary

Fields

§bytes: Vec<u8>
§bits: u8
§

String(String)

§

List(Vec<OwnedTerm>)

§

ImproperList

Fields

§elements: Vec<OwnedTerm>
§

Map(BTreeMap<OwnedTerm, OwnedTerm>)

§

Tuple(Vec<OwnedTerm>)

§

BigInt(BigInt)

§

ExternalFun(ExternalFun)

§

InternalFun(Box<InternalFun>)

§

Nil

Implementations§

Source§

impl OwnedTerm

Source

pub fn atom<S>(name: S) -> OwnedTerm
where S: AsRef<str>,

Source

pub fn integer(value: i64) -> OwnedTerm

Source

pub fn float(value: f64) -> OwnedTerm

Source

pub fn binary(data: Vec<u8>) -> OwnedTerm

Source

pub fn string<S>(value: S) -> OwnedTerm
where S: Into<String>,

Source

pub fn list(elements: Vec<OwnedTerm>) -> OwnedTerm

Source

pub fn improper_list(elements: Vec<OwnedTerm>, tail: OwnedTerm) -> OwnedTerm

Source

pub fn map(entries: BTreeMap<OwnedTerm, OwnedTerm>) -> OwnedTerm

Source

pub fn tuple(elements: Vec<OwnedTerm>) -> OwnedTerm

Source

pub fn boolean(value: bool) -> OwnedTerm

Source

pub fn ok() -> OwnedTerm

Source

pub fn error() -> OwnedTerm

Source

pub fn ok_tuple(value: OwnedTerm) -> OwnedTerm

Source

pub fn error_tuple(reason: OwnedTerm) -> OwnedTerm

Source

pub fn nil() -> OwnedTerm

Source

pub fn is_atom(&self) -> bool

Source

pub fn is_integer(&self) -> bool

Source

pub fn is_list(&self) -> bool

Source

pub fn is_map(&self) -> bool

Source

pub fn is_tuple(&self) -> bool

Source

pub fn as_atom(&self) -> Option<&Atom>

Source

pub fn as_integer(&self) -> Option<i64>

Source

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

Source

pub fn as_binary(&self) -> Option<&[u8]>

Source

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

Source

pub fn as_list(&self) -> Option<&[OwnedTerm]>

Source

pub fn as_map(&self) -> Option<&BTreeMap<OwnedTerm, OwnedTerm>>

Source

pub fn as_tuple(&self) -> Option<&[OwnedTerm]>

Source

pub fn as_list_mut(&mut self) -> Option<&mut Vec<OwnedTerm>>

Source

pub fn as_map_mut(&mut self) -> Option<&mut BTreeMap<OwnedTerm, OwnedTerm>>

Source

pub fn as_tuple_mut(&mut self) -> Option<&mut Vec<OwnedTerm>>

Source

pub fn as_binary_mut(&mut self) -> Option<&mut Vec<u8>>

Source

pub fn try_as_integer(&self) -> Result<i64, TermConversionError>

Source

pub fn try_as_float(&self) -> Result<f64, TermConversionError>

Source

pub fn try_as_atom(&self) -> Result<&Atom, TermConversionError>

Source

pub fn try_as_binary(&self) -> Result<&[u8], TermConversionError>

Source

pub fn try_as_string(&self) -> Result<&str, TermConversionError>

Source

pub fn try_as_list(&self) -> Result<&[OwnedTerm], TermConversionError>

Source

pub fn try_as_tuple(&self) -> Result<&[OwnedTerm], TermConversionError>

Source

pub fn try_as_map( &self, ) -> Result<&BTreeMap<OwnedTerm, OwnedTerm>, TermConversionError>

Source

pub fn into_map_iter( self, ) -> Result<impl Iterator<Item = (OwnedTerm, OwnedTerm)>, TermConversionError>

Source

pub fn type_name(&self) -> &'static str

Source

pub fn atom_name(&self) -> Option<&str>

Source

pub fn is_atom_with_name(&self, name: &str) -> bool

Source

pub fn is_true(&self) -> bool

Source

pub fn is_false(&self) -> bool

Source

pub fn is_undefined(&self) -> bool

Source

pub fn is_nil_atom(&self) -> bool

Source

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

Source

pub fn into_ok_value(self) -> Option<OwnedTerm>

Source

pub fn into_rex_response(self) -> Result<OwnedTerm, TermConversionError>

Source

pub fn into_error_reason(self) -> Option<OwnedTerm>

Source

pub fn map_get(&self, key: &OwnedTerm) -> Option<&OwnedTerm>

Source

pub fn get<I>(&self, index: I) -> Option<&OwnedTerm>
where I: TermIndex,

Source

pub fn iter(&self) -> OwnedTermIter<'_>

Source

pub fn proplist_get_atom_key(&self, key: &str) -> Option<&OwnedTerm>

Source

pub fn is_proplist(&self) -> bool

Source

pub fn is_proplist_element(element: &OwnedTerm) -> bool

Source

pub fn normalize_proplist(&self) -> Result<OwnedTerm, TermConversionError>

Source

pub fn proplist_to_map(&self) -> Result<OwnedTerm, TermConversionError>

Source

pub fn map_to_proplist(&self) -> Result<OwnedTerm, TermConversionError>

Source

pub fn to_map_recursive(&self) -> Result<OwnedTerm, TermConversionError>

Source

pub fn atomize_keys(&self) -> Result<OwnedTerm, TermConversionError>

Source

pub fn as_list_wrapped(&self) -> OwnedTerm

Source

pub fn proplist_iter(&self) -> Option<ProplistIter<'_>>

Source

pub fn map_get_atom_key(&self, key: &str) -> Option<&OwnedTerm>

Source

pub fn map_get_i64(&self, key: &str) -> Option<i64>

Source

pub fn map_get_i64_or(&self, key: &str, default: i64) -> i64

Source

pub fn map_get_bool(&self, key: &str) -> Option<bool>

Source

pub fn map_get_bool_or(&self, key: &str, default: bool) -> bool

Source

pub fn map_get_atom(&self, key: &str) -> Option<&Atom>

Source

pub fn map_get_string(&self, key: &str) -> Option<String>

Source

pub fn map_get_string_or(&self, key: &str, default: &str) -> String

Source

pub fn map_get_pid(&self, key: &str) -> Option<&ExternalPid>

Source

pub fn map_get_atom_string(&self, key: &str) -> Option<String>

Source

pub fn map_get_atom_string_or(&self, key: &str, default: &str) -> String

Source

pub fn map_get_pid_string(&self, key: &str) -> Option<String>

Source

pub fn map_get_pid_string_or(&self, key: &str, default: &str) -> String

Source

pub fn map_get_mfa_string(&self, key: &str) -> Option<String>

Source

pub fn map_get_mfa_string_or(&self, key: &str, default: &str) -> String

Source

pub fn as_erlang_string(&self) -> Option<String>

Source

pub fn as_erlang_string_or(&self, default: &str) -> String

Source

pub fn tuple_get(&self, index: usize) -> Option<&OwnedTerm>

Source

pub fn tuple_get_string(&self, index: usize) -> Option<String>

Source

pub fn tuple_get_string_or(&self, index: usize, default: &str) -> String

Source

pub fn tuple_get_atom_string(&self, index: usize) -> Option<String>

Source

pub fn tuple_get_atom_string_or(&self, index: usize, default: &str) -> String

Source

pub fn charlist<S>(s: S) -> OwnedTerm
where S: AsRef<str>,

Source

pub fn is_charlist(&self) -> bool

Source

pub fn as_charlist_string(&self) -> Option<String>

Source

pub fn as_list_or_empty(&self) -> &[OwnedTerm]

Source

pub fn try_as_mfa(&self) -> Option<Mfa>

Source

pub fn format_as_mfa(&self) -> Option<String>

Source

pub fn as_pid(&self) -> Option<&ExternalPid>

Source

pub fn try_as_pid(&self) -> Result<&ExternalPid, TermConversionError>

Source

pub fn is_pid(&self) -> bool

Source

pub fn format_as_pid(&self) -> Option<String>

Source

pub fn proplist_get_i64(&self, key: &str) -> Option<i64>

Source

pub fn proplist_get_i64_or(&self, key: &str, default: i64) -> i64

Source

pub fn proplist_get_bool(&self, key: &str) -> Option<bool>

Source

pub fn proplist_get_bool_or(&self, key: &str, default: bool) -> bool

Source

pub fn proplist_get_atom(&self, key: &str) -> Option<&Atom>

Source

pub fn proplist_get_string(&self, key: &str) -> Option<String>

Source

pub fn proplist_get_string_or(&self, key: &str, default: &str) -> String

Source

pub fn proplist_get_pid(&self, key: &str) -> Option<&ExternalPid>

Source

pub fn proplist_get_atom_string(&self, key: &str) -> Option<String>

Source

pub fn proplist_get_atom_string_or(&self, key: &str, default: &str) -> String

Source

pub fn proplist_get_pid_string(&self, key: &str) -> Option<String>

Source

pub fn proplist_get_pid_string_or(&self, key: &str, default: &str) -> String

Source

pub fn proplist_get_mfa_string(&self, key: &str) -> Option<String>

Source

pub fn proplist_get_mfa_string_or(&self, key: &str, default: &str) -> String

Source

pub fn atom_list(names: &[&str]) -> OwnedTerm

Source

pub fn map_iter(&self) -> Option<impl Iterator<Item = (&OwnedTerm, &OwnedTerm)>>

Source

pub fn try_into_list(self) -> Result<Vec<OwnedTerm>, TermConversionError>

Source

pub fn try_into_tuple(self) -> Result<Vec<OwnedTerm>, TermConversionError>

Source

pub fn try_into_map( self, ) -> Result<BTreeMap<OwnedTerm, OwnedTerm>, TermConversionError>

Source

pub fn try_into_binary(self) -> Result<Vec<u8>, TermConversionError>

Source

pub fn try_into_string(self) -> Result<String, TermConversionError>

Source

pub fn try_into_atom(self) -> Result<Arc<str>, TermConversionError>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn estimated_encoded_size(&self) -> usize

Source§

impl OwnedTerm

Trait Implementations§

Source§

impl Clone for OwnedTerm

Source§

fn clone(&self) -> OwnedTerm

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

Source§

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

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

impl Default for OwnedTerm

Source§

fn default() -> OwnedTerm

Returns the “default value” for a type. Read more
Source§

impl Display for OwnedTerm

Source§

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

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

impl<T> From<&[T]> for OwnedTerm
where T: Into<OwnedTerm> + Clone,

Source§

fn from(slice: &[T]) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<&str> for OwnedTerm

Source§

fn from(s: &str) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<Atom> for OwnedTerm

Source§

fn from(a: Atom) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<BTreeMap<OwnedTerm, OwnedTerm>> for OwnedTerm

Source§

fn from(m: BTreeMap<OwnedTerm, OwnedTerm>) -> OwnedTerm

Converts to this type from the input type.
Source§

impl<K, V, S> From<HashMap<K, V, S>> for OwnedTerm

Source§

fn from(m: HashMap<K, V, S>) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<String> for OwnedTerm

Source§

fn from(s: String) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<Vec<OwnedTerm>> for OwnedTerm

Source§

fn from(v: Vec<OwnedTerm>) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<Vec<i32>> for OwnedTerm

Source§

fn from(v: Vec<i32>) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<Vec<i64>> for OwnedTerm

Source§

fn from(v: Vec<i64>) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for OwnedTerm

Source§

fn from(b: Vec<u8>) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<bool> for OwnedTerm

Source§

fn from(b: bool) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<f32> for OwnedTerm

Source§

fn from(f: f32) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<f64> for OwnedTerm

Source§

fn from(f: f64) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<i16> for OwnedTerm

Source§

fn from(i: i16) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<i32> for OwnedTerm

Source§

fn from(i: i32) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<i64> for OwnedTerm

Source§

fn from(i: i64) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<i8> for OwnedTerm

Source§

fn from(i: i8) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<u16> for OwnedTerm

Source§

fn from(i: u16) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<u32> for OwnedTerm

Source§

fn from(i: u32) -> OwnedTerm

Converts to this type from the input type.
Source§

impl From<u8> for OwnedTerm

Source§

fn from(i: u8) -> OwnedTerm

Converts to this type from the input type.
Source§

impl<K, V> FromIterator<(K, V)> for OwnedTerm
where K: Into<OwnedTerm>, V: Into<OwnedTerm>,

Source§

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

Creates a value from an iterator. Read more
Source§

impl<T> FromIterator<T> for OwnedTerm
where T: Into<OwnedTerm>,

Source§

fn from_iter<I>(iter: I) -> OwnedTerm
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

impl Hash for OwnedTerm

Source§

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

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 Index<&OwnedTerm> for OwnedTerm

Source§

type Output = OwnedTerm

The returned type after indexing.
Source§

fn index(&self, key: &OwnedTerm) -> &<OwnedTerm as Index<&OwnedTerm>>::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for OwnedTerm

Source§

type Output = OwnedTerm

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &<OwnedTerm as Index<usize>>::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IntoIterator for OwnedTerm

Source§

type Item = OwnedTerm

The type of the elements being iterated over.
Source§

type IntoIter = OwnedTermIntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <OwnedTerm as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl KeyValueAccess for OwnedTerm

Source§

fn kv_get(&self, key: &str) -> Option<&OwnedTerm>

Retrieve the value associated with an atom key, returning the raw term
Source§

fn kv_get_i64(&self, key: &str) -> Option<i64>

Retrieve an i64 value by key
Source§

fn kv_get_i64_or(&self, key: &str, default: i64) -> i64

Retrieve an i64 value by key or return the default if the key is missing
Source§

fn kv_get_bool(&self, key: &str) -> Option<bool>

Retrieve a boolean value by key
Source§

fn kv_get_bool_or(&self, key: &str, default: bool) -> bool

Retrieve a boolean value by key, or return the default if the key is missing
Source§

fn kv_get_atom(&self, key: &str) -> Option<&Atom>

Retrieve an atom value by key
Source§

fn kv_get_atom_string(&self, key: &str) -> Option<String>

Retrieve an atom value as a string by key
Source§

fn kv_get_atom_string_or(&self, key: &str, default: &str) -> String

Retrieve an atom value as a string by key or return the default if the key is missing
Source§

fn kv_get_string(&self, key: &str) -> Option<String>

Retrieve a string value by key
Source§

fn kv_get_string_or(&self, key: &str, default: &str) -> String

Retrieve a string value by key or return the default if the key is missing
Source§

fn kv_get_pid(&self, key: &str) -> Option<&ExternalPid>

Retrieve a PID value by key
Source§

fn kv_get_pid_string(&self, key: &str) -> Option<String>

Retrieve a PID value as a formatted string by key
Source§

fn kv_get_pid_string_or(&self, key: &str, default: &str) -> String

Retrieve a PID value as a formatted string by key or return the default if the key is missing
Source§

fn kv_get_mfa_string(&self, key: &str) -> Option<String>

Retrieve an MFA value as a formatted string by key
Source§

fn kv_get_mfa_string_or(&self, key: &str, default: &str) -> String

Retrieve an MFA value as a formatted string by key or return the default if the key is missing
Source§

impl Ord for OwnedTerm

Source§

fn cmp(&self, other: &OwnedTerm) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl OwnedTermExt for OwnedTerm

Source§

impl PartialEq for OwnedTerm

Source§

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

Source§

fn partial_cmp(&self, other: &OwnedTerm) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TermIndex for &OwnedTerm

Source§

fn get_from_term<'a>(&self, term: &'a OwnedTerm) -> Option<&'a OwnedTerm>

Source§

impl TryFrom<OwnedTerm> for Vec<OwnedTerm>

Source§

type Error = TermConversionError

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

fn try_from( term: OwnedTerm, ) -> Result<Vec<OwnedTerm>, <Vec<OwnedTerm> as TryFrom<OwnedTerm>>::Error>

Performs the conversion.
Source§

impl TryFrom<OwnedTerm> for Vec<u8>

Source§

type Error = TermConversionError

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

fn try_from( term: OwnedTerm, ) -> Result<Vec<u8>, <Vec<u8> as TryFrom<OwnedTerm>>::Error>

Performs the conversion.
Source§

impl Eq for OwnedTerm

Source§

impl StructuralPartialEq for OwnedTerm

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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more