Skip to content

Commit

Permalink
fix: add missing getters for data model structs
Browse files Browse the repository at this point in the history
Signed-off-by: Shanin Roman <[email protected]>
  • Loading branch information
Erigara committed Jun 6, 2024
1 parent 92f11c8 commit 3d67133
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
Binary file modified configs/peer/executor.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions data_model/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ pub mod model {
#[getset(get_copy = "pub")]
pub value_type: AssetValueType,
/// Is the asset mintable
#[getset(get_copy = "pub")]
pub mintable: Mintable,
/// IPFS link to the [`AssetDefinition`] logo
#[getset(get = "pub")]
Expand Down
17 changes: 17 additions & 0 deletions data_model/src/events/data/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,23 @@ impl DataEvent {
}
}

impl<ID> MetadataChanged<ID> {
/// Getter for `target_id`
pub fn target_id(&self) -> &ID {
&self.target_id
}

/// Getter for `target_id`
pub fn key(&self) -> &Name {
&self.key
}

/// Getter for `value`
pub fn value(&self) -> &Value {
&self.value
}
}

pub mod prelude {
pub use super::{
account::{
Expand Down
12 changes: 12 additions & 0 deletions data_model/src/events/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ impl Schedule {
}
}

impl TimeInterval {
/// Getter for `since`
pub fn since(&self) -> &Duration {
&self.since
}

/// Getter for `length`
pub fn length(&self) -> &Duration {
&self.length
}
}

impl From<TimeInterval> for Range<Duration> {
#[inline]
fn from(interval: TimeInterval) -> Self {
Expand Down
7 changes: 7 additions & 0 deletions data_model/src/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ impl Peer {
}
}

impl PeerId {
/// Getter for `address`
pub fn address(&self) -> &SocketAddr {
&self.address
}
}

impl PartialEq for PeerId {
fn eq(&self, other: &Self) -> bool {
// Comparison is done by public key only.
Expand Down

0 comments on commit 3d67133

Please sign in to comment.