VariableBuilder

Struct VariableBuilder 

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

Builder for Variable objects, used to simplify the creation of new instances.

§Example

use opsview::config::Variable;
use opsview::prelude::*;

let variable = Variable::builder()
  .name("MY_VARIABLE")
  .value("my_value")
  .build()
  .unwrap();

assert_eq!(variable.name, "MY_VARIABLE".to_string());
assert_eq!(variable.value, Some("my_value".to_string()));

Implementations§

Source§

impl VariableBuilder

Source

pub fn arg1(self, arg1: &str) -> Self

Sets the arg1 field.

§Arguments
  • arg1 - The arg1 field.
Source

pub fn arg2(self, arg2: &str) -> Self

Sets the arg2 field.

§Arguments
  • arg2 - The arg2 field.
Source

pub fn arg3(self, arg3: &str) -> Self

Sets the arg3 field.

§Arguments
  • arg3 - The arg3 field.
Source

pub fn arg4(self, arg4: &str) -> Self

Sets the arg4 field.

§Arguments
  • arg4 - The arg4 field.
Source

pub fn clear_arg1(self) -> Self

Clears the arg1 field.

Source

pub fn clear_arg2(self) -> Self

Clears the arg2 field.

Source

pub fn clear_arg3(self) -> Self

Clears the arg3 field.

Source

pub fn clear_arg4(self) -> Self

Clears the arg4 field.

Source

pub fn clear_label1(self) -> Self

Clears the label1 field.

Source

pub fn clear_label2(self) -> Self

Clears the label2 field.

Source

pub fn clear_label3(self) -> Self

Clears the label3 field.

Source

pub fn clear_label4(self) -> Self

Clears the label4 field.

Source

pub fn clear_name(self) -> Self

Clears the name field.

Source

pub fn clear_secured1(self) -> Self

Clears the secured1 field.

Source

pub fn clear_secured2(self) -> Self

Clears the secured2 field.

Source

pub fn clear_secured3(self) -> Self

Clears the secured3 field.

Source

pub fn clear_secured4(self) -> Self

Clears the secured4 field.

Source

pub fn clear_value(self) -> Self

Clears the value field.

Source

pub fn label1(self, label1: &str) -> Self

Sets the label1 field.

§Arguments
  • label1 - A label for arg1.
Source

pub fn label2(self, label2: &str) -> Self

Sets the label2 field.

§Arguments
  • label2 - A label for arg2.
Source

pub fn label3(self, label3: &str) -> Self

Sets the label3 field.

§Arguments
  • label3 - A label for arg3.
Source

pub fn label4(self, label4: &str) -> Self

Sets the label4 field.

§Arguments
  • label4 - A label for arg4.
Source

pub fn secured1(self, secured1: bool) -> Self

Sets the secured1 field.

§Arguments
  • secured1 - A boolean indicating whether or not arg1 should be secured.
Source

pub fn secured2(self, secured2: bool) -> Self

Sets the secured2 field.

§Arguments
  • secured2 - A boolean indicating whether or not arg2 should be secured.
Source

pub fn secured3(self, secured3: bool) -> Self

Sets the secured3 field.

§Arguments
  • secured3 - A boolean indicating whether or not arg3 should be secured.
Source

pub fn secured4(self, secured4: bool) -> Self

Sets the secured4 field.

§Arguments
  • secured4 - A boolean indicating whether or not arg4 should be secured.
Source

pub fn value(self, value: &str) -> Self

Sets the value field.

§Arguments
  • value - The value for the Variable, acting as a default value.

Trait Implementations§

Source§

impl Builder for VariableBuilder

Source§

fn new() -> Self

Creates a new VariableBuilder instance used to construct a Variable object.

§Returns

A VariableBuilder instance.

Source§

fn name(self, name: &str) -> Self

Sets the name field.

§Arguments
  • name - The name of the Variable.
Source§

fn build(self) -> Result<Self::ConfigObject, OpsviewConfigError>

Builds a new Variable instance using the VariableBuilder.

§Returns

A Variable instance.

§Errors
  • name not set or invalid.
Source§

type ConfigObject = Variable

Source§

impl Clone for VariableBuilder

Source§

fn clone(&self) -> VariableBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for VariableBuilder

Source§

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

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

impl Default for VariableBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<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 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,