[−][src]Struct exonum_api::ApiScope
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]
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>>,
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 thefirst_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]
&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>>,
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
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]
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> From<T> for T
[src]
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>,