pub struct MeshHandoverConsumeArgs {
pub handover: String,
pub session: String,
pub no_materialize: bool,
pub query: MeshQueryArgs,
}Expand description
mesh handover consume: which offered handover to take, and on whose behalf. The
consumption is recorded on the mesh so that two workers cannot silently pick up the
same handover, which is why the session is required and not inferred.
--no-materialize records the act without writing the local record, for a caller that
wants the claim on the handover but will read it some other way.
use clap::Parser;
use majordomus_cli::cli::{Cli, Command, MeshCommand, MeshHandoverCommand,
MeshHandoverConsumeArgs};
let cli = Cli::try_parse_from([
"majordomus", "mesh", "handover", "consume", "h-7", "--session", "s1",
"--no-materialize",
])
.unwrap();
let Command::Mesh(mesh) = cli.command else { panic!("expected `mesh`") };
let MeshCommand::Handover(handover) = mesh.command else { panic!("expected `handover`") };
let MeshHandoverCommand::Consume(consume) = handover.command else { panic!("expected it") };
let consume: MeshHandoverConsumeArgs = consume;
assert_eq!((consume.handover.as_str(), consume.session.as_str()), ("h-7", "s1"));
assert!(consume.no_materialize);
// the consuming session is what makes the consumption attributable, so it is required
assert!(Cli::try_parse_from(["majordomus", "mesh", "handover", "consume", "h-7"]).is_err());Fields§
§handover: StringThe handover’s id, as mesh state lists it
session: StringThe consuming session’s id within this runtime
no_materialize: boolRecord the consumption without writing a local handover record
query: MeshQueryArgsWhere the repository is and how to answer.
Trait Implementations§
Source§impl Args for MeshHandoverConsumeArgs
impl Args for MeshHandoverConsumeArgs
Source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
Report the [
ArgGroup::id][crate::ArgGroup::id] for this set of argumentsSource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
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 moreSource§impl Debug for MeshHandoverConsumeArgs
impl Debug for MeshHandoverConsumeArgs
Source§impl FromArgMatches for MeshHandoverConsumeArgs
impl FromArgMatches for MeshHandoverConsumeArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
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>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
Assign values from
ArgMatches to self.Auto Trait Implementations§
impl Freeze for MeshHandoverConsumeArgs
impl RefUnwindSafe for MeshHandoverConsumeArgs
impl Send for MeshHandoverConsumeArgs
impl Sync for MeshHandoverConsumeArgs
impl Unpin for MeshHandoverConsumeArgs
impl UnsafeUnpin for MeshHandoverConsumeArgs
impl UnwindSafe for MeshHandoverConsumeArgs
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
Mutably borrows from an owned value. Read more