Struct dagger_sdk::TypeDef
source · pub struct TypeDef {
pub proc: Option<Arc<Child>>,
pub selection: Selection,
pub graphql_client: DynGraphQLClient,
}Fields§
§proc: Option<Arc<Child>>§selection: Selection§graphql_client: DynGraphQLClientImplementations§
source§impl TypeDef
impl TypeDef
sourcepub fn as_list(&self) -> ListTypeDef
pub fn as_list(&self) -> ListTypeDef
If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null.
sourcepub fn as_object(&self) -> ObjectTypeDef
pub fn as_object(&self) -> ObjectTypeDef
If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null.
pub async fn id(&self) -> Result<TypeDefId, DaggerError>
sourcepub async fn kind(&self) -> Result<TypeDefKind, DaggerError>
pub async fn kind(&self) -> Result<TypeDefKind, DaggerError>
The kind of type this is (e.g. primitive, list, object)
sourcepub async fn optional(&self) -> Result<bool, DaggerError>
pub async fn optional(&self) -> Result<bool, DaggerError>
Whether this type can be set to null. Defaults to false.
sourcepub fn with_field(&self, name: impl Into<String>, type_def: TypeDef) -> TypeDef
pub fn with_field(&self, name: impl Into<String>, type_def: TypeDef) -> TypeDef
Adds a static field for an Object TypeDef, failing if the type is not an object.
Arguments
name- The name of the field in the objecttype_def- The type of the fieldopt- optional argument, see inner type for documentation, use_opts to use
sourcepub fn with_field_opts<'a>(
&self,
name: impl Into<String>,
type_def: TypeDef,
opts: TypeDefWithFieldOpts<'a>
) -> TypeDef
pub fn with_field_opts<'a>( &self, name: impl Into<String>, type_def: TypeDef, opts: TypeDefWithFieldOpts<'a> ) -> TypeDef
Adds a static field for an Object TypeDef, failing if the type is not an object.
Arguments
name- The name of the field in the objecttype_def- The type of the fieldopt- optional argument, see inner type for documentation, use_opts to use
sourcepub fn with_function(&self, function: Function) -> TypeDef
pub fn with_function(&self, function: Function) -> TypeDef
Adds a function for an Object TypeDef, failing if the type is not an object.
sourcepub fn with_kind(&self, kind: TypeDefKind) -> TypeDef
pub fn with_kind(&self, kind: TypeDefKind) -> TypeDef
Sets the kind of the type.
sourcepub fn with_list_of(&self, element_type: TypeDef) -> TypeDef
pub fn with_list_of(&self, element_type: TypeDef) -> TypeDef
Returns a TypeDef of kind List with the provided type for its elements.
sourcepub fn with_object(&self, name: impl Into<String>) -> TypeDef
pub fn with_object(&self, name: impl Into<String>) -> TypeDef
Returns a TypeDef of kind Object with the provided name. Note that an object’s fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference.
Arguments
opt- optional argument, see inner type for documentation, use_opts to use
sourcepub fn with_object_opts<'a>(
&self,
name: impl Into<String>,
opts: TypeDefWithObjectOpts<'a>
) -> TypeDef
pub fn with_object_opts<'a>( &self, name: impl Into<String>, opts: TypeDefWithObjectOpts<'a> ) -> TypeDef
Returns a TypeDef of kind Object with the provided name. Note that an object’s fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference.
Arguments
opt- optional argument, see inner type for documentation, use_opts to use
sourcepub fn with_optional(&self, optional: bool) -> TypeDef
pub fn with_optional(&self, optional: bool) -> TypeDef
Sets whether this type can be set to null.