pub enum Position {
Start(u64),
Current(i64),
End(i64),
}
Expand description
Represents a position within a file for seek operations.
This enum provides three different ways to specify a position within a file:
- Absolute position from the beginning of the file
- Relative position from the current cursor location
- Relative position from the end of the file
§Examples
use file_system::Position_type;
// Seek to the beginning of the file
let start = Position_type::Start(0);
// Seek 100 bytes from the beginning
let absolute = Position_type::Start(100);
// Move 50 bytes forward from current position
let forward = Position_type::Current(50);
// Move 20 bytes backward from current position
let backward = Position_type::Current(-20);
// Seek to 10 bytes before the end of the file
let near_end = Position_type::End(-10);
Variants§
Start(u64)
Absolute position from the start of the file.
The value represents the number of bytes from the beginning of the file. A value of 0 positions at the very start of the file.
Current(i64)
Relative position from the current cursor location.
Positive values move forward, negative values move backward. A value of 0 keeps the current position unchanged.
End(i64)
Relative position from the end of the file.
Negative values position before the end, positive values would position beyond the end (which may extend the file if writing is performed). A value of 0 positions exactly at the end of the file.
Trait Implementations§
impl Copy for Position
impl Eq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more