[][src]Struct darkroom::Register

pub struct Register { /* fields omitted */ }

Holds Cut Variables and their corresponding values stored in a series of key/value pairs.

Cut Register

Implementations

impl Register[src]

pub fn from<T>(json_string: T) -> Result<Register, FrError> where
    T: AsRef<str>, 
[src]

Creates a Register from a string ref

pub fn new() -> Register[src]

pub fn to_string_pretty(&self) -> String[src]

Pretty json formatting for Register serialization

pub fn get_key_value<K>(&self, key: K) -> Option<(&String, &Value)> where
    K: AsRef<str>, 
[src]

Gets a reference to the string slice value for the given var name.

Cut Variable

pub fn get<K>(&self, key: K) -> Option<&Value> where
    K: AsRef<str>, 
[src]

Gets a reference to the string slice value for the given var name.

Cut Variable

pub fn iter(&self) -> Iter<String, Value>[src]

An iterator visiting all Cut Variables in arbitrary order.

pub fn contains_key(&self, key: &str) -> bool[src]

Returns a boolean indicating whether Register.vars contains a given key.

Cut Variable

pub fn destructive_merge<I>(&mut self, others: I) where
    I: IntoIterator<Item = Register>, 
[src]

Merges a foreign Cut register into the caller, overriding any values in self with other

pub fn read_match(&self, json_string: &str) -> Result<Vec<Match>, FrError>[src]

Returns a vector of Match enums enums found in the string provided for use in cut operations.

Read Operation

pub fn read_operation(
    &self,
    mat: Match,
    value: &mut Value,
    hide_vars: bool
) -> Result<(), FrError>
[src]

Replaces a byte range in a given string with the range given in the ::Match provided.

Read Operation

pub fn expect_standalone_var(
    var_name: &str,
    frame_str: &str
) -> Result<(), FrError>
[src]

pub fn write_match(
    var_name: &str,
    frame_str: &str,
    payload_str: &str
) -> Result<Option<String>, FrError>
[src]

Takes a frame string value and compares it against a payload string value returning any declared cut variables found

pub fn write_operation(
    &mut self,
    key: &str,
    val: Value
) -> Result<Option<Value>, FrError>
[src]

Inserts a Value entry into the Register's Cut Variables

Returns an Err if the key value is does not consist solely of characters, dashes, and underscores.

pub fn flush_ignored(&mut self)[src]

Flushes lowercase/ignored variable patters

Trait Implementations

impl Clone for Register[src]

impl Debug for Register[src]

impl Default for Register[src]

impl<'de> Deserialize<'de> for Register[src]

impl PartialEq<Register> for Register[src]

impl Serialize for Register[src]

impl StructuralPartialEq for Register[src]

impl<'a> ToStringHidden for &'a Register[src]

fn to_string_hidden(&self) -> Result<String, FrError>[src]

Pretty formatting for Register serialization, any variables starting with an underscore as it's value hidden

Auto Trait Implementations

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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> ToStringPretty for T where
    T: Serialize + ?Sized
[src]

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.