pub struct Untyped<T> { /* private fields */ }Expand description
An untyped client: a transport and the dotted path of a node.
Implementations§
Source§impl<T> Untyped<T>
impl<T> Untyped<T>
Sourcepub fn new(transport: T, path: impl Into<RoutePath>) -> Self
pub fn new(transport: T, path: impl Into<RoutePath>) -> Self
The node at the dotted path ("host.dendrite.digest"); empty is
the service itself.
Sourcepub fn from_route(transport: T, route: Route) -> Self
pub fn from_route(transport: T, route: Route) -> Self
The node at route — what a generated accessor builds; a refused
route makes a client every call of which fails at once.
Sourcepub fn into_transport(self) -> T
pub fn into_transport(self) -> T
Unwrap the transport.
Sourcepub fn child(&self, name: &str) -> Untyped<&T>
pub fn child(&self, name: &str) -> Untyped<&T>
The node name below this one (<path>.<name>): a static child, an
instance of a dynamic one, a peer slot’s name. A name that is not a
route segment makes a client every call of which fails at once with
ClientError::InvalidName.
Sourcepub fn into_child(self, name: &str) -> Untyped<T>
pub fn into_child(self, name: &str) -> Untyped<T>
Self::child, keeping the transport.
Sourcepub fn typed_unchecked<C: FromRoute<T>>(self) -> C
pub fn typed_unchecked<C: FromRoute<T>>(self) -> C
The generated client C of this node, unchecked — for a caller that
knows the interface by other means, or a build with no
ShapeCheck (a client-only one).
Source§impl<T: Transport> Untyped<T>
impl<T: Transport> Untyped<T>
Sourcepub fn call(&self, method: &str, params: Value) -> MethodStream<'_, Value>
pub fn call(&self, method: &str, params: Value) -> MethodStream<'_, Value>
Call method on this node with params (an object, by name): its
items as JSON, Err for the call failing, progress dropped
(.with_progress() keeps it).
Sourcepub async fn call_one(
&self,
method: &str,
params: Value,
) -> Result<Value, ClientError>
pub async fn call_one( &self, method: &str, params: Value, ) -> Result<Value, ClientError>
Call a one-item method: its item, or why there is none.
Sourcepub async fn schema(&self) -> Result<Value, ClientError>
pub async fn schema(&self) -> Result<Value, ClientError>
The node’s schema, as it answers <path>.schema.
Sourcepub async fn typed<C: FromRoute<T> + ShapeCheck>(self) -> Result<C, ClientError>
pub async fn typed<C: FromRoute<T> + ShapeCheck>(self) -> Result<C, ClientError>
This node as the generated client C, once its schema says it
serves C’s interface: every method C calls under the same shape
(a node that serves more is fine). Else
ClientError::ShapeMismatch, and nothing else is called.