[][src]Struct devbox_build::File

pub struct File { /* fields omitted */ }

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.

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.

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.

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.

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.

impl<'_, '_> Add<&'_ File> for &'_ File[src]

type Output = Set<File>

The resulting type after applying the + operator.

impl<'_, '_> Add<&'_ File> for &'_ Dir[src]

type Output = Set<Unit>

The resulting type after applying the + operator.

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]

impl Ord for File[src]

impl PartialEq<File> for File[src]

impl PartialOrd<File> for File[src]

impl Resource for File[src]

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]

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.