@@ -9,7 +9,7 @@ See [full documentation](https://docs.rs/libstrophe)
99Add this to your Cargo.toml:
1010```
1111[dependencies]
12- libstrophe = "0.19.3 "
12+ libstrophe = "0.20.0 "
1313```
1414
1515![ Maintenance] ( https://img.shields.io/badge/maintenance-passively--maintained-yellowgreen.svg )
@@ -30,23 +30,23 @@ library documentation][docs] in most other cases.
3030## Workflow
3131
3232The general workflow is quite similar to what you get with the C library. The topmost object is
33- [ ` Context ` ] . It contains platform-specific bits like logging and memory allocation. Plus an event
33+ [ Context] . It contains platform-specific bits like logging and memory allocation. Plus an event
3434loop used to keep things going. This crate wraps logging with the facilities provided by [ ` log ` ]
3535crate (provided the default ` rust-log ` feature is enabled). Memory allocation is also handled by
36- Rust native means. When a [ ` Connection ` ] is created it will temporarily consume the [ ` Context ` ] .
37- After all of the setup is done, call one of the ` connect_*() ` methods to retrieve the [ ` Context ` ]
38- back. In this manner a single [ ` Context ` ] can be used for multiple [ ` Connection ` ] s consequently.
39- When you're done with setting up [ ` Connection ` ] s for the [ ` Context ` ] , use ` run() ` or ` run_once() `
36+ Rust native means. When a [ Connection] is created it will temporarily consume the [ Context] .
37+ After all the setup is done, call one of the ` connect_*() ` methods to retrieve the [ Context]
38+ back. In this manner a single [ Context] can be used for multiple [ Connection] s consequently.
39+ When you're done with setting up [ Connection] s for the [ Context] , use ` run() ` or ` run_once() `
4040methods to start the event loop rolling.
4141
4242
4343## Safety
4444
45- This create tries to be as safe as possible. Yet it's not always possible to guarantee that when
46- wrapping a C library. The following assumptions are made which might not necessary be true and
45+ This crate tries to be as safe as possible. Yet it's not always possible to guarantee that when
46+ wrapping a C library. The following assumptions are made which might not necessarily be true and
4747thus might introduce unsafety:
4848
49- * [ ` Context ` ] event loop methods are borrowing ` self ` immutably considering it immutable (or
49+ * [ Context] event loop methods are borrowing ` self ` immutably considering it immutable (or
5050 more specifically having interior mutability)
5151
5252The main objects in this crate are marked as ` Send ` and it should be indeed be safe to send them
@@ -57,9 +57,9 @@ ensure that this is true.
5757## Initialization and shutdown
5858
5959You don't need to call the initialization function, it's done automatically when creating a
60- [ ` Context ` ] . Yet you might want to call the [ ` shutdown() ` ] function when your application
60+ [ Context] . Yet you might want to call the [ shutdown()] function when your application
6161terminates. Be aware though that the initialization can be called only once in the program
62- lifetime so you won't be able to use the library properly after you called [ ` shutdown() ` ] .
62+ lifetime so you won't be able to use the library properly after you called [ shutdown()] .
6363
6464
6565## Callbacks
@@ -71,12 +71,12 @@ keep the closure internally in either case, though it may not ever be called by
7171can still remove the callback with the corresponding ` *handler_delete() ` or ` *handler_clear() `
7272method.
7373
74- Due to the way the the C libstrophe library is implemented and how Rust optimizes monomorphization,
74+ Due to the way the C libstrophe library is implemented and how Rust optimizes monomorphization,
7575your callbacks must actually be compiled to different function with separate addresses when you
7676pass them to the same handler setup method. So if you want to pass 2 callbacks ` hander_add `
7777ensure that their code is unique and rust didn't merge them into a single function behind the
7878scenes. You can test whether 2 callbacks are same or not with the ` Connection::*handlers_same() `
79- family of functions. If it returns true than you will only be able to pass one of them to the
79+ family of functions. If it returns true then you will only be able to pass one of them to the
8080corresponding handler function, the other will be silently ignored.
8181
8282Due to the fact that the crate uses ` userdata ` to pass the actual user callback, it's not possible
@@ -99,7 +99,7 @@ let ctx = libstrophe::Context::new_with_default_logger();
9999let mut conn = libstrophe :: Connection :: new (ctx );
100100conn . set_jid (" example@127.0.0.1" );
101101conn . set_pass (" password" );
102- let ctx = conn . connect_client (None , None , connection_handler ). unwrap ();
102+ let mut ctx = conn . connect_client (None , None , connection_handler ). unwrap ();
103103ctx . run ();
104104libstrophe :: shutdown ();
105105```
@@ -111,20 +111,19 @@ For more complete examples see this crate `src/examples` directory and [libstrop
111111
112112The following features are provided:
113113
114- * ` rust-log ` - enabled by default, makes the create integrate into Rust logging facilities
115- * ` libstrophe-0_9_3 ` - enabled by default, enables functionality specific to libstrophe-0.9.3
116- * ` libstrophe-0_10_0 ` - enabled by default, enables functionality specific to libstrophe-0.10.0
117- * ` libstrophe-0_11_0 ` - enabled by default, enables functionality specific to libstrophe-0.11.0
118- * ` libstrophe-0_12_0 ` - enabled by default, enables functionality specific to libstrophe-0.12.0
114+ * ` rust-log ` - enabled by default, makes the crate integrate into Rust logging facilities
115+ * ` libstrophe-0_9_3 ` - enabled by default, enables functions specific to libstrophe-0.9.3
116+ * ` libstrophe-0_10_0 ` - enabled by default, enables functions specific to libstrophe-0.10
117+ * ` libstrophe-0_11_0 ` - enabled by default, enables functions specific to libstrophe-0.11
118+ * ` libstrophe-0_12_0 ` - enabled by default, enables functions specific to libstrophe-0.12
119+ * ` libstrophe-0_13 ` - enabled by default, enables functions specific to libstrophe-0.13
120+ * ` libstrophe-0_14 ` - enabled by default, enables functions specific to libstrophe-0.14
119121 * ` buildtime_bindgen ` - forces regeneration of the bindings instead of relying on the
120122 pre-generated sources
121123
122124[ libstrophe ] : https://strophe.im/libstrophe/
123125[ `log` ] : https://crates.io/crates/log
124- [ docs ] : https://strophe.im/libstrophe/doc/0.12.2 /
126+ [ docs ] : https://strophe.im/libstrophe/doc/0.13.0 /
125127[ libstrophe examples ] : https://github.com/strophe/libstrophe/tree/0.12.2/examples
126- [ `Context` ] : https://docs.rs/libstrophe/*/libstrophe/struct.Context.html
127- [ `Connection` ] : https://docs.rs/libstrophe/*/libstrophe/struct.Connection.html
128- [ `shutdown()` ] : https://docs.rs/libstrophe/*/libstrophe/fn.shutdown.html
129128
130129License: LGPL-3.0
0 commit comments