Struct il2_iltags::io::array::BorrowedVecWriter [−][src]
pub struct BorrowedVecWriter<'a> { /* fields omitted */ }
Expand description
BorrowedVecWriter
implements a Writer
that uses a borrowed Vec
The borrowed vector is used as is. This means that:
- Any existing data will be overwritten from the initial offset;
- The vector will be extended if required but will never shrink to accomodate the amount of data written;
Implementations
Creates a new instance of this struct. The new struct is set as writeable by default.
Arguments:
vector
: The inner vector;
Creates a new instance of this struct. The new struct is set as writeable by default.
Arguments:
vector
: The inner vector;offset
: The initial offset. If it is set to a value larger than vector length, it will assume the vector length;
Returns the current writing position.
Returns:
- The current offset. It is guaranteed to be at most the total size of the data.
Sets the current writing position.
Arguments:
offset
: The new position. It if is larger than the total length, it will assume the total length;
Returns true if this instance is locked for writing.
Sets the read-only flag.
Arguments:
read_only
: The new value;
Verifies if the it is possible to write into this
VecWriter
.
Returns:
Ok(())
: If it is possible to write;Err(ErrorKind::UnableToWriteData)
: If it is not possible to write;
Returns the number of bytes actually written.
Trait Implementations
Writes a byte slice. As this default implementation
calls write()
multiple times, so it is strongly recommended
that each implementation provides a more efficient version for
this method if possible. Read more