Struct dagger_sdk::ModuleSource

source ·
pub struct ModuleSource {
    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 ModuleSource

source

pub fn as_git_source(&self) -> GitModuleSource

If the source is a of kind git, the git source representation of it.

source

pub fn as_local_source(&self) -> LocalModuleSource

If the source is of kind local, the local source representation of it.

source

pub fn as_module(&self) -> Module

Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation

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

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

Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation

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

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

A human readable ref string representation of this module source.

source

pub async fn config_exists(&self) -> Result<bool, DaggerError>

Returns whether the module source has a configuration file.

source

pub fn context_directory(&self) -> Directory

The directory containing everything needed to load load and use the module.

source

pub fn dependencies(&self) -> Vec<ModuleDependency>

The dependencies of the module source. Includes dependencies from the configuration and any extras from withDependencies calls.

source

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

The directory containing the module configuration and source code (source code may be in a subdir).

§Arguments
  • path - The path from the source directory to select.
source

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

A unique identifier for this ModuleSource.

source

pub async fn kind(&self) -> Result<ModuleSourceKind, DaggerError>

The kind of source (e.g. local, git, etc.)

source

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

If set, the name of the module this source references, including any overrides at runtime by callers.

source

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

The original name of the module this source references, as defined in the module configuration.

source

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

The path to the module source’s context directory on the caller’s filesystem. Only valid for local sources.

source

pub fn resolve_dependency( &self, dep: impl IntoID<ModuleSourceId>, ) -> ModuleSource

Resolve the provided module source arg as a dependency relative to this module source.

§Arguments
  • dep - The dependency module source to resolve.
source

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

Load a directory from the caller optionally with a given view applied.

§Arguments
  • path - The path on the caller’s filesystem to load.
  • opt - optional argument, see inner type for documentation, use _opts to use
source

pub fn resolve_directory_from_caller_opts<'a>( &self, path: impl Into<String>, opts: ModuleSourceResolveDirectoryFromCallerOpts<'a>, ) -> Directory

Load a directory from the caller optionally with a given view applied.

§Arguments
  • path - The path on the caller’s filesystem to load.
  • opt - optional argument, see inner type for documentation, use _opts to use
source

pub fn resolve_from_caller(&self) -> ModuleSource

Load the source from its path on the caller’s filesystem, including only needed+configured files and directories. Only valid for local sources.

source

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

The path relative to context of the root of the module source, which contains dagger.json. It also contains the module implementation source code, but that may or may not being a subdir of this root.

source

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

The path relative to context of the module implementation source code.

source

pub fn view(&self, name: impl Into<String>) -> ModuleSourceView

Retrieve a named view defined for this module source.

§Arguments
  • name - The name of the view to retrieve.
source

pub fn views(&self) -> Vec<ModuleSourceView>

The named views defined for this module source, which are sets of directory filters that can be applied to directory arguments provided to functions.

source

pub fn with_context_directory( &self, dir: impl IntoID<DirectoryId>, ) -> ModuleSource

Update the module source with a new context directory. Only valid for local sources.

§Arguments
  • dir - The directory to set as the context directory.
source

pub fn with_dependencies( &self, dependencies: Vec<ModuleDependencyId>, ) -> ModuleSource

Append the provided dependencies to the module source’s dependency list.

§Arguments
  • dependencies - The dependencies to append.
source

pub fn with_name(&self, name: impl Into<String>) -> ModuleSource

Update the module source with a new name.

§Arguments
  • name - The name to set.
source

pub fn with_sdk(&self, sdk: impl Into<String>) -> ModuleSource

Update the module source with a new SDK.

§Arguments
  • sdk - The SDK to set.
source

pub fn with_source_subpath(&self, path: impl Into<String>) -> ModuleSource

Update the module source with a new source subpath.

§Arguments
  • path - The path to set as the source subpath.
source

pub fn with_view( &self, name: impl Into<String>, patterns: Vec<impl Into<String>>, ) -> ModuleSource

Update the module source with a new named view.

§Arguments
  • name - The name of the view to set.
  • patterns - The patterns to set as the view filters.

Trait Implementations§

source§

impl Clone for ModuleSource

source§

fn clone(&self) -> ModuleSource

Returns a copy 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<ModuleSourceId> for ModuleSource

source§

fn into_id( self, ) -> Pin<Box<dyn Future<Output = Result<ModuleSourceId, 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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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