#[repr(transparent)]pub struct File(_);
Expand description
Wraps the kernel’s struct file
.
Invariants
Instances of this type are always ref-counted, that is, a call to get_file
ensures that the
allocation remains valid at least until the matching call to fput
.
Implementations
sourceimpl File
impl File
sourcepub fn from_fd(fd: u32) -> Result<ARef<Self>>
pub fn from_fd(fd: u32) -> Result<ARef<Self>>
Constructs a new [struct file
] wrapper from a file descriptor.
The file descriptor belongs to the current process.
sourcepub fn pos(&self) -> u64
pub fn pos(&self) -> u64
Returns the current seek/cursor/pointer position (struct file::f_pos
).
sourcepub fn cred(&self) -> &Credential
pub fn cred(&self) -> &Credential
Returns the credentials of the task that originally opened the file.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for File
impl !Send for File
impl !Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more