[−][src]Struct devbox_build::File
Resource representing file system file
Implementations
impl File
[src]
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, Box<dyn Error>>
[src]
Create new File pointing to absolute file system path
pub fn path(&self) -> &Path
[src]
Path reference to file system file
pub fn created(self) -> Self
[src]
Creates the file using create
and returns itself or stops the build with
informative error message.
pub fn create(&self) -> File
[src]
Creates the file using create_result
or stops the build with
informative error message.
pub fn create_result(&self) -> Result<File>
[src]
Creates (or truncates) the file and any missing directories on it's path in write only mode.
pub fn linked_from_inside(self, dir: &Dir) -> Self
[src]
Creating a link to this file from another directory with this file's name returning self or stopping the build with informative error message.
If the directory already contains an entry with this name, linking fails.
pub fn link_from_inside(&self, dir: &Dir)
[src]
Creating a link to this file from another directory with this file's name or stops the build with informative error message.
If the directory already contains an entry with this name, linking fails.
pub fn link_from_inside_result(&self, dir: &Dir, force: bool) -> Result<()>
[src]
Creating a link to this file from another directory with this file's name.
If the directory already contains a file or directory by this name, linking fails.
To allow overwriting existing link with different target set force
to true
or linking to
this file will also fail.
pub fn linked_to(self, to: &File) -> Self
[src]
Create a symbolic link at this file path to given target file to
creating any needed
directories in the process returning self or stops the build with informative error message.
If a file or directory by that name already exists, linking will fail.
pub fn link_to(&self, to: &File)
[src]
Create a symbolic link at this file path to given target file to
creating any needed
directories in the process or stops the build with informative error message.
If a file or directory by that name already exists, linking will fail.
pub fn link_to_result(&self, to: &File, force: bool) -> Result<()>
[src]
Create a symbolic link at this file path to given target file to
creating any needed
directories in the process.
If a file or directory by that name already exists, linking will fail.
To allow overwriting existing link to a different file set force
to true
or linking to
a different file will also fail.
pub fn metadata(&self) -> Metadata
[src]
Opens file's metadata using metadata_result
or stops the build
with informative error message.
pub fn metadata_result(&self) -> Result<Metadata>
[src]
Opens file metadata
pub fn open(&self) -> File
[src]
Opens the file using open_result
or stops the build with
informative error message
pub fn open_result(&self) -> Result<File>
[src]
Opens the file in read only mode
pub fn rewrite<P: AsRef<[u8]>>(&self, bytes: P)
[src]
Writes the entire content to the file using rewrite_result
or
stops the build with informative error message
pub fn rewrite_result<P: AsRef<[u8]>>(&self, bytes: P) -> Result<()>
[src]
Writes the entire content to the file creating it if needed. This is as shorthand for
create().write_all()
pub fn touched(self) -> Self
[src]
Touches the file using touch
and returns itself or stops the build with
informative error message
pub fn touch(&self)
[src]
Touches the file using touch
and returns itself or stops the build with
informative error message.
pub fn touch_result(&self) -> Result<()>
[src]
Touches the file by updating it's modification time or creating an empty one if it does not exists yet including any needed directories.
Trait Implementations
impl<'_, '_> Add<&'_ Dir> for &'_ File
[src]
type Output = Set<Unit>
The resulting type after applying the +
operator.
fn add(self, rhs: &Dir) -> Self::Output
[src]
impl<'_, '_> Add<&'_ File> for &'_ File
[src]
type Output = Set<File>
The resulting type after applying the +
operator.
fn add(self, rhs: &File) -> Self::Output
[src]
impl<'_, '_> Add<&'_ File> for &'_ Dir
[src]
type Output = Set<Unit>
The resulting type after applying the +
operator.
fn add(self, rhs: &File) -> Self::Output
[src]
impl AsRef<File> for File
[src]
impl AsRef<OsStr> for File
[src]
impl AsRef<Path> for File
[src]
impl Clone for File
[src]
impl Debug for File
[src]
impl Display for File
[src]
impl Eq for File
[src]
impl Hash for File
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for File
[src]
fn cmp(&self, other: &File) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<File> for File
[src]
impl PartialOrd<File> for File
[src]
fn partial_cmp(&self, other: &File) -> Option<Ordering>
[src]
fn lt(&self, other: &File) -> bool
[src]
fn le(&self, other: &File) -> bool
[src]
fn gt(&self, other: &File) -> bool
[src]
fn ge(&self, other: &File) -> bool
[src]
impl Resource for File
[src]
fn timestamp(&self) -> Option<SystemTime>
[src]
fn mk_from<F, R, S>(&self, description: &str, src: S, by: F) where
R: Resource,
S: AsResource<R>,
F: FnOnce(),
[src]
R: Resource,
S: AsResource<R>,
F: FnOnce(),
fn mk_from_result<E, F, R, S>(
&self,
description: &str,
src: S,
by: F
) -> Result<(), E> where
R: Resource,
S: AsRef<R>,
F: FnOnce() -> Result<(), E>,
[src]
&self,
description: &str,
src: S,
by: F
) -> Result<(), E> where
R: Resource,
S: AsRef<R>,
F: FnOnce() -> Result<(), E>,
impl StructuralEq for File
[src]
impl StructuralPartialEq for File
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,