Skip to content

Commit

Permalink
Merge pull request #43 from Frando/more-derives
Browse files Browse the repository at this point in the history
  • Loading branch information
sgwilym committed Aug 11, 2024
2 parents 47efdc1 + b98500e commit 11e09fa
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions data-model/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ impl std::error::Error for UnauthorisedWriteError {}
/// [Definition](https://willowprotocol.org/specs/data-model/index.html#AuthorisedEntry).
///
/// [Definition](https://willowprotocol.org/specs/data-model/index.html#AuthorisedEntry).
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct AuthorisedEntry<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT>(
pub Entry<MCL, MCC, MPL, N, S, PD>,
pub AT,
Expand Down
4 changes: 2 additions & 2 deletions data-model/src/grouping/area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
use super::range::Range;

/// The possible values of an [`Area`]'s `subspace`.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
pub enum AreaSubspace<S: SubspaceId> {
/// A value that signals that an [`Area`] includes Entries with arbitrary subspace_ids.
Any,
Expand Down Expand Up @@ -64,7 +64,7 @@ where

/// A grouping of entries.
/// [Definition](https://willowprotocol.org/specs/grouping-entries/index.html#areas).
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
pub struct Area<const MCL: usize, const MCC: usize, const MPL: usize, S: SubspaceId> {
/// To be included in this [`Area`], an [`Entry`]’s `subspace_id` must be equal to the subspace_id, unless it is any.
subspace: AreaSubspace<S>,
Expand Down
1 change: 1 addition & 0 deletions data-model/src/grouping/area_of_interest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{grouping::area::Area, parameters::SubspaceId};
/// A grouping of [`crate::Entry`]s that are among the newest in some [store](https://willowprotocol.org/specs/data-model/index.html#store).
///
/// [Definition](https://willowprotocol.org/specs/grouping-entries/index.html#aois).
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct AreaOfInterest<const MCL: usize, const MCC: usize, const MPL: usize, S: SubspaceId> {
/// To be included in this [`AreaOfInterest`], an [`crate::Entry`] must be included in the [`Area`].
pub area: Area<MCL, MCC, MPL, S>,
Expand Down
4 changes: 2 additions & 2 deletions data-model/src/grouping/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use arbitrary::{Arbitrary, Error as ArbitraryError};

use crate::path::Path;

#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, Hash, PartialEq, Eq)]
/// Determines whether a [`Range`] is _closed_ or _open_.
pub enum RangeEnd<T: Ord> {
/// A [closed range](https://willowprotocol.org/specs/grouping-entries/index.html#closed_range) consists of a [start value](https://willowprotocol.org/specs/grouping-entries/index.html#start_value) and an [end_value](https://willowprotocol.org/specs/grouping-entries/index.html#end_value).
Expand Down Expand Up @@ -152,7 +152,7 @@ where
/// One-dimensional grouping over a type of value.
///
/// [Definition](https://willowprotocol.org/specs/grouping-entries/index.html#range)
#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct Range<T: Ord> {
/// A range [includes](https://willowprotocol.org/specs/grouping-entries/index.html#range_include) all values greater than or equal to its [start value](https://willowprotocol.org/specs/grouping-entries/index.html#start_value) **and** less than its [end_value](https://willowprotocol.org/specs/grouping-entries/index.html#end_value)
pub start: T,
Expand Down
2 changes: 1 addition & 1 deletion data-model/src/grouping/range_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{

/// A three-dimensional range that includes every Entry included in all three of its ranges.
/// [Definition](https://willowprotocol.org/specs/grouping-entries/index.html#D3Range).
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct Range3d<const MCL: usize, const MCC: usize, const MPL: usize, S: SubspaceId> {
/// A range of [`SubspaceId`]s.
/// [Definition](https://willowprotocol.org/specs/grouping-entries/index.html#SubspaceRange).
Expand Down

0 comments on commit 11e09fa

Please sign in to comment.