[][src]Struct exonum_api::ApiScope

pub struct ApiScope { /* fields omitted */ }

Exonum API builder for the concrete API scope or, in other words, API access level (public or private).

Endpoints cannot be declared to the builder directly, first you need to indicate the scope the endpoint(s) will belong to.

Methods

impl ApiScope[src]

pub fn new() -> Self[src]

Creates a new instance.

pub fn endpoint<Q, I, R, F, E>(&mut self, name: &str, endpoint: E) -> &mut Self where
    Q: DeserializeOwned + 'static,
    I: Serialize + 'static,
    F: Fn(Q) -> R + 'static + Clone + Send + Sync,
    E: Into<With<Q, I, R, F>>,
    R: Future<Output = Result<I>>, 
[src]

Adds the given endpoint handler to the API scope. These endpoints are designed for reading operations.

For now there is only web backend and it has the following requirements:

  • Query parameters should be decodable via serde_urlencoded, i.e. from the first_param=value1&second_param=value2 form.
  • Response items should be encodable via serde_json crate.

pub fn endpoint_mut<Q, I, R, F, E>(
    &mut self,
    name: &str,
    endpoint: E
) -> &mut Self where
    Q: DeserializeOwned + 'static,
    I: Serialize + 'static,
    F: Fn(Q) -> R + 'static + Clone + Send + Sync,
    E: Into<With<Q, I, R, F>>,
    R: Future<Output = Result<I>>, 
[src]

Adds the given mutable endpoint handler to the API scope. These endpoints are designed for modification operations.

For now there is only web backend and it has the following requirements:

  • Query parameters should be decodable via serde_json.
  • Response items also should be encodable via serde_json crate.

pub fn web_backend(&mut self) -> &mut ApiBuilder[src]

Returns a mutable reference to the underlying web backend.

Trait Implementations

impl Clone for ApiScope[src]

impl Debug for ApiScope[src]

impl Default for ApiScope[src]

Auto Trait Implementations

impl !RefUnwindSafe for ApiScope

impl Send for ApiScope

impl Sync for ApiScope

impl Unpin for ApiScope

impl !UnwindSafe for ApiScope

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