[][src]Struct mongodb::gridfs::file::File

pub struct File {
    pub doc: GfsFile,
    // some fields omitted
}

A writable or readable file stream within GridFS.

Fields

doc: GfsFile

The file document associated with this stream.

Methods

impl File[src]

Important traits for File
pub fn new(gfs: Store, id: ObjectId, mode: Mode) -> File[src]

A new file stream with an id-referenced GridFS file.

Important traits for File
pub fn with_name(gfs: Store, name: String, id: ObjectId, mode: Mode) -> File[src]

A new file stream with a name-and-id-referenced GridFS file.

Important traits for File
pub fn with_doc(gfs: Store, doc: Document) -> File[src]

A new file stream from a read file document.

pub fn len(&self) -> i64[src]

Returns the byte length of the file.

pub fn is_empty(&self) -> bool[src]

Returns true if the file contains no bytes.

pub fn err_description(&self) -> Result<Option<String>>[src]

Retrieves the description of the threaded error, if one occurred.

pub fn assert_mode(&self, mode: Mode) -> Result<()>[src]

Ensures the file mode matches the desired mode.

pub fn close(&mut self) -> Result<()>[src]

Completes writing or reading and closes the file. This will be called when the file is dropped, but errors will be ignored. Therefore, this method should be called manually.

pub fn find_chunk(&mut self, id: ObjectId, chunk_num: i32) -> Result<Vec<u8>>[src]

Methods from Deref<Target = GfsFile>

pub fn to_bson(&self) -> Document[src]

Converts a GfsFile into a bson document.

Trait Implementations

impl Drop for File[src]

impl DerefMut for File[src]

impl Deref for File[src]

type Target = GfsFile

The resulting type after dereferencing.

impl Debug for File[src]

impl Write for File[src]

impl Read for File[src]

Auto Trait Implementations

impl Unpin for File

impl Sync for File

impl Send for File

impl !UnwindSafe for File

impl !RefUnwindSafe for File

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<R> ReadBytesExt for R where
    R: Read + ?Sized
[src]

impl<W> WriteBytesExt for W where
    W: Write + ?Sized
[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self