Skip to content

Commit

Permalink
Move header conversions into service protocol crate
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed Dec 9, 2024
1 parent 8ef46cf commit da7f00a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,6 @@ pub struct Header {
pub value: Cow<'static, str>,
}

impl From<service_protocol::messages::Header> for Header {
fn from(header: service_protocol::messages::Header) -> Self {
Self {
key: Cow::Owned(header.key),
value: Cow::Owned(header.value),
}
}
}

impl From<Header> for service_protocol::messages::Header {
fn from(header: Header) -> Self {
Self {
key: header.key.into(),
value: header.value.into(),
}
}
}

#[derive(Debug)]
pub struct ResponseHead {
pub status_code: u16,
Expand Down
20 changes: 20 additions & 0 deletions src/service_protocol/messages.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::borrow::Cow;

use crate::service_protocol::messages::get_state_keys_entry_message::StateKeys;
use crate::service_protocol::{MessageHeader, MessageType};
use crate::vm::errors::{
Expand Down Expand Up @@ -455,6 +457,24 @@ impl From<Failure> for crate::TerminalFailure {
}
}

impl From<Header> for crate::Header {
fn from(header: Header) -> Self {
Self {
key: Cow::Owned(header.key),
value: Cow::Owned(header.value),
}
}
}

impl From<crate::Header> for Header {
fn from(header: crate::Header) -> Self {
Self {
key: header.key.into(),
value: header.value.into(),
}
}
}

// --- Completion parsing

#[derive(Debug)]
Expand Down

0 comments on commit da7f00a

Please sign in to comment.