Skip to content

Commit

Permalink
feat: Replace with static settings (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x676e67 authored Oct 16, 2024
1 parent 2809d53 commit 61649d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ impl Builder {
}

/// Settings frame order
pub fn settings_order(&mut self, order: Vec<SettingsOrder>) -> &mut Self {
pub fn settings_order(&mut self, order: &'static [SettingsOrder]) -> &mut Self {
self.settings.set_settings_order(Some(order));
self
}
Expand Down
10 changes: 5 additions & 5 deletions src/frame/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ pub enum SettingsOrder {
}

#[derive(Debug, Clone, Eq, PartialEq)]
pub struct SettingsOrders(Vec<SettingsOrder>);
pub struct SettingsOrders(&'static [SettingsOrder]);

impl From<Vec<SettingsOrder>> for SettingsOrders {
fn from(order: Vec<SettingsOrder>) -> Self {
impl From<&'static [SettingsOrder]> for SettingsOrders {
fn from(order: &'static [SettingsOrder]) -> Self {
SettingsOrders(order)
}
}

impl Default for SettingsOrders {
fn default() -> Self {
SettingsOrders(vec![
SettingsOrders(&[
SettingsOrder::HeaderTableSize,
SettingsOrder::EnablePush,
SettingsOrder::InitialWindowSize,
Expand Down Expand Up @@ -175,7 +175,7 @@ impl Settings {
self.unknown_setting_9 = Some(enable as u32);
}

pub fn set_settings_order(&mut self, order: Option<Vec<SettingsOrder>>) {
pub fn set_settings_order(&mut self, order: Option<&'static [SettingsOrder]>) {
self.settings_orders = order.map_or(SettingsOrders::default(), SettingsOrders::from);
}

Expand Down

0 comments on commit 61649d5

Please sign in to comment.