[][src]Struct bookkeeping::Book

pub struct Book<T: Metadata> { /* fields omitted */ }

Entry point to the API and retains ownership of accounts, units and moves.

A reference to a book is an argument in any call to create a new account, unit or move. The new entity is both registered in the book and returned in an std::rc::Rc. Since the book retains an Rc of that entity, the returned Rc may be dropped.

Implementations

impl<T: Metadata> Book<T>[src]

pub fn new(meta: T::Book) -> Self[src]

Creates a new book

impl<T: Metadata> Book<T>[src]

pub fn set_metadata(&self, meta: T::Book)[src]

Sets the metadata value on this entity.

pub fn get_metadata(&self) -> Ref<'_, T::Book>[src]

Gets the metadata value on this entity.

Internally, the field that holds metadata is an std::cell::RefCell. Ideally, I would not like to leak this detail through the public API by returning std::cell::Ref here. Yet, I'm not sure what the alternative is. Perhaps returning a clone?

Trait Implementations

impl<T: Metadata> Debug for Book<T>[src]

impl<T: Default + Metadata> Default for Book<T> where
    T::Book: Default
[src]

impl<T: Metadata> Drop for Book<T>[src]

impl<T: Metadata> PartialEq<Book<T>> for Book<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Book<T>

impl<T> !Send for Book<T>

impl<T> !Sync for Book<T>

impl<T> Unpin for Book<T> where
    <T as Metadata>::Book: Unpin

impl<T> !UnwindSafe for Book<T>

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