use core::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PayloadByteCount {
value: usize,
}
impl PayloadByteCount {
#[must_use]
pub(crate) const fn new(value: usize) -> Self {
Self { value }
}
#[must_use]
pub const fn get(self) -> usize {
self.value
}
#[must_use]
pub const fn is_zero(self) -> bool {
self.value == 0
}
}
impl fmt::Display for PayloadByteCount {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.value.fmt(f)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RuntimeInputByteCount {
value: usize,
}
impl RuntimeInputByteCount {
#[must_use]
pub(crate) const fn new(value: usize) -> Self {
Self { value }
}
#[must_use]
pub const fn get(self) -> usize {
self.value
}
#[must_use]
pub const fn is_zero(self) -> bool {
self.value == 0
}
}
impl fmt::Display for RuntimeInputByteCount {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.value.fmt(f)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RuntimeStateByteCount {
value: usize,
}
impl RuntimeStateByteCount {
#[must_use]
pub(crate) const fn new(value: usize) -> Self {
Self { value }
}
#[must_use]
pub(crate) const fn from_runtime_input_count(count: RuntimeInputByteCount) -> Self {
Self { value: count.get() }
}
#[must_use]
pub const fn get(self) -> usize {
self.value
}
#[must_use]
pub const fn is_zero(self) -> bool {
self.value == 0
}
}
impl fmt::Display for RuntimeStateByteCount {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.value.fmt(f)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ReturnOutputByteCount {
value: usize,
}
impl ReturnOutputByteCount {
#[must_use]
pub(crate) const fn new(value: usize) -> Self {
Self { value }
}
#[must_use]
pub(crate) const fn from_payload_count(count: PayloadByteCount) -> Self {
Self { value: count.get() }
}
#[must_use]
pub const fn get(self) -> usize {
self.value
}
#[must_use]
pub const fn is_zero(self) -> bool {
self.value == 0
}
}
impl fmt::Display for ReturnOutputByteCount {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.value.fmt(f)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TraceSnapshotByteCount {
value: usize,
}
impl TraceSnapshotByteCount {
#[must_use]
pub(crate) const fn from_runtime_state_count(count: RuntimeStateByteCount) -> Self {
Self { value: count.get() }
}
#[must_use]
pub(crate) const fn from_return_output_count(count: ReturnOutputByteCount) -> Self {
Self { value: count.get() }
}
#[must_use]
pub const fn get(self) -> usize {
self.value
}
#[must_use]
pub const fn is_zero(self) -> bool {
self.value == 0
}
}
impl fmt::Display for TraceSnapshotByteCount {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.value.fmt(f)
}
}