Struct dagger_sdk::Function

source ·
pub struct Function {
    pub proc: Option<Arc<Child>>,
    pub selection: Selection,
    pub graphql_client: DynGraphQLClient,
}

Fields§

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

Implementations§

source§

impl Function

source

pub fn args(&self) -> Vec<FunctionArg>

Arguments accepted by this function, if any

source

pub async fn call(&self) -> Result<Json, DaggerError>

Execute this function using dynamic input+output types. Typically, it’s preferable to invoke a function using a type safe graphql query rather than using this call field. However, call is useful for some advanced use cases where dynamically loading arbitrary modules and invoking functions in them is required.

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

pub async fn call_opts( &self, opts: FunctionCallOpts ) -> Result<Json, DaggerError>

Execute this function using dynamic input+output types. Typically, it’s preferable to invoke a function using a type safe graphql query rather than using this call field. However, call is useful for some advanced use cases where dynamically loading arbitrary modules and invoking functions in them is required.

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

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

A doc string for the function, if any

source

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

The ID of the function

source

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

The name of the function

source

pub fn return_type(&self) -> TypeDef

The type returned by this function

source

pub fn with_arg(&self, name: impl Into<String>, type_def: TypeDef) -> Function

Returns the function with the provided argument

Arguments
  • name - The name of the argument
  • type_def - The type of the argument
  • opt - optional argument, see inner type for documentation, use _opts to use
source

pub fn with_arg_opts<'a>( &self, name: impl Into<String>, type_def: TypeDef, opts: FunctionWithArgOpts<'a> ) -> Function

Returns the function with the provided argument

Arguments
  • name - The name of the argument
  • type_def - The type of the argument
  • opt - optional argument, see inner type for documentation, use _opts to use
source

pub fn with_description(&self, description: impl Into<String>) -> Function

Returns the function with the doc string

Trait Implementations§

source§

impl Clone for Function

source§

fn clone(&self) -> Function

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere 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 Twhere 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 Twhere 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