Skip to main content

GeneratedService

Struct GeneratedService 

Source
pub struct GeneratedService { /* private fields */ }
Expand description

A typed generated Compose service definition.

Implementations§

Source§

impl GeneratedService

Source

pub fn new(name: impl Into<String>) -> Result<Self, GenerationError>

Creates an empty service with a validated name.

§Errors

Rejects an empty or NUL-bearing name.

Source

pub fn name(&self) -> &str

Returns the service name.

Source

pub fn set_image( &mut self, image: GeneratedString, ) -> Result<(), GenerationError>

Sets the service image exactly once.

§Errors

Returns GenerationError::EmptyValue for an empty image or GenerationError::DuplicateField when already configured.

Source

pub fn set_command( &mut self, command: GeneratedCommand, ) -> Result<(), GenerationError>

Sets the Compose command form exactly once.

§Errors

Returns GenerationError::DuplicateField when already configured.

Source

pub fn add_environment(&mut self, environment: GeneratedEnvironment)

Adds one ordered environment entry.

Source

pub fn add_label( &mut self, label: GeneratedLabel, ) -> Result<(), GenerationError>

Adds one uniquely named service metadata label.

§Errors

Returns GenerationError::DuplicateName when the service already defines the label.

Source

pub fn set_user(&mut self, user: GeneratedString) -> Result<(), GenerationError>

Sets the combined Compose user[:group] value exactly once.

§Errors

Returns GenerationError::DuplicateField when already configured.

Source

pub fn set_userns_mode( &mut self, mode: GeneratedString, ) -> Result<(), GenerationError>

Sets the user-namespace mode exactly once.

§Errors

Returns GenerationError::EmptyValue for an empty mode or GenerationError::DuplicateField when already configured.

Source

pub fn add_supplementary_group( &mut self, group: GeneratedString, ) -> Result<(), GenerationError>

Adds one ordered supplementary group.

§Errors

Returns GenerationError::EmptyValue for an empty group.

Source

pub fn set_working_dir( &mut self, directory: GeneratedString, ) -> Result<(), GenerationError>

Sets the container working directory exactly once.

§Errors

Returns GenerationError::EmptyValue for an empty directory or GenerationError::DuplicateField when already configured.

Source

pub fn set_read_only(&mut self, read_only: bool) -> Result<(), GenerationError>

Sets the read-only-root choice exactly once.

§Errors

Returns GenerationError::DuplicateField when already configured.

Source

pub fn add_extra_host(&mut self, host: GeneratedExtraHost)

Adds one ordered host mapping.

Source

pub fn add_port(&mut self, port: GeneratedPort)

Adds one ordered published-port declaration.

Source

pub fn add_mount(&mut self, mount: GeneratedMount)

Adds one ordered mount.

Source

pub fn add_network( &mut self, network: GeneratedNetworkAttachment, ) -> Result<(), GenerationError>

Adds one uniquely named network attachment.

§Errors

Returns GenerationError::DuplicateName when the service already uses the network.

Trait Implementations§

Source§

impl Clone for GeneratedService

Source§

fn clone(&self) -> GeneratedService

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GeneratedService

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for GeneratedService

Source§

impl PartialEq for GeneratedService

Source§

fn eq(&self, other: &GeneratedService) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GeneratedService

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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