[][src]Struct sampi::Sampi

pub struct Sampi {
    pub public_key: [u8; 32],
    pub unix_time: u64,
    pub data: SampiData,
    // some fields omitted
}

Fields

public_key: [u8; 32]unix_time: u64data: SampiData

Methods

impl Sampi[src]

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

Public key as a hex string

pub fn from_base64(base64_string: &str) -> Result<Self>[src]

Attempt to deserialize a Sampi object from a &str of base64

pub fn from_base64_with_pow_check(
    base64_string: &str,
    min_pow_score: u8
) -> Result<Self>
[src]

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

pub fn from_hex(hex_string: &str) -> Result<Self>[src]

Attempt to deserialize a Sampi object from a &str of hex

pub fn from_hex_with_pow_check(
    hex_string: &str,
    min_pow_score: u8
) -> Result<Self>
[src]

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

Serialize this Sampi object to a hex string

pub fn from_bytes(bytes: &[u8]) -> Result<Self>[src]

Attempt to deserialize a Sampi object from a slice of bytes

pub fn from_bytes_with_pow_check(
    bytes: &[u8],
    min_pow_score: u8
) -> Result<Self>
[src]

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

Serialize this Sampi object to a Vector of bytes

pub fn from_str(data: &str) -> Result<Self>[src]

Attempt to deserialize from a string of either base64 or hex

pub fn from_str_with_pow_check(data: &str, min_pow_score: u8) -> Result<Self>[src]

pub fn get_pow_score(&self) -> u8[src]

Get the Proof of Work Score

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

Get the SHA256 hash of the serialized bytes of this object, as a string

pub fn get_hash(&self) -> [u8; 32][src]

Get the SHA256 hash of the serialized bytes of this object, as an array of bytes

Trait Implementations

impl Clone for Sampi[src]

impl Debug for Sampi[src]

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

impl Eq for Sampi[src]

impl Ord for Sampi[src]

impl PartialEq<Sampi> for Sampi[src]

impl PartialOrd<Sampi> for Sampi[src]

impl Serialize for Sampi[src]

Auto Trait Implementations

impl RefUnwindSafe for Sampi

impl Send for Sampi

impl Sync for Sampi

impl Unpin for Sampi

impl UnwindSafe for Sampi

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,