[−][src]Struct exonum_middleware_service::Batch
Transactions executed in a batch.
Examples
Batch
is a mutable stub, which adds corresponding transactions on call:
// Suppose we have this interface defined. mod token { #[exonum_interface] pub trait Token<Ctx> { type Output; #[interface_method(id = 0)] fn create_wallet(&self, ctx: Ctx, owner: String) -> Self::Output; #[interface_method(id = 1)] fn burn(&self, ctx: Ctx, amount: u64) -> Self::Output; // Other methods... } } use exonum_middleware_service::{ ArtifactReq, Batch, MiddlewareInterfaceMut, MiddlewareService, }; use token::{Token, TokenMut}; const TOKEN_ID: InstanceId = 100; let mut batch = Batch::new(); batch.create_wallet(TOKEN_ID, "Alice".into()); batch.burn(TOKEN_ID, 50); // Batch can include calls to multiple services. Let's add // a checked call to the token service, which will be routed // through a default middleware service instance. let req: ArtifactReq = "exonum.Token@1".parse().unwrap(); let checked_call = req.burn(TOKEN_ID, 20); batch.checked_call(MiddlewareService::INSTANCE_ID, checked_call); assert_eq!(batch.inner.len(), 3);
Fields
inner: Vec<AnyTx>
Transactions included in the batch.
Methods
impl Batch
[src]
pub fn new() -> Self
[src]
Creates an empty batch.
pub fn with_call(self, call: AnyTx) -> Self
[src]
Appends a call into the batch.
Trait Implementations
impl BinaryValue for Batch
[src]
fn to_bytes(&self) -> Vec<u8>
[src]
fn from_bytes(value: Cow<[u8]>) -> Result<Self, Error>
[src]
fn into_bytes(self) -> Vec<u8>
[src]
impl Clone for Batch
[src]
impl Debug for Batch
[src]
impl Default for Batch
[src]
impl<'de> Deserialize<'de> for Batch
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl GenericCallMut<u32> for Batch
[src]
type Output = ()
Type of values output by the stub.
fn generic_call_mut(
&mut self,
instance_id: InstanceId,
method: MethodDescriptor,
args: Vec<u8>
) -> Self::Output
[src]
&mut self,
instance_id: InstanceId,
method: MethodDescriptor,
args: Vec<u8>
) -> Self::Output
impl ProtobufConvert for Batch
[src]
type ProtoStruct = Batch
Type of the protobuf clone of Self
fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>
[src]
fn to_pb(&self) -> Self::ProtoStruct
[src]
impl Serialize for Batch
[src]
Auto Trait Implementations
impl RefUnwindSafe for Batch
impl Send for Batch
impl Sync for Batch
impl Unpin for Batch
impl UnwindSafe for Batch
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
unsafe fn initialize(place: *mut T)
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,