pub struct MetricEventBuilder { /* private fields */ }
Expand description
MetricEventBuilder allows for a chained construction of MetricEvent
objects.
Implementations§
Source§impl MetricEventBuilder
impl MetricEventBuilder
Sourcepub fn with_event_code(self, event_code: u32) -> MetricEventBuilder
pub fn with_event_code(self, event_code: u32) -> MetricEventBuilder
Appends the provided event_code
to the event_codes
list.
§Examples
assert_eq!(MetricEvent::builder(6).with_event_code(10).as_event().event_codes, vec![10]);
Sourcepub fn with_event_codes<Codes: AsEventCodes>(
self,
event_codes: Codes,
) -> MetricEventBuilder
pub fn with_event_codes<Codes: AsEventCodes>( self, event_codes: Codes, ) -> MetricEventBuilder
Overrides the list of event_codes with the provided event_codes
.
§Examples
assert_eq!(
MetricEvent::builder(7).with_event_codes([1, 2, 3]).as_event().event_codes,
vec![1,2,3]);
Sourcepub fn with_event_code_at(
self,
index: usize,
event_code: u32,
) -> MetricEventBuilder
pub fn with_event_code_at( self, index: usize, event_code: u32, ) -> MetricEventBuilder
Sourcepub fn build(self, payload: MetricEventPayload) -> MetricEvent
pub fn build(self, payload: MetricEventPayload) -> MetricEvent
Constructs a MetricEvent
with the provided MetricEventPayload
.
§Examples
let payload = MetricEventPayload::Event(fidl_fuchsia_cobalt::Event);
assert_eq!(MetricEvent::builder(10).build(payload.clone()).payload, payload);
Sourcepub fn as_occurrence(self, count: u64) -> MetricEvent
pub fn as_occurrence(self, count: u64) -> MetricEvent
Constructs a MetricEvent
with a payload type of MetricEventPayload::Count
.
§Examples
asert_eq!(
MetricEvent::builder(11).as_occurrence(10).payload,
MetricEventPayload::Event(fidl_fuchsia_cobalt::Count(10)));
Sourcepub fn as_integer(self, integer_value: i64) -> MetricEvent
pub fn as_integer(self, integer_value: i64) -> MetricEvent
Constructs a MetricEvent
with a payload type of MetricEventPayload::IntegerValue
.
§Examples
asert_eq!(
MetricEvent::builder(12).as_integer(5).payload,
MetricEventPayload::IntegerValue(5)));
Sourcepub fn as_integer_histogram(
self,
histogram: Vec<HistogramBucket>,
) -> MetricEvent
pub fn as_integer_histogram( self, histogram: Vec<HistogramBucket>, ) -> MetricEvent
Constructs a MetricEvent
with a payload type of MetricEventPayload::Histogram
.
§Examples
let histogram = vec![HistogramBucket { index: 0, count: 1 }];
asert_eq!(
MetricEvent::builder(17).as_int_histogram(histogram.clone()).payload,
MetricEventPayload::Histogram(histogram));
Trait Implementations§
Source§impl Clone for MetricEventBuilder
impl Clone for MetricEventBuilder
Source§fn clone(&self) -> MetricEventBuilder
fn clone(&self) -> MetricEventBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MetricEventBuilder
impl Debug for MetricEventBuilder
Source§impl Default for MetricEventBuilder
impl Default for MetricEventBuilder
Source§fn default() -> MetricEventBuilder
fn default() -> MetricEventBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MetricEventBuilder
impl RefUnwindSafe for MetricEventBuilder
impl Send for MetricEventBuilder
impl Sync for MetricEventBuilder
impl Unpin for MetricEventBuilder
impl UnwindSafe for MetricEventBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)