Trait preserves::value::repr::NestedValue

source ·
pub trait NestedValue: Sized + Debug + Clone + Eq + Hash + Ord {
    type Embedded: Embeddable;

Show 14 methods // Required methods fn wrap(anns: Annotations<Self>, v: Value<Self>) -> Self; fn annotations(&self) -> &Annotations<Self>; fn value(&self) -> &Value<Self>; fn pieces(self) -> (Annotations<Self>, Value<Self>); fn value_owned(self) -> Value<Self>; // Provided methods fn new<V>(v: V) -> Self where Value<Self>: From<V> { ... } fn domain<E>(e: E) -> Self where Self::Embedded: From<E> { ... } fn symbol(n: &str) -> Self { ... } fn bytestring<'a, V: Into<Cow<'a, [u8]>>>(v: V) -> Self { ... } fn value_class(&self) -> ValueClass { ... } fn debug_fmt(&self, f: &mut Formatter<'_>) -> Result { ... } fn strip_annotations<M: NestedValue<Embedded = Self::Embedded>>(&self) -> M { ... } fn copy_via<M: NestedValue, F, Err>(&self, f: &mut F) -> Result<M, Err> where F: FnMut(&Self::Embedded) -> Result<Value<M>, Err> { ... } fn foreach_embedded<F, Err>(&self, f: &mut F) -> Result<(), Err> where F: FnMut(&Self::Embedded) -> Result<(), Err> { ... }
}
Expand description

This is the primary programming interface to Preserves values. The most common and useful implementations of this trait are first IOValue and second ArcValue.

Required Associated Types§

source

type Embedded: Embeddable

Every representation of Preserves values has an associated type: that of the Rust data able to be embedded inside a value.

Required Methods§

source

fn wrap(anns: Annotations<Self>, v: Value<Self>) -> Self

Attaches the given Annotations to the Value.

source

fn annotations(&self) -> &Annotations<Self>

Retrieves any annotations attached to self.

source

fn value(&self) -> &Value<Self>

Retrieves the underlying Value represented by self.

source

fn pieces(self) -> (Annotations<Self>, Value<Self>)

Consumes self, yielding its annotations and underlying Value.

source

fn value_owned(self) -> Value<Self>

Consumes self, yielding its underlying Value and discarding its annotations.

Provided Methods§

source

fn new<V>(v: V) -> Self
where Value<Self>: From<V>,

v can be converted to a Value; new does this and then wraps it to yield an instance of Self.

source

fn domain<E>(e: E) -> Self
where Self::Embedded: From<E>,

Embeds e to a Preserves embedded value; e is first converted to Self::Embedded.

source

fn symbol(n: &str) -> Self

Yields a Preserves Symbol embodying the given text, n.

source

fn bytestring<'a, V: Into<Cow<'a, [u8]>>>(v: V) -> Self

Yields a Preserves ByteString.

source

fn value_class(&self) -> ValueClass

Retrieves the ValueClass of self.

source

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

Supplies an opportunity to customize debug formatting for self. Defaults to writing @-prefixed annotations followed by the underlying value.

source

fn strip_annotations<M: NestedValue<Embedded = Self::Embedded>>(&self) -> M

Yields a deep copy of self with all annotations (recursively) removed.

source

fn copy_via<M: NestedValue, F, Err>(&self, f: &mut F) -> Result<M, Err>
where F: FnMut(&Self::Embedded) -> Result<Value<M>, Err>,

Yields a deep copy of self, mapping embedded values to a new type via f.

source

fn foreach_embedded<F, Err>(&self, f: &mut F) -> Result<(), Err>
where F: FnMut(&Self::Embedded) -> Result<(), Err>,

Calls f once for each (recursively) embedded Self::Embedded value in self.

Object Safety§

This trait is not object safe.

Implementors§