Skip to content
Merged
Changes from all 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
6 changes: 5 additions & 1 deletion quic/s2n-quic-core/src/application/server_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ pub struct ServerName(Bytes);

/// A static value for localhost
#[allow(dead_code)] // this is used by conditional modules so don't warn
pub(crate) static LOCALHOST: ServerName = ServerName(Bytes::from_static(b"localhost"));
pub(crate) static LOCALHOST: ServerName = ServerName::from_static("localhost");

impl ServerName {
#[inline]
pub fn into_bytes(self) -> Bytes {
self.0
}

pub const fn from_static(s: &'static str) -> Self {
ServerName(Bytes::from_static(s.as_bytes()))
}

#[inline]
fn as_str(&self) -> &str {
// Safety: the byte array is validated as a valid UTF-8 string
Expand Down
Loading