Struct cap_sdk_core::RootBucket
source · [−]pub struct RootBucket(pub Principal);Expand description
A root bucket.
Every token contract has a root bucket. This bucket is used for the main inserting transactions into history, and organizing fetching the bucket that corresponds to a given transaction.
A root bucket implements the same interface as Bucket, but with 3 additional methods.
Use RootBucket’s Into<Bucket> implementation to use a RootBucket as a Bucket.
Tuple Fields
0: PrincipalImplementations
sourceimpl RootBucket
impl RootBucket
sourcepub async fn get_bucket_for(
&self,
id: u64
) -> Result<Bucket, (RejectionCode, String)>
pub async fn get_bucket_for(
&self,
id: u64
) -> Result<Bucket, (RejectionCode, String)>
Returns a bucket that be used to query for the given transaction ID.
sourcepub async fn insert(
&self,
event: &IndefiniteEvent
) -> Result<u64, (RejectionCode, String)>
pub async fn insert(
&self,
event: &IndefiniteEvent
) -> Result<u64, (RejectionCode, String)>
Inserts the given transaction and returns it’s issued transaction ID.
sourcepub async fn insert_many(
&self,
events: &[IndefiniteEvent]
) -> Result<u64, (RejectionCode, String)>
pub async fn insert_many(
&self,
events: &[IndefiniteEvent]
) -> Result<u64, (RejectionCode, String)>
Inserts the given transactions.
Trait Implementations
sourceimpl CandidType for RootBucket
impl CandidType for RootBucket
sourceimpl Clone for RootBucket
impl Clone for RootBucket
sourcefn clone(&self) -> RootBucket
fn clone(&self) -> RootBucket
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<'de> Deserialize<'de> for RootBucket
impl<'de> Deserialize<'de> for RootBucket
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<RootBucket> for Bucket
impl From<RootBucket> for Bucket
sourcefn from(root: RootBucket) -> Self
fn from(root: RootBucket) -> Self
Converts to this type from the input type.
sourceimpl Serialize for RootBucket
impl Serialize for RootBucket
impl Copy for RootBucket
Auto Trait Implementations
impl RefUnwindSafe for RootBucket
impl Send for RootBucket
impl Sync for RootBucket
impl Unpin for RootBucket
impl UnwindSafe for RootBucket
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more