Skip to main content

Memory

Struct Memory 

Source
pub struct Memory { /* private fields */ }
Expand description

What is remembered about each node. The ones not listed have nothing said about them, which is the same as nothing being kept.

Implementations§

Source§

impl Memory

Source

pub fn new() -> Self

Nothing remembered about anything.

Source

pub fn identify( &mut self, id: impl Into<NodeId>, what: impl Into<String>, ) -> Option<String>

Says what implements this node, returning what it was called before.

Source

pub fn identity_of(&self, id: &NodeId) -> Option<&str>

What implements it, if it was said.

Source

pub fn declared_as( &mut self, id: impl Into<NodeId>, declaration: impl Into<String>, )

Says what this node was built with, as a digest of the arguments that made it. The class is half of what a node is; this is the other half.

Source

pub fn declaration_of(&self, id: &NodeId) -> Option<&str>

What it was built with, if anybody could say. Absent is not a reason to refuse a key; refusing is cacheable’s side of it.

Source

pub fn freeze(&mut self, id: impl Into<NodeId>, state: Option<String>)

Says this node’s state does not change from here on, with the digest of the state it is settled at. Called twice on purpose: .frozen() says it with no digest, and whoever can hash the weights says it again with one.

Source

pub fn is_frozen(&self, id: &NodeId) -> bool

Whether this node’s state was said not to change.

Source

pub fn state_of(&self, id: &NodeId) -> Option<&str>

The digest of the state it is frozen at, if it is frozen and has one.

Source

pub fn cache(&mut self, id: impl Into<NodeId>, salt: Option<String>)

Says this node’s output is worth keeping, with the caller’s salt if they gave one — how you tell apart two runs the key cannot.

Source

pub fn is_cached(&self, id: &NodeId) -> bool

Whether this node’s output is kept. Not being kept is no break in the chain: its key is still computed and passed on.

Source

pub fn salt_of(&self, id: &NodeId) -> Option<&str>

The salt it is cached under, if it is cached and has one.

Source

pub fn map(&mut self, id: impl Into<NodeId>)

Says this node maps over the items of its input: a list in, a list as long out, item i out from item i in.

What makes a cache work item by item — one new document among a thousand runs once instead of missing all thousand. Declared and not asked.

Source

pub fn is_mapped(&self, id: &NodeId) -> bool

Whether this node was said to map over its items.

Source

pub fn written_as( &mut self, id: impl Into<NodeId>, fingerprint: impl Into<String>, ) -> Option<String>

Notes which version of the code this graph was written against. Metadata: never in a key, only compared on a hit.

Source

pub fn fingerprint_of(&self, id: &NodeId) -> Option<&str>

Which version of the code it was written against, if it was noted.

Source

pub fn len(&self) -> usize

How many nodes have anything said about them at all.

Source

pub fn is_empty(&self) -> bool

Whether nothing has been said about any node, which is what lets the engine skip all of this.

Trait Implementations§

Source§

impl Clone for Memory

Source§

fn clone(&self) -> Memory

Returns a duplicate 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 Memory

Source§

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

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

impl Default for Memory

Source§

fn default() -> Memory

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Memory

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Memory

Source§

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

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Memory

Source§

impl StructuralPartialEq for Memory

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,