We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73c9278 commit c0f7c04Copy full SHA for c0f7c04
quic/s2n-quic-core/src/application/server_name.rs
@@ -28,14 +28,18 @@ pub struct ServerName(Bytes);
28
29
/// A static value for localhost
30
#[allow(dead_code)] // this is used by conditional modules so don't warn
31
-pub(crate) static LOCALHOST: ServerName = ServerName(Bytes::from_static(b"localhost"));
+pub(crate) static LOCALHOST: ServerName = ServerName::from_static("localhost");
32
33
impl ServerName {
34
#[inline]
35
pub fn into_bytes(self) -> Bytes {
36
self.0
37
}
38
39
+ pub const fn from_static(s: &'static str) -> Self {
40
+ ServerName(Bytes::from_static(s.as_bytes()))
41
+ }
42
+
43
44
fn as_str(&self) -> &str {
45
// Safety: the byte array is validated as a valid UTF-8 string
0 commit comments