[][src]Enum safe_nd::AData

pub enum AData {
    PubSeq(PubSeqAppendOnlyData),
    PubUnseq(PubUnseqAppendOnlyData),
    UnpubSeq(UnpubSeqAppendOnlyData),
    UnpubUnseq(UnpubUnseqAppendOnlyData),
}

Object storing an AppendOnlyData variant.

Variants

PubSeq(PubSeqAppendOnlyData)

Published sequenced AppendOnlyData.

PubUnseq(PubUnseqAppendOnlyData)

Published unsequenced AppendOnlyData.

UnpubSeq(UnpubSeqAppendOnlyData)

Unpublished sequenced AppendOnlyData.

UnpubUnseq(UnpubUnseqAppendOnlyData)

Unpublished unsequenced AppendOnlyData.

Methods

impl Data[src]

pub fn address(&self) -> &Address[src]

Returns the address.

pub fn kind(&self) -> Kind[src]

Returns the kind.

pub fn name(&self) -> &XorName[src]

Returns the name.

pub fn tag(&self) -> u64[src]

Returns the tag.

pub fn is_pub(&self) -> bool[src]

Returns true if published.

pub fn is_unpub(&self) -> bool[src]

Returns true if unpublished.

pub fn is_seq(&self) -> bool[src]

Returns true if sequenced.

pub fn is_unseq(&self) -> bool[src]

Returns true if unsequenced.

pub fn check_permission(
    &self,
    action: Action,
    requester: PublicKey
) -> Result<()>
[src]

Checks permissions for given action for the provided user.

Returns: Ok(()) if the permissions are valid, Err::InvalidOwners if the last owner is invalid, Err::InvalidPermissions if the requester is not the owner and the last permissions are invalid, Err::AccessDenied if the action is not allowed.

pub fn entries_index(&self) -> u64[src]

Returns the last entry index.

pub fn permissions_index(&self) -> u64[src]

Returns the last permissions index.

pub fn owners_index(&self) -> u64[src]

Returns the last owners index.

pub fn in_range(&self, start: Index, end: Index) -> Option<Entries>[src]

Gets a list of keys and values with the given indices.

pub fn get(&self, key: &[u8]) -> Option<&Vec<u8>>[src]

Returns a value for the given key, if present.

pub fn indices(&self) -> Result<Indices>[src]

Returns a tuple containing the last entries index, last owners index, and last permissions indices.

Always returns Ok(Indices).

pub fn last_entry(&self) -> Option<&Entry>[src]

Returns the last entry, if present.

pub fn owner(&self, owners_index: impl Into<Index>) -> Option<&Owner>[src]

Fetches owner at index.

pub fn owners_range(&self, start: Index, end: Index) -> Option<&[Owner]>[src]

Gets a complete list of owners from the entry in the permissions list at the specified index.

pub fn append_seq(
    &mut self,
    entries: Entries,
    last_entries_index: u64
) -> Result<()>
[src]

Appends new entries.

Returns an error if duplicate entries are present or the data is not sequenced.

pub fn append_unseq(&mut self, entries: Entries) -> Result<()>[src]

Appends new entries.

Returns an error if duplicate entries are present or the data is not unsequenced.

pub fn append_pub_permissions(
    &mut self,
    permissions: PubPermissions,
    permissions_index: u64
) -> Result<()>
[src]

Adds a new published permissions entry for published data. The Perm struct should contain valid indices.

If the specified permissions_index does not match the last recorded permissions index + 1 or if this data is not published, an error will be returned.

pub fn append_unpub_permissions(
    &mut self,
    permissions: UnpubPermissions,
    permissions_index: u64
) -> Result<()>
[src]

Adds a new unpublished permissions entry for unpublished data. The Perm struct should contain valid indices.

If the specified permissions_index does not match the last recorded permissions index + 1 or if this data is not unpublished, an error will be returned.

pub fn append_owner(&mut self, owner: Owner, owners_index: u64) -> Result<()>[src]

Adds a new owner entry.

If the specified owners_index does not match the last recorded owners index + 1, an error will be returned.

pub fn check_is_last_owner(&self, requester: PublicKey) -> Result<()>[src]

Checks if the requester is the last owner.

Returns: Ok(()) if the requester is the owner, Err::InvalidOwners if the last owner is invalid, Err::AccessDenied if the requester is not the owner.

pub fn pub_user_permissions(
    &self,
    user: User,
    index: impl Into<Index>
) -> Result<PubPermissionSet>
[src]

Returns published user permissions, if applicable.

pub fn unpub_user_permissions(
    &self,
    user: PublicKey,
    index: impl Into<Index>
) -> Result<UnpubPermissionSet>
[src]

Returns unpublished user permissions, if applicable.

pub fn pub_permissions(
    &self,
    index: impl Into<Index>
) -> Result<&PubPermissions>
[src]

Returns published permissions, if applicable.

pub fn unpub_permissions(
    &self,
    index: impl Into<Index>
) -> Result<&UnpubPermissions>
[src]

Returns unpublished permissions, if applicable.

pub fn shell(&self, index: impl Into<Index>) -> Result<Self>[src]

Returns the shell of the data.

Trait Implementations

impl Clone for Data[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Ord for Data[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl From<Data> for Data[src]

impl PartialOrd<Data> for Data[src]

impl PartialEq<Data> for Data[src]

impl Eq for Data[src]

impl Debug for Data[src]

impl Hash for Data[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl TryFrom<Response> for AData[src]

type Error = TryFromError

The type returned in the event of a conversion error.

impl Serialize for Data[src]

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

Auto Trait Implementations

impl Sync for Data

impl Send for Data

impl Unpin for Data

impl RefUnwindSafe for Data

impl UnwindSafe for Data

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self