rune_core::protocol

Struct Protocol

Source
#[non_exhaustive]
pub struct Protocol { pub name: &'static str, pub method: Option<&'static str>, pub hash: Hash, /* private fields */ }
Expand description

A built in instance function.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: &'static str

The name of the builtin function.

§method: Option<&'static str>

If this protocol defines an associated method, this is the name of that method.

§hash: Hash

The hash of the builtin function.

Implementations§

Source§

impl Protocol

Source

pub const GET: Protocol = _

The function to access a field.

Source

pub const SET: Protocol = _

The function to set a field.

Source

pub const INDEX_GET: Protocol = _

The function to access an index.

Source

pub const INDEX_SET: Protocol = _

The function to set an index.

Source

pub const PARTIAL_EQ: Protocol = _

Check two types for partial equality.

Source

pub const EQ: Protocol = _

Check two types for total equality.

Source

pub const PARTIAL_CMP: Protocol = _

Perform an partial comparison between two values.

Source

pub const GT: Protocol = _

The protocol behind the > operator.

Source

pub const GE: Protocol = _

The protocol behind the >= operator.

Source

pub const LT: Protocol = _

The protocol behind the > operator.

Source

pub const LE: Protocol = _

The protocol behind the <= operator.

Source

pub const MAX: Protocol = _

Source

pub const MIN: Protocol = _

Source

pub const CMP: Protocol = _

Perform an total comparison between two values.

Source

pub const ADD: Protocol = _

The function to implement for the addition operation.

Source

pub const ADD_ASSIGN: Protocol = _

The function to implement for the addition assign operation.

Source

pub const SUB: Protocol = _

The function to implement for the subtraction operation.

Source

pub const SUB_ASSIGN: Protocol = _

The function to implement for the subtraction assign operation.

Source

pub const MUL: Protocol = _

The function to implement for the multiply operation.

Source

pub const MUL_ASSIGN: Protocol = _

The function to implement for the multiply assign operation.

Source

pub const DIV: Protocol = _

The function to implement for the division operation.

Source

pub const DIV_ASSIGN: Protocol = _

The function to implement for the division assign operation.

Source

pub const REM: Protocol = _

The function to implement for the remainder operation.

Source

pub const REM_ASSIGN: Protocol = _

The function to implement for the remainder assign operation.

Source

pub const BIT_AND: Protocol = _

The function to implement for the bitwise and operation.

Source

pub const BIT_AND_ASSIGN: Protocol = _

The function to implement for the bitwise and assign operation.

Source

pub const BIT_XOR: Protocol = _

The function to implement for the bitwise xor operation.

Source

pub const BIT_XOR_ASSIGN: Protocol = _

The function to implement for the bitwise xor assign operation.

Source

pub const BIT_OR: Protocol = _

The function to implement for the bitwise or operation.

Source

pub const BIT_OR_ASSIGN: Protocol = _

The function to implement for the bitwise xor assign operation.

Source

pub const SHL: Protocol = _

The function to implement for the bitwise shift left operation.

Source

pub const SHL_ASSIGN: Protocol = _

The function to implement for the bitwise shift left assign operation.

Source

pub const SHR: Protocol = _

The function to implement for the bitwise shift right operation.

Source

pub const SHR_ASSIGN: Protocol = _

The function to implement for the bitwise shift right assign operation.

Source

pub const DISPLAY_FMT: Protocol = _

Protocol function used by template strings.

Source

pub const DEBUG_FMT: Protocol = _

Protocol function used by custom debug impls.

Source

pub const INTO_ITER: Protocol = _

Function used to convert an argument into an iterator.

Source

pub const NEXT: Protocol = _

The function to call to continue iteration.

Source

pub const NTH: Protocol = _

The function to call to continue iteration at the nth element.

Source

pub const NTH_BACK: Protocol = _

The function to call to continue iteration at the nth element form the back.

Source

pub const SIZE_HINT: Protocol = _

Protocol used when getting the size hint of an iterator.

Source

pub const LEN: Protocol = _

Protocol used when getting the exact length of an iterator.

Source

pub const NEXT_BACK: Protocol = _

Protocol used when cloning a value.

Source

pub const INTO_FUTURE: Protocol = _

Function used to convert an argument into a future.

Signature: fn(Value) -> Future.

Source

pub const INTO_TYPE_NAME: Protocol = _

Coerce a value into a type name. This is stored as a constant.

Source

pub const IS_VARIANT: Protocol = _

Function used to test if a value is a specific variant.

Signature: fn(self, usize) -> bool.

Source

pub const TRY: Protocol = _

Function used for the question mark operation.

Signature: fn(self) -> Result.

Note that it uses the Result like Try uses ControlFlow i.e., for Result::<T, E> it should return Result<T, Result<(), E>>

Source

pub const HASH: Protocol = _

Protocol used when calculating a hash.

Source

pub const CLONE: Protocol = _

Protocol used when cloning a value.

Source

pub fn from_hash(hash: Hash) -> Option<Self>

Look up protocol for the given hash.

Trait Implementations§

Source§

impl Debug for Protocol

Source§

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

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

impl Display for Protocol

Source§

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

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

impl Hash for Protocol

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 IntoHash for &Protocol

Source§

fn into_hash(self) -> Hash

Convert current type into a hash.
Source§

impl PartialEq for Protocol

Source§

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

Source§

impl ToTypeHash for &Protocol

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

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> TryToString for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, Error>

Converts the given value to a String. Read more