Add example(s)
@@ -103,6 +103,34 @@ pub trait Service: Send + Sync + 'static {
fn service_id(&self) -> u16;
/// Unique human readable service name.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use exonum::blockchain::Service;
+ /// use exonum::crypto::Hash;
+ /// # use exonum::blockchain::Transaction;
+ /// # use exonum::messages::RawTransaction;
+ /// # use exonum::encoding::Error as MessageError;
+ /// # use exonum::storage::Snapshot;
+ ///
+ /// struct MyService {}
+ ///
+ /// impl Service for MyService {
+ /// # fn service_id(&self) -> u16 {
+ /// # 8000
+ /// # }
+ /// fn service_name(&self) -> &'static str {
+ /// "my_special_unique_service"
+ /// }
+ /// # fn state_hash(&self, _: &Snapshot) -> Vec<Hash> {
+ /// # Vec::new()
+ /// # }
+ /// # fn tx_from_raw(&self, _: RawTransaction) -> Result<Box<Transaction>, MessageError> {
+ /// # unimplemented!()
+ /// # }
+ /// }
+ /// ```
fn service_name(&self) -> &'static str;
/// Returns a list of root hashes of tables that determine the current state
@@ -115,6 +143,34 @@ pub trait Service: Send + Sync + 'static {
///
/// [1]: struct.Schema.html#method.state_hash_aggregator
/// [2]: struct.Blockchain.html#method.service_table_unique_key
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use exonum::blockchain::Service;
+ /// use exonum::crypto::Hash;
+ /// use exonum::storage::Snapshot;
+ /// # use exonum::blockchain::Transaction;
+ /// # use exonum::messages::RawTransaction;
+ /// # use exonum::encoding::Error as MessageError;
+ ///
+ /// struct MyService {}
+ ///
+ /// impl Service for MyService {
+ /// # fn service_id(&self) -> u16 {
+ /// # 8000
+ /// # }
+ /// # fn service_name(&self) -> &'static str {
+ /// # "my_special_unique_service"
+ /// # }
+ /// fn state_hash(&self, _: &Snapshot) -> Vec<Hash> {
+ /// Vec::new()
+ /// }
+ /// # fn tx_from_raw(&self, _: RawTransaction) -> Result<Box<Transaction>, MessageError> {
+ /// # unimplemented!()
+ /// # }
+ /// }
+ /// ```
fn state_hash(&self, snapshot: &Snapshot) -> Vec<Hash>;
/// Tries to create `Transaction` object from the given raw message.
