Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lazer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lazer/sdk/rust/protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyth-lazer-protocol"
version = "0.3.3"
version = "0.4.0"
edition = "2021"
description = "Pyth Lazer SDK - protocol types."
license = "Apache-2.0"
Expand Down
8 changes: 1 addition & 7 deletions lazer/sdk/rust/protocol/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ pub enum JsonBinaryEncoding {

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum Channel {
RealTime,
FixedRate(FixedRate),
}

Expand All @@ -173,7 +172,6 @@ impl Serialize for Channel {
S: serde::Serializer,
{
match self {
Channel::RealTime => serializer.serialize_str("real_time"),
Channel::FixedRate(fixed_rate) => {
serializer.serialize_str(&format!("fixed_rate@{}ms", fixed_rate.value_ms()))
}
Expand All @@ -184,7 +182,6 @@ impl Serialize for Channel {
mod channel_ids {
use super::ChannelId;

pub const REAL_TIME: ChannelId = ChannelId(1);
pub const FIXED_RATE_50: ChannelId = ChannelId(2);
pub const FIXED_RATE_200: ChannelId = ChannelId(3);
pub const FIXED_RATE_1: ChannelId = ChannelId(4);
Expand All @@ -193,7 +190,6 @@ mod channel_ids {
impl Channel {
pub fn id(&self) -> ChannelId {
match self {
Channel::RealTime => channel_ids::REAL_TIME,
Channel::FixedRate(fixed_rate) => match fixed_rate.value_ms() {
1 => channel_ids::FIXED_RATE_1,
50 => channel_ids::FIXED_RATE_50,
Expand All @@ -212,9 +208,7 @@ fn id_supports_all_fixed_rates() {
}

fn parse_channel(value: &str) -> Option<Channel> {
if value == "real_time" {
Some(Channel::RealTime)
} else if let Some(rest) = value.strip_prefix("fixed_rate@") {
if let Some(rest) = value.strip_prefix("fixed_rate@") {
let ms_value = rest.strip_suffix("ms")?;
Some(Channel::FixedRate(FixedRate::from_ms(
ms_value.parse().ok()?,
Expand Down
Loading