pub struct OperationBuilder {
pub name: Option<OperationName>,
pub http_method: Option<OperationHttpMethod>,
pub http_path: Option<OperationHttpPath>,
}Expand description
Builder struct used to gradually build an Operation instance.
Fields§
§name: Option<OperationName>§http_method: Option<OperationHttpMethod>§http_path: Option<OperationHttpPath>Implementations§
Source§impl OperationBuilder
impl OperationBuilder
Sourcepub fn with_operation_name(self, operation_name: OperationName) -> Self
pub fn with_operation_name(self, operation_name: OperationName) -> Self
Sets the operation name in the builder.
This method allows you to set the name field of the Operation object that will
be constructed. The operation name typically corresponds to the action or API endpoint
(e.g., “GetUser”, “CreateUser”).
§Arguments
operation_name- The name of the operation (e.g., “GetUser”).
§Returns
The builder with the updated operation name.
Sourcepub fn with_operation_http_method(
self,
operation_http_method: OperationHttpMethod,
) -> Self
pub fn with_operation_http_method( self, operation_http_method: OperationHttpMethod, ) -> Self
Sets the HTTP method in the builder.
This method allows you to set the http_method field of the Operation object that will
be constructed. The HTTP method determines whether the request will use GET, POST, PUT, etc.
§Arguments
operation_http_method- The HTTP method for the operation (e.g., GET, POST).
§Returns
The builder with the updated HTTP method.
Sourcepub fn with_operation_http_path(
self,
operation_http_path: OperationHttpPath,
) -> Self
pub fn with_operation_http_path( self, operation_http_path: OperationHttpPath, ) -> Self
Sets the HTTP path in the builder.
This method allows you to set the http_path field of the Operation object that will
be constructed. The HTTP path defines the specific API endpoint or route for the operation
(e.g., “/user”, “/product”).
§Arguments
operation_http_path- The HTTP path for the operation (e.g., “/user”).
§Returns
The builder with the updated HTTP path.
Sourcepub fn build(self) -> Result<Operation, Error>
pub fn build(self) -> Result<Operation, Error>
Finalizes the builder and creates an Operation instance.
This method validates the required fields and constructs the Operation object.
If any required fields are missing, it returns an error. Otherwise, it returns the
fully constructed Operation.
§Returns
Ok(Operation)- A fully constructedOperationif all fields are provided.Err(Error)- An error if any required fields are missing.
Auto Trait Implementations§
impl Freeze for OperationBuilder
impl RefUnwindSafe for OperationBuilder
impl Send for OperationBuilder
impl Sync for OperationBuilder
impl Unpin for OperationBuilder
impl UnwindSafe for OperationBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request