[][src]Struct exonum_testkit::Spec

pub struct Spec<T, Kind> { /* fields omitted */ }

Deploy specification for a Rust artifact. The spec can include zero or more instantiated services.

Examples

#[derive(Debug, ServiceDispatcher, ServiceFactory)]
#[service_factory(artifact_name = "my-service")]
pub struct MyService;
impl Service for MyService {}

impl DefaultInstance for MyService {
    const INSTANCE_ID: InstanceId = 100;
    const INSTANCE_NAME: &'static str = "my-service";
}

let spec = Spec::new(MyService)
    .with_default_instance()
    .with_instance(200, "other-service", 42_u64);
// Deploy `spec` somewhere...

Methods

impl<T, Kind> Spec<T, Kind> where
    T: ServiceFactory
[src]

pub fn with_instance(
    self,
    id: u32,
    name: impl Into<String>,
    constructor: impl BinaryValue
) -> Spec<T, Kind>
[src]

Adds a new built-in service instance to instantiate at the genesis block.

impl<T, Kind> Spec<T, Kind> where
    T: DefaultInstance
[src]

pub fn with_default_instance(self) -> Spec<T, Kind>[src]

Adds a built-in service instance with the default identifiers to instantiate at the genesis block.

Calling this method several times still results in a single default instance added to the blockchain upon creation.

impl<T> Spec<T, Simple> where
    T: ServiceFactory
[src]

pub fn new(service: T) -> Spec<T, Simple>[src]

Creates a spec with no support of data migrations.

impl<T> Spec<T, Migrating> where
    T: ServiceFactory
[src]

pub fn migrating(service: T) -> Spec<T, Migrating>[src]

Creates a spec with support of data migrations.

Trait Implementations

impl<T, Kind> Clone for Spec<T, Kind> where
    T: Clone
[src]

impl<T, Kind> Debug for Spec<T, Kind> where
    Kind: Debug,
    T: Debug
[src]

impl<T> Deploy for Spec<T, Simple> where
    T: ServiceFactory
[src]

impl<T> Deploy for Spec<T, Migrating> where
    T: ServiceFactory + MigrateData
[src]

Auto Trait Implementations

impl<T, Kind> RefUnwindSafe for Spec<T, Kind> where
    Kind: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, Kind> Send for Spec<T, Kind> where
    Kind: Send,
    T: Send

impl<T, Kind> Sync for Spec<T, Kind> where
    Kind: Sync,
    T: Sync

impl<T, Kind> Unpin for Spec<T, Kind> where
    Kind: Unpin,
    T: Unpin

impl<T, Kind> UnwindSafe for Spec<T, Kind> where
    Kind: UnwindSafe,
    T: UnwindSafe

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> 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>,