Skip to main content

Reader

Struct Reader 

Source
pub struct Reader { /* private fields */ }
Expand description

Use a Reader to read and validate a manifest store.

Implementations§

Source§

impl Reader

Source

pub fn from_context(context: Context) -> Self

Create a new Reader with the given Context.

This method takes ownership of the Context and wraps it in an Arc internally. Use this for single-use contexts where you don’t need to share the context.

§Arguments
  • context - The Context to use for the Reader
§Returns

A new Reader

§Examples
let context = Context::new().with_settings(r#"{"verify": {"verify_after_sign": true}}"#)?;
let reader = Reader::from_context(context);
Source

pub fn from_shared_context(context: &Arc<Context>) -> Self

Create a new Reader with a shared Context.

This method allows sharing a single Context across multiple builders or readers, even across threads. The Arc is cloned internally, so you pass a reference.

§Arguments
§Returns

A new Reader

§Examples
// Create a shared Context once
let ctx = Arc::new(Context::new().with_settings(r#"{"verify": {"verify_after_sign": true}}"#)?);

// Share it across multiple Readers (even across threads!)
let reader1 = Reader::from_shared_context(&ctx);
let reader2 = Reader::from_shared_context(&ctx);
Source

pub fn with_stream( self, format: &str, stream: impl Read + Seek + MaybeSend, ) -> Result<Self>

Add manifest store from a stream to the Reader

§Arguments
  • format - The format of the stream. MIME type or extension that maps to a MIME type.
  • stream - The stream to read from. Must implement the Read and Seek traits.
§Returns

The updated Reader with the added manifest store.

Source

pub async fn with_stream_async( self, format: &str, stream: impl Read + Seek + MaybeSend, ) -> Result<Self>

Add manifest store from a stream to the Reader

§Arguments
  • format - The format of the stream. MIME type or extension that maps to a MIME type.
  • stream - The stream to read from. Must implement the Read and Seek traits.
§Returns

The updated Reader with the added manifest store.

Source

pub fn from_stream( format: &str, stream: impl Read + Seek + MaybeSend, ) -> Result<Reader>

Create a manifest store Reader from a stream. A Reader is used to validate C2PA data from an asset.

§Arguments
  • format - The format of the stream. MIME type or extension that maps to a MIME type.
  • stream - The stream to read from. Must implement the Read and Seek traits. Send trait is required for sync operations and Sync trait is required for async operations.
§Returns

A Reader for the manifest store.

§Note

CAWG identity assertions require async calls for validation.

Source

pub async fn from_stream_async( format: &str, stream: impl Read + Seek + MaybeSend, ) -> Result<Reader>

Create a manifest store Reader from a stream. A Reader is used to validate C2PA data from an asset.

§Arguments
  • format - The format of the stream. MIME type or extension that maps to a MIME type.
  • stream - The stream to read from. Must implement the Read and Seek traits. Send trait is required for sync operations and Sync trait is required for async operations.
§Returns

A Reader for the manifest store.

§Note

CAWG identity assertions require async calls for validation.

Source

pub fn with_file<P: AsRef<Path>>(self, path: P) -> Result<Self>

Add manifest store from a file to the Reader. If the fetch_remote_manifests feature is enabled, and the asset refers to a remote manifest, the function fetches a remote manifest.

NOTE: If the file does not have a manifest store, the function will check for a sidecar manifest with the same base file name and a .c2pa extension.

§Arguments
  • path - The path to the file.
§Returns

The updated Reader with the added manifest store.

§Errors

Returns an Error when the manifest data cannot be read from the specified file. If there’s no error upon reading, you must still check validation status to ensure that the manifest data is validated. That is, even if there are no errors, the data still might not be valid.

§Example
use c2pa::{Context, Reader};
let reader = Reader::from_context(Context::new()).with_file("path/to/file.jpg")?;
§Note

CAWG identity assertions require async calls for validation.

Source

pub async fn with_file_async<P: AsRef<Path>>(self, path: P) -> Result<Self>

Add manifest store from a file to the Reader. If the fetch_remote_manifests feature is enabled, and the asset refers to a remote manifest, the function fetches a remote manifest.

NOTE: If the file does not have a manifest store, the function will check for a sidecar manifest with the same base file name and a .c2pa extension.

§Arguments
  • path - The path to the file.
§Returns

The updated Reader with the added manifest store.

§Errors

Returns an Error when the manifest data cannot be read from the specified file. If there’s no error upon reading, you must still check validation status to ensure that the manifest data is validated. That is, even if there are no errors, the data still might not be valid.

§Example
use c2pa::{Context, Reader};
let reader = Reader::from_context(Context::new()).with_file("path/to/file.jpg")?;
§Note

CAWG identity assertions require async calls for validation.

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Reader>

Create a manifest store Reader from a file. If the fetch_remote_manifests feature is enabled, and the asset refers to a remote manifest, the function fetches a remote manifest.

NOTE: If the file does not have a manifest store, the function will check for a sidecar manifest with the same base file name and a .c2pa extension.

§Arguments
  • path - The path to the file.
§Returns

A Reader for the manifest store.

§Errors

Returns an Error when the manifest data cannot be read from the specified file. If there’s no error upon reading, you must still check validation status to ensure that the manifest data is validated. That is, even if there are no errors, the data still might not be valid.

§Example
use c2pa::Reader;
let reader = Reader::from_file("path/to/file.jpg").unwrap();
§Note

CAWG identity assertions require async calls for validation.

Source

pub async fn from_file_async<P: AsRef<Path>>(path: P) -> Result<Reader>

Create a manifest store Reader from a file. If the fetch_remote_manifests feature is enabled, and the asset refers to a remote manifest, the function fetches a remote manifest.

NOTE: If the file does not have a manifest store, the function will check for a sidecar manifest with the same base file name and a .c2pa extension.

§Arguments
  • path - The path to the file.
§Returns

A Reader for the manifest store.

§Errors

Returns an Error when the manifest data cannot be read from the specified file. If there’s no error upon reading, you must still check validation status to ensure that the manifest data is validated. That is, even if there are no errors, the data still might not be valid.

§Example
use c2pa::Reader;
let reader = Reader::from_file("path/to/file.jpg").unwrap();
§Note

CAWG identity assertions require async calls for validation.

Source

pub fn from_json(json: &str) -> Result<Reader>

Create a manifest store Reader from a JSON string.

§Arguments
  • json - A JSON string containing a manifest store definition.
§Returns

A Reader for the manifest store.

§WARNING

This function is intended for use in testing. Don’t use it in an implementation.

Source

pub fn with_manifest_data_and_stream( self, c2pa_data: &[u8], format: &str, stream: impl Read + Seek + MaybeSend, ) -> Result<Self>

Add manifest store from existing c2pa_data and a stream to the Reader. Use this to validate a remote manifest or a sidecar manifest.

§Arguments
  • c2pa_data - A C2PA manifest store in JUMBF format.
  • format - The format of the stream.
  • stream - The stream to verify the store against.
§Returns

The updated Reader with the added manifest store.

§Errors

This function returns an Error if the c2pa_data is not valid, or severe errors occur in validation. You must check validation status for non-severe errors.

Source

pub async fn with_manifest_data_and_stream_async( self, c2pa_data: &[u8], format: &str, stream: impl Read + Seek + MaybeSend, ) -> Result<Self>

Add manifest store from existing c2pa_data and a stream to the Reader. Use this to validate a remote manifest or a sidecar manifest.

§Arguments
  • c2pa_data - A C2PA manifest store in JUMBF format.
  • format - The format of the stream.
  • stream - The stream to verify the store against.
§Returns

The updated Reader with the added manifest store.

§Errors

This function returns an Error if the c2pa_data is not valid, or severe errors occur in validation. You must check validation status for non-severe errors.

Source

pub fn from_manifest_data_and_stream( c2pa_data: &[u8], format: &str, stream: impl Read + Seek + MaybeSend, ) -> Result<Reader>

Create a manifest store Reader from existing c2pa_data and a stream. Use this to validate a remote manifest or a sidecar manifest.

§Arguments
  • c2pa_data - A C2PA manifest store in JUMBF format.
  • format - The format of the stream.
  • stream - The stream to verify the store against.
§Returns

A Reader for the manifest store.

§Errors

This function returns an Error ef the c2pa_data is not valid, or severe errors occur in validation. You must check validation status for non-severe errors.

Source

pub async fn from_manifest_data_and_stream_async( c2pa_data: &[u8], format: &str, stream: impl Read + Seek + MaybeSend, ) -> Result<Reader>

Create a manifest store Reader from existing c2pa_data and a stream. Use this to validate a remote manifest or a sidecar manifest.

§Arguments
  • c2pa_data - A C2PA manifest store in JUMBF format.
  • format - The format of the stream.
  • stream - The stream to verify the store against.
§Returns

A Reader for the manifest store.

§Errors

This function returns an Error ef the c2pa_data is not valid, or severe errors occur in validation. You must check validation status for non-severe errors.

Source

pub fn with_fragment( self, format: &str, stream: impl Read + Seek + MaybeSend, fragment: impl Read + Seek + MaybeSend, ) -> Result<Self>

Add manifest store from an initial segment and a fragment stream to the Reader. This would be used to load and validate fragmented MP4 files that span multiple separate asset files.

§Arguments
  • format - The format of the stream.
  • stream - The initial segment stream.
  • fragment - The fragment stream.
§Returns

The updated Reader with the added manifest store.

§Errors

This function returns an Error if the streams are not valid, or severe errors occur in validation. You must check validation status for non-severe errors.

Source

pub async fn with_fragment_async( self, format: &str, stream: impl Read + Seek + MaybeSend, fragment: impl Read + Seek + MaybeSend, ) -> Result<Self>

Add manifest store from an initial segment and a fragment stream to the Reader. This would be used to load and validate fragmented MP4 files that span multiple separate asset files.

§Arguments
  • format - The format of the stream.
  • stream - The initial segment stream.
  • fragment - The fragment stream.
§Returns

The updated Reader with the added manifest store.

§Errors

This function returns an Error if the streams are not valid, or severe errors occur in validation. You must check validation status for non-severe errors.

Source

pub fn from_fragment( format: &str, stream: impl Read + Seek + MaybeSend, fragment: impl Read + Seek + MaybeSend, ) -> Result<Self>

Create a Reader from an initial segment and a fragment stream. This would be used to load and validate fragmented MP4 files that span multiple separate asset files.

§Arguments
  • format - The format of the stream.
  • stream - The initial segment stream.
  • fragment - The fragment stream.
§Returns

A Reader for the manifest store.

§Errors

This function returns an Error if the streams are not valid, or severe errors occur in validation. You must check validation status for non-severe errors.

Source

pub async fn from_fragment_async( format: &str, stream: impl Read + Seek + MaybeSend, fragment: impl Read + Seek + MaybeSend, ) -> Result<Self>

Create a Reader from an initial segment and a fragment stream. This would be used to load and validate fragmented MP4 files that span multiple separate asset files.

§Arguments
  • format - The format of the stream.
  • stream - The initial segment stream.
  • fragment - The fragment stream.
§Returns

A Reader for the manifest store.

§Errors

This function returns an Error if the streams are not valid, or severe errors occur in validation. You must check validation status for non-severe errors.

Source

pub fn with_fragmented_files<P: AsRef<Path>>( self, path: P, fragments: &Vec<PathBuf>, ) -> Result<Self>

Available on crate feature file_io only.

Add manifest store from an initial segment and fragments to the Reader. This would be used to load and validate fragmented MP4 files that span multiple separate asset files.

§Arguments
  • path - The path to the initial segment file.
  • fragments - A vector of paths to fragment files.
§Returns

The updated Reader with the added manifest store.

§Errors

Returns an Error when the manifest data cannot be read from the specified files.

Source

pub fn from_fragmented_files<P: AsRef<Path>>( path: P, fragments: &Vec<PathBuf>, ) -> Result<Reader>

Available on crate feature file_io only.

Loads a Reader` from an initial segment and fragments. This would be used to load and validate fragmented MP4 files that span multiple separate asset files.

Source

pub fn supported_mime_types() -> Vec<String>

Returns a Vec of mime types that [c2pa-rs] is able to read.

Source

pub fn json(&self) -> String

Get the Reader as a JSON string This just calls to_json_formatted

Source

pub fn json_checked(&self) -> Result<String>

Get the Reader as a JSON string, returning an error if formatting fails

This is useful when you need to handle errors from deeply nested or malformed structures. For a version that never fails, use Self::json().

Source

pub fn detailed_json(&self) -> String

Get the Reader as a detailed JSON string This just calls to_json_detailed_formatted

Source

pub fn detailed_json_checked(&self) -> Result<String>

Get the Reader as a detailed JSON string, returning an error if formatting fails

This is useful when you need to handle errors from deeply nested or malformed structures. For a version that never fails, use Self::detailed_json().

Source

pub fn remote_url(&self) -> Option<&str>

Returns the remote url of the manifest if this Reader obtained the manifest remotely.

Source

pub fn is_embedded(&self) -> bool

Returns if the Reader was created from an embedded manifest.

Source

pub fn validation_status(&self) -> Option<&[ValidationStatus]>

Get the [ValidationStatus] array of the manifest store if it exists. Call this method to check for validation errors.

This validation report only includes error statuses applied to the active manifest and error statuses for ingredients that are not already reported by the ingredient status. Use the [ValidationStatus] url method to identify the associated manifest; this can be useful when a validation error does not refer to the active manifest.

§Example
use c2pa::Reader;
let stream = std::io::Cursor::new(include_bytes!("../tests/fixtures/CA.jpg"));
let reader = Reader::from_stream("image/jpeg", stream).unwrap();
let status = reader.validation_status();
Source

pub fn validation_results(&self) -> Option<&ValidationResults>

Get the ValidationResults map of an asset if it exists.

Call this method to check for detailed validation results. The validation_state method should be used to determine the overall validation state.

The results are divided between the active manifest and ingredient deltas. The deltas will only exist if there are validation errors not already reported in ingredients It is normal for there to be many success and information statuses. Any errors will be reported in the failure array.

§Example
use c2pa::Reader;
let stream = std::io::Cursor::new(include_bytes!("../tests/fixtures/CA.jpg"));
let reader = Reader::from_stream("image/jpeg", stream).unwrap();
let status = reader.validation_results();
Source

pub fn validation_state(&self) -> ValidationState

Get the ValidationState of the manifest store.

Source

pub fn active_manifest(&self) -> Option<&Manifest>

Return the active Manifest, or None if there’s no active manifest.

Source

pub fn active_label(&self) -> Option<&str>

Return the active Manifest, or None if there’s no active manifest.

Source

pub fn iter_manifests(&self) -> impl Iterator<Item = &Manifest> + '_

Returns an iterator over a collection of Manifest structs.

Source

pub fn manifests(&self) -> &HashMap<String, Manifest>

Returns a reference to the Manifest collection.

Source

pub fn get_manifest(&self, label: &str) -> Option<&Manifest>

Given a label, return the associated Manifest, if it exists.

§Arguments
  • label - The label of the requested Manifest.
Source

pub fn resource_to_stream( &self, uri: &str, stream: impl Write + Read + Seek + MaybeSend, ) -> Result<usize>

Write a resource identified by URI to the given stream. Use this function, for example, to get a thumbnail or icon image and write it to a stream.

§Arguments
  • uri - The URI of the resource to write (from an identifier field).
  • stream - The stream to write to.
§Returns

The number of bytes written.

§Errors

Returns Error if the resource does not exist.

§Example
use c2pa::Reader;
#[cfg(feature = "file_io")]
{
    let stream = std::io::Cursor::new(Vec::new());
    let reader = Reader::from_file("path/to/file.jpg").unwrap();
    let manifest = reader.active_manifest().unwrap();
    let uri = &manifest.thumbnail_ref().unwrap().identifier;
    let bytes_written = reader.resource_to_stream(uri, stream).unwrap();
}

TODO: Fix the example to not read from a file.

Source

pub fn to_folder<P: AsRef<Path>>(&self, path: P) -> Result<()>

Available on crate feature file_io only.

Write all resources to a folder.

This function writes all resources to a folder. Resources are stored in sub-folders corresponding to manifest label. Conversions ensure the file paths are valid.

§Arguments
  • path - The path to the folder to write to.
§Errors

Returns an Error if the resources cannot be written to the folder.

§Example
use c2pa::Reader;
let reader = Reader::from_file("path/to/file.jpg").unwrap();
reader.to_folder("path/to/folder").unwrap();
Source

pub fn post_validate(&mut self, validator: &impl PostValidator) -> Result<()>

Post-validate the reader. This function is called after the reader is created.

Source

pub async fn post_validate_async( &mut self, validator: &impl AsyncPostValidator, ) -> Result<()>

Post-validate the reader. This function is called after the reader is created.

Source

pub fn into_builder(self) -> Result<Builder>

Convert the Reader back into a Builder. This can be used to modify an existing manifest store.

§Errors

Returns an Error if there is no active manifest.

Trait Implementations§

Source§

impl Debug for Reader

Prints the full debug details of the manifest data.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Reader

Source§

fn default() -> Reader

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Reader

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Reader

Prints the JSON of the manifest data.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl JsonSchema for Reader

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for Reader

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<&Reader> for Value

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(reader: &Reader) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Reader> for Value

Convert the Reader to a JSON value.

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(reader: Reader) -> Result<Self>

Performs the conversion.
Source§

impl TryInto<Builder> for Reader

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Builder>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Reader

§

impl !RefUnwindSafe for Reader

§

impl Send for Reader

§

impl Sync for Reader

§

impl Unpin for Reader

§

impl !UnwindSafe for Reader

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .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
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,