summaryrefslogtreecommitdiffstats
path: root/src/stanza
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/stanza/mod.rs4
-rw-r--r--src/stanza/stream.rs19
2 files changed, 15 insertions, 8 deletions
diff --git a/src/stanza/mod.rs b/src/stanza/mod.rs
index c5a6da3..e4f080f 100644
--- a/src/stanza/mod.rs
+++ b/src/stanza/mod.rs
@@ -8,4 +8,6 @@ pub mod stream;
use quick_xml::events::{BytesDecl, Event};
-pub static DECLARATION: Event = Event::Decl(BytesDecl::new("1.0", None, None));
+lazy_static! {
+ pub static ref DECLARATION: Event<'static> = Event::Decl(BytesDecl::new("1.0", None, None));
+}
diff --git a/src/stanza/stream.rs b/src/stanza/stream.rs
index 07f7e6e..9a21373 100644
--- a/src/stanza/stream.rs
+++ b/src/stanza/stream.rs
@@ -25,13 +25,13 @@ pub struct Stream<'s> {
xmlns_stream: &'s str,
}
-impl Stream {
+impl<'s> Stream<'s> {
pub fn new(
- from: Option<&JID>,
- to: Option<&JID>,
- id: Option<&str>,
- version: Option<&str>,
- lang: Option<&str>,
+ from: Option<&'s JID>,
+ to: Option<&'s JID>,
+ id: Option<&'s str>,
+ version: Option<&'s str>,
+ lang: Option<&'s str>,
) -> Self {
Self {
from,
@@ -46,7 +46,12 @@ impl Stream {
/// For initial stream headers, the initiating entity SHOULD include the 'xml:lang' attribute.
/// For privacy, it is better to not set `from` when sending a client stanza over an unencrypted connection.
- pub fn new_client(from: Option<&JID>, to: &JID, id: Option<&str>, lang: &str) -> Self {
+ pub fn new_client(
+ from: Option<&'s JID>,
+ to: &'s JID,
+ id: Option<&'s str>,
+ lang: &'s str,
+ ) -> Self {
Self {
from,
to: Some(to),