Struct cometbft_testgen::commit::Commit
source · pub struct Commit {
pub header: Option<Header>,
pub votes: Option<Vec<Vote>>,
pub round: Option<u32>,
}
Fields§
§header: Option<Header>
§votes: Option<Vec<Vote>>
§round: Option<u32>
Implementations§
source§impl Commit
impl Commit
sourcepub fn new(header: Header, round: u32) -> Self
pub fn new(header: Header, round: u32) -> Self
Make a new commit using default votes produced from the header.
sourcepub fn new_with_votes(header: Header, round: u32, votes: Vec<Vote>) -> Self
pub fn new_with_votes(header: Header, round: u32, votes: Vec<Vote>) -> Self
Make a new commit using explicit votes.
pub fn header(self, header: Header) -> Self
pub fn votes(self, votes: Vec<Vote>) -> Self
pub fn round(self, round: u32) -> Self
sourcepub fn generate_default_votes(self) -> Self
pub fn generate_default_votes(self) -> Self
Generate commit votes from all validators in the header. This function will panic if the header is not present
sourcepub fn vote_of_validator(&mut self, id: &str) -> &mut Vote
pub fn vote_of_validator(&mut self, id: &str) -> &mut Vote
Get a mutable reference to the vote of the given validator. This function will panic if the votes or the validator vote is not present
sourcepub fn vote_at_index(&mut self, index: usize) -> &mut Vote
pub fn vote_at_index(&mut self, index: usize) -> &mut Vote
Get a mutable reference to the vote at the given index This function will panic if the votes or the vote at index is not present
Trait Implementations§
source§impl<'de> Deserialize<'de> for Commit
impl<'de> Deserialize<'de> for Commit
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Generator<Commit> for Commit
impl Generator<Commit> for Commit
source§fn merge_with_default(self, other: Self) -> Self
fn merge_with_default(self, other: Self) -> Self
Merge this companion with the another, default one.
The options present in this object will override those in the default one.
source§impl Options for Commit
impl Options for Commit
source§fn parse<__S: AsRef<str>>(_parser: &mut Parser<'_, __S>) -> Result<Self, Error>
fn parse<__S: AsRef<str>>(_parser: &mut Parser<'_, __S>) -> Result<Self, Error>
Parses arguments until the given parser is exhausted or until
an error is encountered.
source§fn command(&self) -> Option<&dyn Options>
fn command(&self) -> Option<&dyn Options>
Returns the subcommand instance, if present. Read more
source§fn command_name(&self) -> Option<&'static str>
fn command_name(&self) -> Option<&'static str>
Returns the name of a parsed command, if present. Read more
source§fn help_requested(&self) -> bool
fn help_requested(&self) -> bool
Returns whether the user supplied a “help” option to request
usage information about the program or any contained subcommands. Read more
source§fn parse_command<__S: AsRef<str>>(
name: &str,
_parser: &mut Parser<'_, __S>
) -> Result<Self, Error>
fn parse_command<__S: AsRef<str>>( name: &str, _parser: &mut Parser<'_, __S> ) -> Result<Self, Error>
Parses options for the named command.
source§fn usage() -> &'static str
fn usage() -> &'static str
Returns a string showing usage and help for each supported option. Read more
source§fn self_usage(&self) -> &'static str
fn self_usage(&self) -> &'static str
Returns a string showing usage and help for this options instance. Read more
source§fn command_list() -> Option<&'static str>
fn command_list() -> Option<&'static str>
Returns a string listing available commands and help text. Read more
source§fn command_usage(_name: &str) -> Option<&'static str>
fn command_usage(_name: &str) -> Option<&'static str>
Returns a usage string for the named command. Read more
source§fn self_command_list(&self) -> Option<&'static str>
fn self_command_list(&self) -> Option<&'static str>
Returns a listing of available commands and help text. Read more
source§fn parse_args<S>(args: &[S], style: ParsingStyle) -> Result<Self, Error>
fn parse_args<S>(args: &[S], style: ParsingStyle) -> Result<Self, Error>
Parses arguments received from the command line. Read more
source§fn parse_args_or_exit(style: ParsingStyle) -> Selfwhere
Self: Sized,
fn parse_args_or_exit(style: ParsingStyle) -> Selfwhere
Self: Sized,
Parses arguments from the environment. Read more
source§fn parse_args_default_or_exit() -> Selfwhere
Self: Sized,
fn parse_args_default_or_exit() -> Selfwhere
Self: Sized,
Parses arguments from the environment, using the default
parsing style. Read more
Auto Trait Implementations§
impl RefUnwindSafe for Commit
impl Send for Commit
impl Sync for Commit
impl Unpin for Commit
impl UnwindSafe for Commit
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