Struct ockam_command::util::Rpc
source · pub struct Rpc {
pub opts: CommandGlobalOpts,
pub timeout: Option<Duration>,
/* private fields */
}Fields§
§opts: CommandGlobalOpts§timeout: Option<Duration>Implementations§
source§impl Rpc
impl Rpc
sourcepub async fn embedded(ctx: &Context, opts: &CommandGlobalOpts) -> Result<Rpc>
pub async fn embedded(ctx: &Context, opts: &CommandGlobalOpts) -> Result<Rpc>
Creates a new RPC to send a request to an embedded node.
sourcepub async fn embedded_with_trust_options(
ctx: &Context,
opts: &CommandGlobalOpts,
trust_context_opts: &TrustContextOpts
) -> Result<Rpc>
pub async fn embedded_with_trust_options( ctx: &Context, opts: &CommandGlobalOpts, trust_context_opts: &TrustContextOpts ) -> Result<Rpc>
Creates a new RPC to send a request to an embedded node.
sourcepub async fn embedded_with_vault_and_identity(
ctx: &Context,
opts: &CommandGlobalOpts,
identity: String,
trust_context_opts: &TrustContextOpts
) -> Result<Rpc>
pub async fn embedded_with_vault_and_identity( ctx: &Context, opts: &CommandGlobalOpts, identity: String, trust_context_opts: &TrustContextOpts ) -> Result<Rpc>
Creates a new RPC to send a request to an embedded node.
sourcepub async fn background(
ctx: &Context,
opts: &CommandGlobalOpts,
node_name: &str
) -> Result<Rpc>
pub async fn background( ctx: &Context, opts: &CommandGlobalOpts, node_name: &str ) -> Result<Rpc>
Creates a new RPC to send a request to a running background node.
pub fn node_name(&self) -> &str
pub fn set_node_name(&mut self, node_name: &str) -> &Self
sourcepub fn set_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn set_timeout(&mut self, timeout: Duration) -> &mut Self
Use a timeout for making requests
pub fn set_to(&mut self, to: &MultiAddr) -> Result<&Self>
sourcepub async fn tell<T>(&mut self, req: RequestBuilder<T>) -> Result<()>where
T: Encode<()>,
pub async fn tell<T>(&mut self, req: RequestBuilder<T>) -> Result<()>where T: Encode<()>,
Send a request This method waits for a response status but does not expect a response body If the status is missing or not, we try to parse an error message and return it
sourcepub async fn tell_and_get_status<T>(
&mut self,
req: RequestBuilder<T>
) -> Result<Option<Status>>where
T: Encode<()>,
pub async fn tell_and_get_status<T>( &mut self, req: RequestBuilder<T> ) -> Result<Option<Status>>where T: Encode<()>,
Send a request This method waits for a response status and returns it if available
sourcepub async fn ask<T, R>(&mut self, req: RequestBuilder<T>) -> Result<R>where
T: Encode<()>,
R: for<'b> Decode<'b, ()>,
pub async fn ask<T, R>(&mut self, req: RequestBuilder<T>) -> Result<R>where T: Encode<()>, R: for<'b> Decode<'b, ()>,
Send a request and expects a decodable response This method parses and returns an error message if the request was not successful
sourcepub async fn ask_and_get_reply<T, R>(
&mut self,
req: RequestBuilder<T>
) -> Result<Reply<R>>where
T: Encode<()>,
R: for<'b> Decode<'b, ()>,
pub async fn ask_and_get_reply<T, R>( &mut self, req: RequestBuilder<T> ) -> Result<Reply<R>>where T: Encode<()>, R: for<'b> Decode<'b, ()>,
Send a request and expects either a decodable response or an API error. This method returns an error if the request cannot be sent of if there is any decoding error
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Rpc
impl Send for Rpc
impl Sync for Rpc
impl Unpin for Rpc
impl !UnwindSafe for Rpc
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more