Directory

Struct Directory 

Source
pub struct Directory {
    pub proc: Option<Arc<DaggerSessionProc>>,
    pub selection: Selection,
    pub graphql_client: DynGraphQLClient,
}

Fields§

§proc: Option<Arc<DaggerSessionProc>>§selection: Selection§graphql_client: DynGraphQLClient

Implementations§

Source§

impl Directory

Source

pub fn as_git(&self) -> GitRepository

Converts this directory to a local git repository

Source

pub fn as_module(&self) -> Module

Load the directory as a Dagger module source

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn as_module_opts<'a>(&self, opts: DirectoryAsModuleOpts<'a>) -> Module

Load the directory as a Dagger module source

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn as_module_source(&self) -> ModuleSource

Load the directory as a Dagger module source

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn as_module_source_opts<'a>( &self, opts: DirectoryAsModuleSourceOpts<'a>, ) -> ModuleSource

Load the directory as a Dagger module source

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn diff(&self, other: impl IntoID<DirectoryId>) -> Directory

Return the difference between this directory and an another directory. The difference is encoded as a directory.

§Arguments
  • other - The directory to compare against
Source

pub async fn digest(&self) -> Result<String, DaggerError>

Return the directory’s digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.

Source

pub fn directory(&self, path: impl Into<String>) -> Directory

Retrieves a directory at the given path.

§Arguments
  • path - Location of the directory to retrieve. Example: “/src”
Source

pub fn docker_build(&self) -> Container

Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn docker_build_opts<'a>( &self, opts: DirectoryDockerBuildOpts<'a>, ) -> Container

Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn entries(&self) -> Result<Vec<String>, DaggerError>

Returns a list of files and directories at the given path.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn entries_opts<'a>( &self, opts: DirectoryEntriesOpts<'a>, ) -> Result<Vec<String>, DaggerError>

Returns a list of files and directories at the given path.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn exists(&self, path: impl Into<String>) -> Result<bool, DaggerError>

check if a file or directory exists

§Arguments
  • path - Path to check (e.g., “/file.txt”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn exists_opts( &self, path: impl Into<String>, opts: DirectoryExistsOpts, ) -> Result<bool, DaggerError>

check if a file or directory exists

§Arguments
  • path - Path to check (e.g., “/file.txt”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn export( &self, path: impl Into<String>, ) -> Result<String, DaggerError>

Writes the contents of the directory to a path on the host.

§Arguments
  • path - Location of the copied directory (e.g., “logs/”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn export_opts( &self, path: impl Into<String>, opts: DirectoryExportOpts, ) -> Result<String, DaggerError>

Writes the contents of the directory to a path on the host.

§Arguments
  • path - Location of the copied directory (e.g., “logs/”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn file(&self, path: impl Into<String>) -> File

Retrieve a file at the given path.

§Arguments
  • path - Location of the file to retrieve (e.g., “README.md”).
Source

pub fn filter(&self) -> Directory

Return a snapshot with some paths included or excluded

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn filter_opts<'a>(&self, opts: DirectoryFilterOpts<'a>) -> Directory

Return a snapshot with some paths included or excluded

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn glob( &self, pattern: impl Into<String>, ) -> Result<Vec<String>, DaggerError>

Returns a list of files and directories that matche the given pattern.

§Arguments
  • pattern - Pattern to match (e.g., “*.md”).
Source

pub async fn id(&self) -> Result<DirectoryId, DaggerError>

A unique identifier for this Directory.

Source

pub async fn name(&self) -> Result<String, DaggerError>

Returns the name of the directory.

Source

pub fn search(&self, pattern: impl Into<String>) -> Vec<SearchResult>

Searches for content matching the given regular expression or literal string. Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.

§Arguments
  • pattern - The text to match.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn search_opts<'a>( &self, pattern: impl Into<String>, opts: DirectorySearchOpts<'a>, ) -> Vec<SearchResult>

Searches for content matching the given regular expression or literal string. Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.

§Arguments
  • pattern - The text to match.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn sync(&self) -> Result<DirectoryId, DaggerError>

Force evaluation in the engine.

Source

pub fn terminal(&self) -> Directory

Opens an interactive terminal in new container with this directory mounted inside.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn terminal_opts<'a>(&self, opts: DirectoryTerminalOpts<'a>) -> Directory

Opens an interactive terminal in new container with this directory mounted inside.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_directory( &self, path: impl Into<String>, directory: impl IntoID<DirectoryId>, ) -> Directory

Return a snapshot with a directory added

§Arguments
  • path - Location of the written directory (e.g., “/src/”).
  • directory - Identifier of the directory to copy.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_directory_opts<'a>( &self, path: impl Into<String>, directory: impl IntoID<DirectoryId>, opts: DirectoryWithDirectoryOpts<'a>, ) -> Directory

Return a snapshot with a directory added

§Arguments
  • path - Location of the written directory (e.g., “/src/”).
  • directory - Identifier of the directory to copy.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_file( &self, path: impl Into<String>, source: impl IntoID<FileId>, ) -> Directory

Retrieves this directory plus the contents of the given file copied to the given path.

§Arguments
  • path - Location of the copied file (e.g., “/file.txt”).
  • source - Identifier of the file to copy.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_file_opts( &self, path: impl Into<String>, source: impl IntoID<FileId>, opts: DirectoryWithFileOpts, ) -> Directory

Retrieves this directory plus the contents of the given file copied to the given path.

§Arguments
  • path - Location of the copied file (e.g., “/file.txt”).
  • source - Identifier of the file to copy.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_files( &self, path: impl Into<String>, sources: Vec<FileId>, ) -> Directory

Retrieves this directory plus the contents of the given files copied to the given path.

§Arguments
  • path - Location where copied files should be placed (e.g., “/src”).
  • sources - Identifiers of the files to copy.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_files_opts( &self, path: impl Into<String>, sources: Vec<FileId>, opts: DirectoryWithFilesOpts, ) -> Directory

Retrieves this directory plus the contents of the given files copied to the given path.

§Arguments
  • path - Location where copied files should be placed (e.g., “/src”).
  • sources - Identifiers of the files to copy.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_new_directory(&self, path: impl Into<String>) -> Directory

Retrieves this directory plus a new directory created at the given path.

§Arguments
  • path - Location of the directory created (e.g., “/logs”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_new_directory_opts( &self, path: impl Into<String>, opts: DirectoryWithNewDirectoryOpts, ) -> Directory

Retrieves this directory plus a new directory created at the given path.

§Arguments
  • path - Location of the directory created (e.g., “/logs”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_new_file( &self, path: impl Into<String>, contents: impl Into<String>, ) -> Directory

Return a snapshot with a new file added

§Arguments
  • path - Path of the new file. Example: “foo/bar.txt”
  • contents - Contents of the new file. Example: “Hello world!”
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_new_file_opts( &self, path: impl Into<String>, contents: impl Into<String>, opts: DirectoryWithNewFileOpts, ) -> Directory

Return a snapshot with a new file added

§Arguments
  • path - Path of the new file. Example: “foo/bar.txt”
  • contents - Contents of the new file. Example: “Hello world!”
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_patch(&self, patch: impl Into<String>) -> Directory

Retrieves this directory with the given Git-compatible patch applied.

§Arguments
  • patch - Patch to apply (e.g., “diff –git a/file.txt b/file.txt\nindex 1234567..abcdef8 100644\n— a/file.txt\n+++ b/file.txt\n@@ -1,1 +1,1 @@\n-Hello\n+World\n”).

Return a snapshot with a symlink

§Arguments
  • target - Location of the file or directory to link to (e.g., “/existing/file”).
  • link_name - Location where the symbolic link will be created (e.g., “/new-file-link”).
Source

pub fn with_timestamps(&self, timestamp: isize) -> Directory

Retrieves this directory with all file/dir timestamps set to the given time.

§Arguments
  • timestamp - Timestamp to set dir/files in.

Formatted in seconds following Unix epoch (e.g., 1672531199).

Source

pub fn without_directory(&self, path: impl Into<String>) -> Directory

Return a snapshot with a subdirectory removed

§Arguments
  • path - Path of the subdirectory to remove. Example: “.github/workflows”
Source

pub fn without_file(&self, path: impl Into<String>) -> Directory

Return a snapshot with a file removed

§Arguments
  • path - Path of the file to remove (e.g., “/file.txt”).
Source

pub fn without_files(&self, paths: Vec<impl Into<String>>) -> Directory

Return a snapshot with files removed

§Arguments
  • paths - Paths of the files to remove (e.g., [“/file.txt”]).

Trait Implementations§

Source§

impl Clone for Directory

Source§

fn clone(&self) -> Directory

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl IntoID<DirectoryId> for Directory

Source§

fn into_id( self, ) -> Pin<Box<dyn Future<Output = Result<DirectoryId, DaggerError>> + Send>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,