Struct rune::Storage[][src]

pub struct Storage { /* fields omitted */ }

Storage for synthetic language items.

Implementations

impl Storage[src]

pub fn insert_number<N>(&self, number: N) -> usize where
    Number: From<N>, 
[src]

Construct a new number.

The number will be stored in this storage, and will be synthetic (rather than from the source).

pub fn insert_str(&self, string: &str) -> usize[src]

Insert the given text into storage and return its id.

This will reuse old storage slots that already contains the given string.

pub fn insert_string(&self, string: String) -> usize[src]

Insert the given owned string into storage and return its id.

This will reuse old storage slots that already contains the given string.

pub fn insert_byte_string(&self, bytes: &[u8]) -> usize[src]

Insert the given text into storage and return its id.

This will reuse old storage slots that already contains the given byte string.

pub fn with_byte_string<F, O>(&self, id: usize, with: F) -> Option<O> where
    F: FnOnce(&[u8]) -> O, 
[src]

Get the content of the byte string with the specified id and apply the given operation over it.

pub fn get_string(&self, id: usize) -> Option<String>[src]

Get the content of the string with the specified id.

pub fn with_string<F, O>(&self, id: usize, with: F) -> Option<O> where
    F: FnOnce(&str) -> O, 
[src]

Get the content of the string with the specified id and apply the given operation over it.

pub fn get_byte_string(&self, id: usize) -> Option<Vec<u8>>[src]

Get the content of the byte string with the specified id.

pub fn get_number(&self, id: usize) -> Option<Number>[src]

Get the content of the number with the specified id.

pub fn with_number<F, O>(&self, id: usize, with: F) -> Option<O> where
    F: FnOnce(&Number) -> O, 
[src]

Get the content of the number with the specified id and apply the given operation over it.

Trait Implementations

impl Clone for Storage[src]

impl Default for Storage[src]

Auto Trait Implementations

impl !RefUnwindSafe for Storage

impl !Send for Storage

impl !Sync for Storage

impl Unpin for Storage

impl !UnwindSafe for Storage

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.