Data

Struct Data 

Source
pub struct Data<'data>(/* private fields */);
Expand description

Upstream documentation: gpgme_data_t

Implementations§

Source§

impl<'data> Data<'data>

Source

pub unsafe fn from_raw(raw: gpgme_data_t) -> Self

Source

pub fn as_raw(&self) -> gpgme_data_t

Source

pub fn into_raw(self) -> gpgme_data_t

Source

pub fn stdin() -> Result<Data<'static>>

Source

pub fn stdout() -> Result<Data<'static>>

Source

pub fn stderr() -> Result<Data<'static>>

Source

pub fn new() -> Result<Data<'static>>

Constructs an empty data object.

Upstream documentation: gpgme_data_new

Source

pub fn load(path: impl CStrArgument) -> Result<Data<'static>>

Constructs a data object and fills it with the contents of the file referenced by path.

Upstream documentation: gpgme_data_new_from_file

Source

pub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Data<'static>>

Constructs a data object and fills it with a copy of bytes.

Upstream documentation: gpgme_data_new_from_mem

Source

pub fn from_buffer(buf: &'data (impl AsRef<[u8]> + ?Sized)) -> Result<Self>

Constructs a data object which copies from buf as needed.

Upstream documentation: gpgme_data_new_from_mem

Source

pub fn from_fd(file: &'data (impl AsRawFd + ?Sized)) -> Result<Self>

Upstream documentation: gpgme_data_new_from_fd

Source

pub unsafe fn from_raw_file(file: *mut FILE) -> Result<Self>

Upstream documentation: gpgme_data_new_from_stream

Source

pub fn from_reader<R>(r: R) -> Result<Self, WrappedError<R>>
where R: Read + Send + 'data,

Source

pub fn from_seekable_reader<R>(r: R) -> Result<Self, WrappedError<R>>
where R: Read + Seek + Send + 'data,

Source

pub fn from_writer<W>(w: W) -> Result<Self, WrappedError<W>>
where W: Write + Send + 'data,

Source

pub fn from_seekable_writer<W>(w: W) -> Result<Self, WrappedError<W>>
where W: Write + Seek + Send + 'data,

Source

pub fn from_stream<S>(s: S) -> Result<Self, WrappedError<S>>
where S: Read + Write + Send + 'data,

Source

pub fn from_seekable_stream<S>(s: S) -> Result<Self, WrappedError<S>>
where S: Read + Write + Seek + Send + 'data,

Source

pub fn filename(&self) -> Result<&str, Option<Utf8Error>>

Upstream documentation: gpgme_data_get_file_name

Source

pub fn filename_raw(&self) -> Option<&CStr>

Upstream documentation: gpgme_data_get_file_name

Source

pub fn clear_filename(&mut self) -> Result<()>

Upstream documentation: gpgme_data_set_file_name

Source

pub fn set_filename(&mut self, name: impl CStrArgument) -> Result<()>

Upstream documentation: gpgme_data_set_file_name

Source

pub fn encoding(&self) -> Encoding

Upstream documentation: gpgme_data_get_encoding

Source

pub fn set_encoding(&mut self, enc: Encoding) -> Result<()>

Upstream documentation: gpgme_data_set_encoding

Source

pub fn set_flag( &mut self, name: impl CStrArgument, value: impl CStrArgument, ) -> Result<()>

Upstream documentation: gpgme_data_set_flag

Source

pub fn identify(&mut self) -> Type

Upstream documentation: gpgme_data_identify

Source

pub fn try_into_bytes(self) -> Option<Vec<u8>>

Upstream documentation: gpgme_data_release_and_get_mem

Trait Implementations§

Source§

impl<'data> Debug for Data<'data>

Source§

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

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

impl Drop for Data<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> IntoData<'a> for &mut Data<'a>

Source§

type Output = &mut Data<'a>

Source§

fn into_data(self) -> Result<Self>

Source§

impl<'a> IntoData<'a> for Data<'a>

Source§

type Output = Data<'a>

Source§

fn into_data(self) -> Result<Self>

Source§

impl Read for Data<'_>

Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
1.36.0 · Source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored implementation. Read more
1.0.0 · Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more
1.0.0 · Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · Source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Reads the exact number of bytes required to fill buf. Read more
Source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl Seek for Data<'_>

Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64>

Seek to an offset, in bytes, in a stream. Read more
1.55.0 · Source§

fn rewind(&mut self) -> Result<(), Error>

Rewind to the beginning of a stream. Read more
Source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
1.51.0 · Source§

fn stream_position(&mut self) -> Result<u64, Error>

Returns the current seek position from the start of the stream. Read more
1.80.0 · Source§

fn seek_relative(&mut self, offset: i64) -> Result<(), Error>

Seeks relative to the current position. Read more
Source§

impl Write for Data<'_>

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
Source§

impl Send for Data<'_>

Auto Trait Implementations§

§

impl<'data> Freeze for Data<'data>

§

impl<'data> RefUnwindSafe for Data<'data>

§

impl<'data> !Sync for Data<'data>

§

impl<'data> Unpin for Data<'data>

§

impl<'data> !UnwindSafe for Data<'data>

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<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
Source§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

Source§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
Source§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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, Dst> ConvAsUtil<Dst> for T

Source§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
Source§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
Source§

impl<T> ConvUtil for T

Source§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
Source§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
Source§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
Source§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
Source§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<Src> TryFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
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<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

Source§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
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<Src> ValueFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
Source§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

Source§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.