Struct rustler::types::atom::Atom

source ·
pub struct Atom { /* private fields */ }

Implementations§

source§

impl Atom

source

pub fn as_c_arg(self) -> NIF_TERM

source

pub fn to_term(self, env: Env<'_>) -> Term<'_>

source

pub fn from_term(term: Term<'_>) -> NifResult<Self>

source

pub fn from_bytes(env: Env<'_>, bytes: &[u8]) -> NifResult<Atom>

Return the atom whose text representation is bytes, like erlang:binary_to_atom/2.

§Errors

Error::BadArg if bytes.len() > 255.

source

pub fn try_from_bytes(env: Env<'_>, bytes: &[u8]) -> NifResult<Option<Atom>>

Return the atom whose text representation is bytes, like erlang:binary_to_existing_atom/2, if atom with given text representation exists.

§Errors

Error::BadArg if bytes.len() > 255.

source

pub fn from_str(env: Env<'_>, string: &str) -> NifResult<Atom>

Return the atom whose text representation is the given string, like erlang:list_to_atom/2.

§Errors

Error::BadArg if string contains characters that aren’t in Latin-1, or if it’s too long. The maximum length is 255 characters.

Trait Implementations§

source§

impl Clone for Atom

source§

fn clone(&self) -> Atom

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 Atom

source§

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

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

impl<'a> Decoder<'a> for Atom

source§

fn decode(term: Term<'a>) -> NifResult<Atom>

source§

impl Encoder for Atom

source§

fn encode<'a>(&self, env: Env<'a>) -> Term<'a>

source§

impl<'a> PartialEq<Term<'a>> for Atom

source§

fn eq(&self, other: &Term<'a>) -> 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 Atom

source§

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

source§

impl Eq for Atom

source§

impl Send for Atom

source§

impl StructuralPartialEq for Atom

source§

impl Sync for Atom

Auto Trait Implementations§

§

impl Freeze for Atom

§

impl RefUnwindSafe for Atom

§

impl Unpin for Atom

§

impl UnwindSafe for Atom

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