Skip to content

Commit ef6c913

Browse files
committed
Add 1000ms channel to Lazer protocol
1 parent 819fa09 commit ef6c913

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

lazer/sdk/rust/protocol/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-lazer-protocol"
3-
version = "0.14.0"
3+
version = "0.15.0"
44
edition = "2021"
55
description = "Pyth Lazer SDK - protocol types."
66
license = "Apache-2.0"

lazer/sdk/rust/protocol/src/api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ impl Channel {
141141
Channel::FixedRate(fixed_rate) => match fixed_rate.duration().as_millis() {
142142
50 => ChannelId::FIXED_RATE_50,
143143
200 => ChannelId::FIXED_RATE_200,
144+
1000 => ChannelId::FIXED_RATE_1000,
144145
_ => panic!("unknown channel: {self:?}"),
145146
},
146147
Channel::RealTime => ChannelId::REAL_TIME,

lazer/sdk/rust/protocol/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ impl ChannelId {
5252
pub const REAL_TIME: ChannelId = ChannelId(1);
5353
pub const FIXED_RATE_50: ChannelId = ChannelId(2);
5454
pub const FIXED_RATE_200: ChannelId = ChannelId(3);
55+
pub const FIXED_RATE_1000: ChannelId = ChannelId(4);
5556
}
5657

5758
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]

lazer/sdk/rust/protocol/src/time.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,15 @@ impl FixedRate {
499499
pub const RATE_200_MS: Self = Self {
500500
rate: DurationUs::from_millis_u32(200),
501501
};
502+
pub const RATE_1000_MS: Self = Self {
503+
rate: DurationUs::from_millis_u32(1000),
504+
};
502505

503506
// Assumptions (tested below):
504507
// - Values are sorted.
505508
// - 1 second contains a whole number of each interval.
506509
// - all intervals are divisable by the smallest interval.
507-
pub const ALL: [Self; 2] = [Self::RATE_50_MS, Self::RATE_200_MS];
510+
pub const ALL: [Self; 3] = [Self::RATE_50_MS, Self::RATE_200_MS, Self::RATE_1000_MS];
508511
pub const MIN: Self = Self::ALL[0];
509512

510513
pub fn from_millis(millis: u32) -> Option<Self> {

0 commit comments

Comments
 (0)