pub struct McpClient { /* private fields */ }Expand description
MCP Client for connecting to and interacting with MCP servers.
The client can operate in two modes:
- Real mode: Uses rmcp SDK via RmcpClientAdapter
- Mock mode: Returns canned responses for testing
§Validation
Enable parameter validation with with_validation():
let client = McpClient::new(config)?
.with_validation(ValidationConfig::default());When validation is enabled:
connect()caches tool schemas fromlist_tools()call_tool()validates params before calling the server- Errors are enhanced with required fields and suggestions
Implementations§
Source§impl McpClient
impl McpClient
Sourcepub fn new(config: McpConfig) -> Result<McpClient, McpError>
pub fn new(config: McpConfig) -> Result<McpClient, McpError>
Create a new MCP client from configuration.
Validates the configuration and returns an error if invalid. The client is created in disconnected state.
§Errors
Returns McpError::ValidationError if:
config.nameis emptyconfig.commandis empty
§Example
let config = McpConfig::new("novanet", "npx")
.with_args(["-y", "@novanet/mcp-server"]);
let client = McpClient::new(config)?;
assert!(!client.is_connected());Sourcepub fn with_validation(self, config: ValidationConfig) -> McpClient
pub fn with_validation(self, config: ValidationConfig) -> McpClient
Enable parameter validation with the given config.
When validation is enabled:
connect()will cache tool schemas fromlist_tools()call_tool()will validate params before calling the server- Errors will be enhanced with required fields and suggestions
§Example
let client = McpClient::new(config)?
.with_validation(ValidationConfig::default());Sourcepub fn with_cache(self, config: CacheConfig) -> McpClient
pub fn with_cache(self, config: CacheConfig) -> McpClient
Enable response caching with the given config.
When caching is enabled:
- Successful tool responses are cached by
tool:params_hashkey - Subsequent calls with same params return cached results
- Cache entries expire after TTL
- Error responses are never cached
§Example
use std::time::Duration;
let client = McpClient::new(config)?
.with_cache(CacheConfig {
ttl: Duration::from_secs(300), // 5 minutes
max_entries: 1000,
});Sourcepub fn cache_stats(&self) -> Option<ResponseCacheStats>
pub fn cache_stats(&self) -> Option<ResponseCacheStats>
Get cache statistics (hits, misses, entries).
Returns None if caching is disabled.
Sourcepub fn was_last_call_cached(&self) -> bool
pub fn was_last_call_cached(&self) -> bool
Check if the last call_tool() invocation was served from cache.
This method returns the cached status from the most recent tool call.
Use this after call_tool() to determine if the response was cached.
Sourcepub fn mock(name: &str) -> McpClient
pub fn mock(name: &str) -> McpClient
Create a mock MCP client for testing.
The mock client is pre-connected and returns canned responses:
novanet_describe: Returns{"nodes": 62, "arcs": 182}novanet_context: Returns entity context JSON- Other tools: Returns a generic success response
§Example
let client = McpClient::mock("novanet");
assert!(client.is_connected());Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if the client is connected to the server.
For real clients, delegates to adapter’s sync check (non-blocking). This avoids race conditions where AtomicBool becomes stale.
Sourcepub async fn is_connected_async(&self) -> bool
pub async fn is_connected_async(&self) -> bool
Check connection state asynchronously (accurate for real clients).
Sourcepub async fn ping(&self) -> Result<McpPingResult, McpPingError>
pub async fn ping(&self) -> Result<McpPingResult, McpPingError>
Ping the MCP server to verify it’s responsive.
This method:
- Connects to the server if not already connected
- Calls
list_tools()to verify the server responds - Returns latency and tool count
§Example
let result = client.ping().await?;
println!("Server {} responded in {:?} with {} tools",
result.server, result.latency, result.tool_count);Sourcepub fn is_configured(&self) -> bool
pub fn is_configured(&self) -> bool
Quick check if MCP server is likely to be reachable.
Returns true if:
- Mock client: always true
- Real client: adapter exists and is configured
This is a synchronous check that doesn’t actually connect.
Use ping() for a full health check.
Sourcepub async fn connect(&self) -> Result<(), McpError>
pub async fn connect(&self) -> Result<(), McpError>
Connect to the MCP server.
For mock clients, this is a no-op that always succeeds. For real clients, this uses rmcp SDK to connect.
When validation is enabled, this also caches tool schemas from list_tools().
This method is idempotent - calling it when already connected succeeds.
§Errors
Returns McpError::McpStartError if the server process fails to start.
Returns McpError::McpSchemaError if schema caching fails.
Sourcepub async fn disconnect(&self) -> Result<(), McpError>
pub async fn disconnect(&self) -> Result<(), McpError>
Disconnect from the MCP server.
For mock clients, this just updates the connection state. For real clients, this terminates the server process via rmcp.
This method is idempotent - calling it when already disconnected succeeds.
Sourcepub async fn reconnect(&self) -> Result<(), McpError>
pub async fn reconnect(&self) -> Result<(), McpError>
Reconnect to the MCP server.
Useful when the connection is broken (e.g., broken pipe, server crashed). This terminates any existing connection and establishes a new one.
§Errors
Returns McpError::McpStartError if reconnection fails.
§Example
// After detecting a broken connection
client.reconnect().await?;
// Retry the failed operationSourcepub fn is_connection_error(error: &McpError) -> bool
pub fn is_connection_error(error: &McpError) -> bool
Check if an error indicates a broken connection.
Used to determine if a reconnection attempt should be made before the next retry.
Sourcepub async fn call_tool(
&self,
name: &str,
params: Value,
) -> Result<ToolCallResult, McpError>
pub async fn call_tool( &self, name: &str, params: Value, ) -> Result<ToolCallResult, McpError>
Call an MCP tool with the given parameters.
§Arguments
name- Tool name (e.g., “novanet_context”, “read_file”)params- Tool parameters as JSON value
§Validation
When validation is enabled via with_validation():
- Parameters are validated against the tool schema before calling
- Errors include required fields and suggestions
§Errors
Returns McpError::McpValidationFailed if parameter validation fails.
Returns McpError::McpNotConnected if the client is not connected.
Returns McpError::McpToolError if the tool call fails.
§Example
let result = client.call_tool("novanet_context", json!({
"mode": "page",
"focus_key": "qr-code",
"locale": "fr-FR"
})).await?;Sourcepub async fn call_tool_with_retry_events(
&self,
name: &str,
params: Value,
task_id: &Arc<str>,
event_log: &EventLog,
) -> Result<ToolCallResult, McpError>
pub async fn call_tool_with_retry_events( &self, name: &str, params: Value, task_id: &Arc<str>, event_log: &EventLog, ) -> Result<ToolCallResult, McpError>
Call an MCP tool with retry event emission.
This method is similar to call_tool() but emits McpRetry events
through the provided EventLog when connection errors trigger retries.
This enables TUI observability of MCP retry attempts.
§Arguments
name- Tool name (e.g., “novanet_context”)params- Tool parameters as JSONtask_id- Task ID for event correlationevent_log- EventLog for emitting McpRetry events
§Example
let result = client.call_tool_with_retry_events(
"novanet_context",
json!({"mode": "page", "locale": "fr-FR"}),
&task_id,
&event_log,
).await?;Sourcepub async fn read_resource(
&self,
uri: &str,
) -> Result<ResourceContent, McpError>
pub async fn read_resource( &self, uri: &str, ) -> Result<ResourceContent, McpError>
Read a resource from the MCP server.
§Arguments
uri- Resource URI (e.g., “file:///path”, “neo4j://entity/qr-code”)
§Errors
Returns McpError::McpNotConnected if the client is not connected.
Returns McpError::McpResourceNotFound if the resource doesn’t exist.
§Example
let resource = client.read_resource("neo4j://entity/qr-code").await?;Sourcepub async fn list_tools(&self) -> Result<Vec<ToolDefinition>, McpError>
pub async fn list_tools(&self) -> Result<Vec<ToolDefinition>, McpError>
Sourcepub fn get_tool_definitions(&self) -> Vec<ToolDefinition>
pub fn get_tool_definitions(&self) -> Vec<ToolDefinition>
Get tool definitions synchronously.
For mock clients, returns mock tool definitions.
For real clients, returns cached tools from the last list_tools() call.
Important: For real clients, you must call list_tools().await first
to populate the cache before this method returns useful results.
This method is primarily used for building rig agents where we need tool definitions during construction.
Sourcepub fn is_tool_cache_fresh(&self, ttl: Duration) -> bool
pub fn is_tool_cache_fresh(&self, ttl: Duration) -> bool
Check if the tool cache is still fresh within the given TTL.
Returns true for mock clients (always fresh).
For real clients, checks if tools were fetched within ttl duration.
Sourcepub fn invalidate_tool_cache(&self)
pub fn invalidate_tool_cache(&self)
Invalidate the tool cache, forcing re-fetch on next list_tools() call.
No-op for mock clients.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for McpClient
impl !RefUnwindSafe for McpClient
impl Send for McpClient
impl Sync for McpClient
impl Unpin for McpClient
impl UnsafeUnpin for McpClient
impl !UnwindSafe for McpClient
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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>
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§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 moreSource§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 moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.