pub struct Data<'data>(/* private fields */);
Expand description
Upstream documentation:
gpgme_data_t
Implementations§
Source§impl<'data> Data<'data>
impl<'data> Data<'data>
pub unsafe fn from_raw(raw: gpgme_data_t) -> Self
pub fn as_raw(&self) -> gpgme_data_t
pub fn into_raw(self) -> gpgme_data_t
pub fn stdin() -> Result<Data<'static>>
pub fn stdout() -> Result<Data<'static>>
pub fn stderr() -> Result<Data<'static>>
Sourcepub fn new() -> Result<Data<'static>>
pub fn new() -> Result<Data<'static>>
Constructs an empty data object.
Upstream documentation:
gpgme_data_new
Sourcepub fn load(path: impl CStrArgument) -> Result<Data<'static>>
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
Sourcepub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Data<'static>>
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
Sourcepub fn from_buffer(buf: &'data (impl AsRef<[u8]> + ?Sized)) -> Result<Self>
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
Sourcepub fn from_fd(file: &'data (impl AsRawFd + ?Sized)) -> Result<Self>
pub fn from_fd(file: &'data (impl AsRawFd + ?Sized)) -> Result<Self>
Upstream documentation:
gpgme_data_new_from_fd
Sourcepub unsafe fn from_raw_file(file: *mut FILE) -> Result<Self>
pub unsafe fn from_raw_file(file: *mut FILE) -> Result<Self>
Upstream documentation:
gpgme_data_new_from_stream
pub fn from_reader<R>(r: R) -> Result<Self, WrappedError<R>>
pub fn from_seekable_reader<R>(r: R) -> Result<Self, WrappedError<R>>
pub fn from_writer<W>(w: W) -> Result<Self, WrappedError<W>>
pub fn from_seekable_writer<W>(w: W) -> Result<Self, WrappedError<W>>
pub fn from_stream<S>(s: S) -> Result<Self, WrappedError<S>>
pub fn from_seekable_stream<S>(s: S) -> Result<Self, WrappedError<S>>
Sourcepub fn filename(&self) -> Result<&str, Option<Utf8Error>>
pub fn filename(&self) -> Result<&str, Option<Utf8Error>>
Upstream documentation:
gpgme_data_get_file_name
Sourcepub fn filename_raw(&self) -> Option<&CStr>
pub fn filename_raw(&self) -> Option<&CStr>
Upstream documentation:
gpgme_data_get_file_name
Sourcepub fn clear_filename(&mut self) -> Result<()>
pub fn clear_filename(&mut self) -> Result<()>
Upstream documentation:
gpgme_data_set_file_name
Sourcepub fn set_filename(&mut self, name: impl CStrArgument) -> Result<()>
pub fn set_filename(&mut self, name: impl CStrArgument) -> Result<()>
Upstream documentation:
gpgme_data_set_file_name
Sourcepub fn encoding(&self) -> Encoding
pub fn encoding(&self) -> Encoding
Upstream documentation:
gpgme_data_get_encoding
Sourcepub fn set_encoding(&mut self, enc: Encoding) -> Result<()>
pub fn set_encoding(&mut self, enc: Encoding) -> Result<()>
Upstream documentation:
gpgme_data_set_encoding
Sourcepub fn set_flag(
&mut self,
name: impl CStrArgument,
value: impl CStrArgument,
) -> Result<()>
pub fn set_flag( &mut self, name: impl CStrArgument, value: impl CStrArgument, ) -> Result<()>
Upstream documentation:
gpgme_data_set_flag
Sourcepub fn identify(&mut self) -> Type
pub fn identify(&mut self) -> Type
Upstream documentation:
gpgme_data_identify
Sourcepub fn try_into_bytes(self) -> Option<Vec<u8>>
pub fn try_into_bytes(self) -> Option<Vec<u8>>
Upstream documentation:
gpgme_data_release_and_get_mem
Trait Implementations§
Source§impl Read for Data<'_>
impl Read for Data<'_>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf
. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf
. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf
. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read moreSource§impl Seek for Data<'_>
impl Seek for Data<'_>
Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
1.55.0 · Source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len
)Source§impl Write for Data<'_>
impl Write for Data<'_>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)