Skip to main content

EditableFields

Struct EditableFields 

Source
pub struct EditableFields {
Show 13 fields pub host: Option<String>, pub port: Option<u16>, pub socket: Option<PathBuf>, pub user: Option<String>, pub password_stdin: bool, pub pin_database: Option<bool>, pub read_only_profile: Option<bool>, pub auth: Option<String>, pub client_cert: Option<PathBuf>, pub client_key: Option<PathBuf>, pub ca: Option<PathBuf>, pub require_tls: Option<bool>, pub session_setup: Vec<String>,
}
Expand description

Every field an edit may change.

Fields§

§host: Option<String>

Server host.

§port: Option<u16>

Server port.

§socket: Option<PathBuf>

Local socket path, also spelled --pipe for the reason given on AddArgs.

§user: Option<String>

User the credential belongs to.

§password_stdin: bool

Read a new secret from the standard input.

§pin_database: Option<bool>

Fix the database, so the profile stops taking a database parameter.

Three states rather than two, which every truth value an edit may write carries here: written bare it fixes the database, written --pin-database false it releases it, and left out it changes nothing. Two states would make an edit that names one field reset the other, so “not mentioned” has to be a value the field can hold.

§A stated departure

The project’s own guidance on this argument library says never to take a truth value as Option<bool> and to use bool. Every truth value in this struct departs from it, deliberately, and the reason is the sentence above: that guidance is written for a flag that answers “was this asked for”, where two states are all there is to say. These answer a different question — “should this field change, and to what” — and it has three answers. Collapsing it would not simplify the type, it would silently delete stored policy on every edit that did not restate it.

The same guidance offers a way to get three states without this type: a pair of plain bool flags, --pin-database and --no-pin-database, each overriding the other, where writing neither is the third state. That works, and it is declined on size rather than on correctness. The three editable truth values here would become six flags, in a product whose FR-053 publishes its own surface for an agent to read and whose whole argument is that a smaller answer is a better one. Doubling the surface to avoid one wrapper is the trade in the wrong direction.

The count said six and twelve until an audit counted them: three, not six. The argument survived being wrong by a factor of two, because doubling is doubling at any size — but the number is what carries it, and this is the second time in one sitting that a sentence in this repository stopped matching the thing beside it while still reading as true. The first was tests/support/delegated.rs, whose own correction notes that its count is spelled out because it was wrong once. A number in prose is a claim, and nothing here checks it.

Recorded here rather than left to be re-derived, because a departure nobody wrote down reads as an oversight by whoever finds it next — and an alternative discarded without a line reads as one never considered.

The prose above is written for whoever maintains this, and long_help keeps it out of the terminal. Without that, clap serves the whole doc comment as the help of this flag, so a caller asking what a flag does was handed an audit note naming a test file and a requirement number.

§read_only_profile: Option<bool>

Refuse any change through this profile.

Carries the same three states as --pin-database above, and for the same reason. It did not, and the gap was not visible from here: the field beside it announced that “every editable field here” had three states while this one had two, so a reader checking the sentence rather than the attribute found the promise and stopped. FR-087 then published conn edit producao --read-only-profile as its example and that form ended in 2, because the value was required.

Kept out of the terminal by long_help, for the reason stated on --pin-database above.

§auth: Option<String>

Declared authentication method.

§client_cert: Option<PathBuf>

Client certificate presented to the server.

Editable for the reason the whole group below is: a destination that only admits an identified caller is exactly the destination whose identity expires, and an identity that can be written once but never replaced obliges the caller to delete the profile and build it again. That trades a rotation for the secret the profile holds, which the caller may no longer have.

§client_key: Option<PathBuf>

Key matching the client certificate.

§ca: Option<PathBuf>

Authority used to verify the server certificate.

§require_tls: Option<bool>

Whether this destination demands an encrypted channel.

Three states, matching the field it writes and --pin-database beside it: written bare it demands encryption, written --require-tls false it says this destination does not, and left out it changes nothing and leaves whatever the profile already said.

§session_setup: Vec<String>

Session adjustments applied when opening.

A list cannot borrow the three-state shape of the values above, because “not mentioned” and “mentioned as nothing” are the same empty list. So the empty text is spelled out and means the empty list: --session-setup '' clears the adjustments, any other use replaces them, and leaving the flag out keeps them. Without that spelling the adjustments would be the one stored field an edit could add to and never take away.

Trait Implementations§

Source§

impl Args for EditableFields

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Clone for EditableFields

Source§

fn clone(&self) -> Self

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 EditableFields

Source§

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

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

impl FromArgMatches for EditableFields

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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