From 9677304ff4121579445d8d2e99b8dc69376afb37 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Tue, 14 Mar 2023 22:01:49 +0100 Subject: [PATCH] chore: fmt --- crates/dagger-sdk/src/gen.rs | 1407 +++++++++++++--------------------- 1 file changed, 523 insertions(+), 884 deletions(-) diff --git a/crates/dagger-sdk/src/gen.rs b/crates/dagger-sdk/src/gen.rs index 696ffe7..e24be01 100644 --- a/crates/dagger-sdk/src/gen.rs +++ b/crates/dagger-sdk/src/gen.rs @@ -122,10 +122,8 @@ pub struct CacheVolume { } impl CacheVolume { - pub async fn id( - &self, - ) -> eyre::Result { - let mut query = self.selection.select("id"); + pub async fn id(&self) -> eyre::Result { + let query = self.selection.select("id"); query.execute(&graphql_client(&self.conn)).await } @@ -139,7 +137,6 @@ pub struct Container { #[derive(Builder, Debug, PartialEq)] pub struct ContainerBuildOpts<'a> { - /// Path to the Dockerfile to use. /// Default: './Dockerfile'. #[builder(setter(into, strip_option), default)] @@ -153,7 +150,6 @@ pub struct ContainerBuildOpts<'a> { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerEndpointOpts<'a> { - /// The exposed port number for the endpoint #[builder(setter(into, strip_option), default)] pub port: Option, @@ -163,7 +159,6 @@ pub struct ContainerEndpointOpts<'a> { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerExecOpts<'a> { - /// Command to run instead of the container's default command (e.g., ["run", "main.go"]). #[builder(setter(into, strip_option), default)] pub args: Option>, @@ -184,7 +179,6 @@ pub struct ContainerExecOpts<'a> { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerExportOpts { - /// Identifiers for other platform specific containers. /// Used for multi-platform image. #[builder(setter(into, strip_option), default)] @@ -192,7 +186,6 @@ pub struct ContainerExportOpts { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerPipelineOpts<'a> { - /// Pipeline description. #[builder(setter(into, strip_option), default)] pub description: Option<&'a str>, @@ -202,7 +195,6 @@ pub struct ContainerPipelineOpts<'a> { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerPublishOpts { - /// Identifiers for other platform specific containers. /// Used for multi-platform image. #[builder(setter(into, strip_option), default)] @@ -210,14 +202,12 @@ pub struct ContainerPublishOpts { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerWithDefaultArgsOpts<'a> { - /// Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]). #[builder(setter(into, strip_option), default)] pub args: Option>, } #[derive(Builder, Debug, PartialEq)] pub struct ContainerWithDirectoryOpts<'a> { - /// Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]). #[builder(setter(into, strip_option), default)] pub exclude: Option>, @@ -227,7 +217,6 @@ pub struct ContainerWithDirectoryOpts<'a> { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerWithExecOpts<'a> { - /// Content to write to the command's standard input before closing (e.g., "Hello world"). #[builder(setter(into, strip_option), default)] pub stdin: Option<&'a str>, @@ -251,7 +240,6 @@ pub struct ContainerWithExecOpts<'a> { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerWithExposedPortOpts<'a> { - /// Transport layer network protocol #[builder(setter(into, strip_option), default)] pub protocol: Option, @@ -261,7 +249,6 @@ pub struct ContainerWithExposedPortOpts<'a> { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerWithFileOpts { - /// Permission given to the copied file (e.g., 0600). /// Default: 0644. #[builder(setter(into, strip_option), default)] @@ -269,7 +256,6 @@ pub struct ContainerWithFileOpts { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerWithMountedCacheOpts { - /// Identifier of the directory to use as the cache volume's root. #[builder(setter(into, strip_option), default)] pub source: Option, @@ -279,7 +265,6 @@ pub struct ContainerWithMountedCacheOpts { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerWithNewFileOpts<'a> { - /// Content of the file to write (e.g., "Hello world!"). #[builder(setter(into, strip_option), default)] pub contents: Option<&'a str>, @@ -290,7 +275,6 @@ pub struct ContainerWithNewFileOpts<'a> { } #[derive(Builder, Debug, PartialEq)] pub struct ContainerWithoutExposedPortOpts { - /// Port protocol to unexpose #[builder(setter(into, strip_option), default)] pub protocol: Option, @@ -298,15 +282,12 @@ pub struct ContainerWithoutExposedPortOpts { impl Container { /// Initializes this container from a Dockerfile build. - /// + /// /// # Arguments - /// + /// /// * `context` - Directory context used by the Dockerfile. /// * `opt` - optional argument, see inner type for documentation, use _opts to use - pub fn build( - &self, - context: DirectoryId, - ) -> Container { + pub fn build(&self, context: DirectoryId) -> Container { let mut query = self.selection.select("build"); query = query.arg("context", context); @@ -315,20 +296,16 @@ impl Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - } + }; } /// Initializes this container from a Dockerfile build. - /// + /// /// # Arguments - /// + /// /// * `context` - Directory context used by the Dockerfile. /// * `opt` - optional argument, see inner type for documentation, use _opts to use - pub fn build_opts<'a>( - &self, - context: DirectoryId, - opts: ContainerBuildOpts<'a> - ) -> Container { + pub fn build_opts<'a>(&self, context: DirectoryId, opts: ContainerBuildOpts<'a>) -> Container { let mut query = self.selection.select("build"); query = query.arg("context", context); @@ -346,26 +323,21 @@ impl Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - } + }; } /// Retrieves default arguments for future commands. - pub async fn default_args( - &self, - ) -> eyre::Result> { - let mut query = self.selection.select("defaultArgs"); + pub async fn default_args(&self) -> eyre::Result> { + let query = self.selection.select("defaultArgs"); query.execute(&graphql_client(&self.conn)).await } /// Retrieves a directory at the given path. /// Mounts are included. - /// + /// /// # Arguments - /// + /// /// * `path` - The path of the directory to retrieve (e.g., "./src"). - pub fn directory( - &self, - path: impl Into, - ) -> Directory { + pub fn directory(&self, path: impl Into) -> Directory { let mut query = self.selection.select("directory"); query = query.arg("path", path.into()); @@ -374,20 +346,18 @@ impl Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - } + }; } /// Retrieves an endpoint that clients can use to reach this container. /// If no port is specified, the first exposed port is used. If none exist an error is returned. /// If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned. /// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable. - /// + /// /// # Arguments - /// + /// /// * `opt` - optional argument, see inner type for documentation, use _opts to use - pub async fn endpoint( - &self, - ) -> eyre::Result { - let mut query = self.selection.select("endpoint"); + pub async fn endpoint(&self) -> eyre::Result { + let query = self.selection.select("endpoint"); query.execute(&graphql_client(&self.conn)).await } @@ -396,14 +366,11 @@ impl Container { /// If no port is specified, the first exposed port is used. If none exist an error is returned. /// If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned. /// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable. - /// + /// /// # Arguments - /// + /// /// * `opt` - optional argument, see inner type for documentation, use _opts to use - pub async fn endpoint_opts<'a>( - &self, - opts: ContainerEndpointOpts<'a> - ) -> eyre::Result { + pub async fn endpoint_opts<'a>(&self, opts: ContainerEndpointOpts<'a>) -> eyre::Result { let mut query = self.selection.select("endpoint"); if let Some(port) = opts.port { @@ -416,22 +383,17 @@ impl Container { query.execute(&graphql_client(&self.conn)).await } /// Retrieves entrypoint to be prepended to the arguments of all commands. - pub async fn entrypoint( - &self, - ) -> eyre::Result> { - let mut query = self.selection.select("entrypoint"); + pub async fn entrypoint(&self) -> eyre::Result> { + let query = self.selection.select("entrypoint"); query.execute(&graphql_client(&self.conn)).await } /// Retrieves the value of the specified environment variable. - /// + /// /// # Arguments - /// + /// /// * `name` - The name of the environment variable to retrieve (e.g., "PATH"). - pub async fn env_variable( - &self, - name: impl Into, - ) -> eyre::Result { + pub async fn env_variable(&self, name: impl Into) -> eyre::Result { let mut query = self.selection.select("envVariable"); query = query.arg("name", name.into()); @@ -439,43 +401,36 @@ impl Container { query.execute(&graphql_client(&self.conn)).await } /// Retrieves the list of environment variables passed to commands. - pub fn env_variables( - &self, - ) -> Vec { - let mut query = self.selection.select("envVariables"); + pub fn env_variables(&self) -> Vec { + let query = self.selection.select("envVariables"); return vec![EnvVariable { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - }] + }]; } /// Retrieves this container after executing the specified command inside it. - /// + /// /// # Arguments - /// + /// /// * `opt` - optional argument, see inner type for documentation, use _opts to use - pub fn exec( - &self, - ) -> Container { - let mut query = self.selection.select("exec"); + pub fn exec(&self) -> Container { + let query = self.selection.select("exec"); return Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - } + }; } /// Retrieves this container after executing the specified command inside it. - /// + /// /// # Arguments - /// + /// /// * `opt` - optional argument, see inner type for documentation, use _opts to use - pub fn exec_opts<'a>( - &self, - opts: ContainerExecOpts<'a> - ) -> Container { + pub fn exec_opts<'a>(&self, opts: ContainerExecOpts<'a>) -> Container { let mut query = self.selection.select("exec"); if let Some(args) = opts.args { @@ -491,37 +446,35 @@ impl Container { query = query.arg("redirectStderr", redirect_stderr); } if let Some(experimental_privileged_nesting) = opts.experimental_privileged_nesting { - query = query.arg("experimentalPrivilegedNesting", experimental_privileged_nesting); + query = query.arg( + "experimentalPrivilegedNesting", + experimental_privileged_nesting, + ); } return Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - } + }; } /// Exit code of the last executed command. Zero means success. /// Errors if no command has been executed. - pub async fn exit_code( - &self, - ) -> eyre::Result { - let mut query = self.selection.select("exitCode"); + pub async fn exit_code(&self) -> eyre::Result { + let query = self.selection.select("exitCode"); query.execute(&graphql_client(&self.conn)).await } /// Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants. /// Return true on success. /// It can also publishes platform variants. - /// + /// /// # Arguments - /// + /// /// * `path` - Host's destination path (e.g., "./tarball"). /// Path can be relative to the engine's workdir or absolute. /// * `opt` - optional argument, see inner type for documentation, use _opts to use - pub async fn export( - &self, - path: impl Into, - ) -> eyre::Result { + pub async fn export(&self, path: impl Into) -> eyre::Result { let mut query = self.selection.select("export"); query = query.arg("path", path.into()); @@ -532,16 +485,16 @@ impl Container { /// Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants. /// Return true on success. /// It can also publishes platform variants. - /// + /// /// # Arguments - /// + /// /// * `path` - Host's destination path (e.g., "./tarball"). /// Path can be relative to the engine's workdir or absolute. /// * `opt` - optional argument, see inner type for documentation, use _opts to use pub async fn export_opts( &self, path: impl Into, - opts: ContainerExportOpts + opts: ContainerExportOpts, ) -> eyre::Result { let mut query = self.selection.select("export"); @@ -554,27 +507,22 @@ impl Container { } /// Retrieves the list of exposed ports. /// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable. - pub fn exposed_ports( - &self, - ) -> Vec { - let mut query = self.selection.select("exposedPorts"); + pub fn exposed_ports(&self) -> Vec { + let query = self.selection.select("exposedPorts"); return vec![Port { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - }] + }]; } /// Retrieves a file at the given path. /// Mounts are included. - /// + /// /// # Arguments - /// + /// /// * `path` - The path of the file to retrieve (e.g., "./README.md"). - pub fn file( - &self, - path: impl Into, - ) -> File { + pub fn file(&self, path: impl Into) -> File { let mut query = self.selection.select("file"); query = query.arg("path", path.into()); @@ -583,19 +531,16 @@ impl Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - } + }; } /// Initializes this container from a pulled base image. - /// + /// /// # Arguments - /// + /// /// * `address` - Image's address from its registry. - /// + /// /// Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main"). - pub fn from( - &self, - address: impl Into, - ) -> Container { + pub fn from(&self, address: impl Into) -> Container { let mut query = self.selection.select("from"); query = query.arg("address", address.into()); @@ -604,50 +549,39 @@ impl Container { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - } + }; } /// Retrieves this container's root filesystem. Mounts are not included. - pub fn fs( - &self, - ) -> Directory { - let mut query = self.selection.select("fs"); + pub fn fs(&self) -> Directory { + let query = self.selection.select("fs"); return Directory { proc: self.proc.clone(), selection: query, conn: self.conn.clone(), - } + }; } /// Retrieves a hostname which can be used by clients to reach this container. /// Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable. - pub async fn hostname( - &self, - ) -> eyre::Result { - let mut query = self.selection.select("hostname"); + pub async fn hostname(&self) -> eyre::Result { + let query = self.selection.select("hostname"); query.execute(&graphql_client(&self.conn)).await } /// A unique identifier for this container. - pub async fn id( - &self, - ) -> eyre::Result { - let mut query = self.selection.select("id"); + pub async fn id(&self) -> eyre::Result { + let query = self.selection.select("id"); query.execute(&graphql_client(&self.conn)).await } /// The unique image reference which can only be retrieved immediately after the 'Container.From' call. - pub async fn image_ref( - &self, - ) -> eyre::Result { - let mut query = self.selection.select("imageRef"); + pub async fn image_ref(&self) -> eyre::Result { + let query = self.selection.select("imageRef"); query.execute(&graphql_client(&self.conn)).await } /// Retrieves the value of the specified label. - pub async fn label( - &self, - name: impl Into, - ) -> eyre::Result { + pub async fn label(&self, name: impl Into) -> eyre::Result { let mut query = self.selection.select("label"); query = query.arg("name", name.into()); @@ -655,35 +589,28 @@ impl Container { query.execute(&graphql_client(&self.conn)).await } /// Retrieves the list of labels passed to container. - pub fn labels( - &self, - ) -> Vec