[][src]Struct fabric_contract::contract::State

pub struct State { /* fields omitted */ }

A State is the combination of key and value that are contained within a collection.

State-based endorsement should be set on this object as well.

Represents the things that are contained within the Collections.

Implementations

impl State[src]

pub fn make_composite_key(keytype: String, attributes: Vec<String>) -> String[src]

Make a composite key.

Remarks

Takes a set of strings and arranges them in a ':' separate single string

Arguments

  • keytype The first part of the key. Referred to as 'type' but is just the 1st string part of the key.
  • attributes Vector of Strings to make the rest of the ky

pub fn split_composite_key(key: String) -> Vec<String>[src]

Splits a composite key

Splits the composite key into the parts, the first is the string that is passed in as the keytype above

pub fn new(key: String, data: Vec<u8>, collection_name: String) -> State[src]

Creates a new state

pub fn value(&self) -> Vec<u8>[src]

Get the buffer that this state

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

Get the key that used for this state

pub fn get_history(&self)[src]

Returns an iterator of the state history for this state

pub fn get_hash(&self) -> Result<Vec<u8>, LedgerError>[src]

gets the private hash for this stae

pub fn set_endorsment(
    &self,
    sbe: StateBasedEndorsement
) -> Result<(), LedgerError>
[src]

Sets the State Based Endorsment for this state

pub fn get_endorsement(
    &self
) -> Result<Option<StateBasedEndorsement>, LedgerError>
[src]

Trait Implementations

impl Default for State[src]

impl<'_> From<&'_ State> for State[src]

impl<'_> From<(&'_ State, String)> for State[src]

impl From<()> for State[src]

impl From<(String, Vec<u8>)> for State[src]

Implementation of converting to a state from a datatype

Example

This example is not tested
let myAsset = MyAsset::new();
state.from(myAsset);

impl From<Box<dyn DataType>> for State {
    fn from(_:Box<dyn DataType>) -> Self {
       Self::default()
    }
}

impl From<State> for State[src]

impl From<State> for State[src]

impl FromIterator<State> for StateQueryList[src]

Auto Trait Implementations

impl RefUnwindSafe for State

impl Send for State

impl Sync for State

impl Unpin for State

impl UnwindSafe for State

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.