pub struct Position {
pub group: u64,
pub frame: u64,
}Expand description
A frame-precise point in a track: a group sequence and a frame index within it.
Ordered lexicographically, so comparing positions is the same as comparing groups
and only falling back to frames within one. This is the model’s counterpart of the
wire’s (Group, Frame) pairs on SUBSCRIBE and FETCH.
Pairing the two is the point: a frame index counts from the start of a group, so it means nothing on its own. Carrying them together makes “frame 5 of nothing” unrepresentable rather than merely undefined.
Fields§
§group: u64The group sequence.
frame: u64The frame index within the group, numbered from 0 in write order.
Implementations§
Source§impl Position
impl Position
Sourcepub fn group(group: u64) -> Self
pub fn group(group: u64) -> Self
The first frame of group.
As an exclusive end this means “everything before group”; as a start it means
“group from the beginning”.
Sourcepub fn after(group: u64, frame: u64) -> Option<Self>
pub fn after(group: u64, frame: u64) -> Option<Self>
The position just past frame of group: the exclusive end that includes it.
None when there is no such position, i.e. the very last frame of the very last
group. That is past everything, which Subscription::end spells None too, so
the two meanings line up and with_end can take this directly.
Sourcepub fn after_group(group: u64) -> Option<Self>
pub fn after_group(group: u64) -> Option<Self>
The position just past every frame of group: the exclusive end that includes
the group whole.
None past the last group, for the reason given on Self::after.
Sourcepub fn group_end(self) -> Bound<u64>
pub fn group_end(self) -> Bound<u64>
The bound this exclusive end puts on a group cursor, for
crate::track::Subscriber::set_groups.
A head-of-group end excludes its group. A mid-group end includes it, so a frame cap can apply within that group.