pub trait FromUnproved<Req> {
type Request;
type Response;
// Required method
fn maybe_from_unproved_with_metadata<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<(Option<Self>, ResponseMetadata), Error>
where Self: Sized;
// Provided methods
fn maybe_from_unproved<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<Option<Self>, Error>
where Self: Sized { ... }
fn from_unproved<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<Self, Error>
where Self: Sized { ... }
fn from_unproved_with_metadata<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<(Self, ResponseMetadata), Error>
where Self: Sized { ... }
}Expand description
Trait for parsing unproved responses from the Platform.
This trait defines methods for extracting data from responses received from the Platform without the need for cryptographic proof validation. It is primarily used for scenarios where the proof data is not available or not required, and only the data itself is needed.
§Associated Types
Request: The type of the request sent to the server. This represents the format of the data that the platform expects when making a query.Response: The type of the response received from the server. This represents the format of the data returned by the platform after executing the query.
§Methods
maybe_from_unproved: Parses the response to retrieve the requested object, if any.maybe_from_unproved_with_metadata: Parses the response to retrieve the requested object along with response metadata, if any.from_unproved: Retrieves the requested object from the response, returning an error if the object is not found.from_unproved_with_metadata: Retrieves the requested object from the response along with metadata, returning an error if the object is not found.
Required Associated Types§
Required Methods§
Sourcefn maybe_from_unproved_with_metadata<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<(Option<Self>, ResponseMetadata), Error>where
Self: Sized,
fn maybe_from_unproved_with_metadata<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<(Option<Self>, ResponseMetadata), Error>where
Self: Sized,
Parse the received response and retrieve the requested object along with metadata, if any.
§Arguments
request: The request sent to the server.response: The response received from the server.network: The network we are using (Mainnet/Testnet/Devnet/Regtest).platform_version: The platform version that should be used.
§Returns
Ok((Some(object), metadata))when the requested object was found.Ok((None, metadata))when the requested object was not found.Err(Error)when parsing fails or data is invalid.
Provided Methods§
Sourcefn maybe_from_unproved<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<Option<Self>, Error>where
Self: Sized,
fn maybe_from_unproved<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<Option<Self>, Error>where
Self: Sized,
Parse the received response and retrieve the requested object, if any.
§Arguments
request: The request sent to the server.response: The response received from the server.network: The network we are using (Mainnet/Testnet/Devnet/Regtest).platform_version: The platform version that should be used.
§Returns
Ok(Some(object))when the requested object was found in the response.Ok(None)when the requested object was not found.Err(Error)when parsing fails or data is invalid.
Sourcefn from_unproved<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<Self, Error>where
Self: Sized,
fn from_unproved<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<Self, Error>where
Self: Sized,
Retrieve the requested object from the response.
§Arguments
request: The request sent to the server.response: The response received from the server.network: The network we are using.platform_version: The platform version that should be used.
§Returns
Ok(object)when the requested object was found.Err(Error::NotFound)when the requested object was not found.Err(Error)when parsing fails or data is invalid.
Sourcefn from_unproved_with_metadata<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<(Self, ResponseMetadata), Error>where
Self: Sized,
fn from_unproved_with_metadata<I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
) -> Result<(Self, ResponseMetadata), Error>where
Self: Sized,
Retrieve the requested object from the response along with metadata.
§Arguments
request: The request sent to the server.response: The response received from the server.network: The network we are using.platform_version: The platform version that should be used.
§Returns
Ok((object, metadata))when the requested object was found.Err(Error::NotFound)when the requested object was not found.Err(Error)when parsing fails or data is invalid.