17
17
This is the official PubNub Rust SDK repository.
18
18
19
19
[ PubNub] ( https://www.pubnub.com/ ) takes care of the infrastructure and APIs needed for the realtime
20
- communication layer of your application. Work on your app's logic and let PubNub handle sending and receiving
21
- data across the world in less than 100ms.
20
+ communication layer of your application. Work on your app's logic and let
21
+ PubNub handle sending and receiving data across the world in less than
22
+ 100ms.
22
23
23
24
## Getting started
24
25
@@ -35,11 +36,11 @@ Add `pubnub` to your Rust project in the `Cargo.toml` file:
35
36
``` toml
36
37
# default features
37
38
[dependencies ]
38
- pubnub = " 0.3 .0"
39
+ pubnub = " 0.4 .0"
39
40
40
41
# all features
41
42
[dependencies ]
42
- pubnub = { version = " 0.3 .0" , features = [" full" ] }
43
+ pubnub = { version = " 0.4 .0" , features = [" full" ] }
43
44
```
44
45
45
46
### Example
@@ -125,24 +126,25 @@ You can find more examples in our [examples](https://github.com/pubnub/rust/tree
125
126
126
127
## Features
127
128
128
- The ` pubnub ` crate is split into multiple features. You can enable or disable them in the ` Cargo.toml ` file, like so:
129
+ The ` pubnub ` crate is split into multiple features. You can enable or
130
+ disable them in the ` Cargo.toml ` file, like so:
129
131
130
132
``` toml
131
133
# only blocking and access + default features
132
134
[dependencies ]
133
- pubnub = { version = " 0.3 .0" , features = [" blocking" , " access" ] }
135
+ pubnub = { version = " 0.4 .0" , features = [" blocking" , " access" ] }
134
136
135
137
# only parse_token + default features
136
138
[dependencies ]
137
- pubnub = { version = " 0.3 .0" , features = [" parse_token" ] }
139
+ pubnub = { version = " 0.4 .0" , features = [" parse_token" ] }
138
140
```
139
141
140
142
### Available features
141
143
142
144
| Feature name | Description | Available PubNub APIs |
143
145
| :------------ | :---------- | :------------- |
144
- | ` full ` | Enables all non-conflicting features | Configuration, Publish, Subscribe, Access Manager, Parse Token, Presence |
145
- | ` default ` | Enables default features: ` publish ` , ` subscribe ` , ` serde ` , ` reqwest ` , ` aescbc ` , ` std ` | Configuration, Publish, Subscribe |
146
+ | ` full ` | Enables all non-conflicting features | Configuration, Publish, Subscribe, Access Manager, Parse Token, Presence, Crypto Module |
147
+ | ` default ` | Enables default features: ` publish ` , ` subscribe ` , ` serde ` , ` reqwest ` , ` std ` | Configuration, Publish, Subscribe |
146
148
| ` publish ` | Enables Publish API | Configuration, Publish |
147
149
| ` access ` | Enables Access Manager API | Configuration, Access Manager |
148
150
| ` parse_token ` | Enables parsing Access Manager tokens | Configuration, Parse Token |
@@ -152,7 +154,7 @@ pubnub = { version = "0.3.0", features = ["parse_token"] }
152
154
| ` serde ` | Uses [ serde] ( https://github.com/serde-rs/serde ) for serialization | n/a |
153
155
| ` reqwest ` | Uses [ reqwest] ( https://github.com/seanmonstar/reqwest ) as a transport layer | n/a |
154
156
| ` blocking ` | Enables blocking executions of APIs | n/a |
155
- | ` aescbc ` | Enables AES-CBC encryption | n/a |
157
+ | ` crypto ` | Enables crypto module for data encryption and decryption | n/a |
156
158
| ` std ` | Enables ` std ` library | n/a |
157
159
158
160
## Documentation
@@ -162,52 +164,61 @@ pubnub = { version = "0.3.0", features = ["parse_token"] }
162
164
163
165
## Wasm support
164
166
165
- The ` pubnub ` crate is compatible with WebAssembly. You can use it in your Wasm project.
167
+ The ` pubnub ` crate is compatible with WebAssembly. You can use it in your
168
+ Wasm project.
166
169
167
170
## ` no_std ` support
168
171
169
- The ` pubnub ` crate is ` no_std ` compatible. To use it in a ` no_std ` environment, you have to disable the default
170
- features and enable the ones you need, for example:
172
+ The ` pubnub ` crate is ` no_std ` compatible. To use it in a ` no_std `
173
+ environment, you have to disable the default features and enable the ones
174
+ you need, for example:
171
175
172
176
``` toml
173
177
[dependencies ]
174
- pubnub = { version = " 0.3 .0" , default-features = false , features = [" serde" , " publish" ,
178
+ pubnub = { version = " 0.4 .0" , default-features = false , features = [" serde" , " publish" ,
175
179
" blocking" ] }
176
180
```
177
181
178
182
### Limitations
179
183
180
184
The ` no_std ` support is limited by the implementation details of the SDK.
181
185
182
- The SDK uses the ` alloc ` crate to allocate memory for some operations, which means that
183
- certain targets aren't supported. Additionally, as we provide a synchronous API, we use
184
- some parts of the ` alloc::sync ` module, which is also not supported in certain ` no_std ` environments.
186
+ The SDK uses the ` alloc ` crate to allocate memory for some operations, which
187
+ means that certain targets aren't supported. Additionally, as we provide a
188
+ synchronous API, we use some parts of the ` alloc::sync ` module, which is
189
+ also not supported in certain ` no_std ` environments.
185
190
186
191
Some SDK features aren't supported in a ` no_std ` environment:
187
192
188
193
* partially ` access ` module (because of lack of timestamp support)
189
- * partially ` reqwest ` transport (because of the reqwest implementation details)
190
- * partially ` subscribe ` module (because of the spawning tasks and time dependence)
191
- * partially ` presence ` module (because of the spawning tasks and time dependence)
194
+ * partially ` reqwest ` transport (because of the reqwest implementation
195
+ details)
196
+ * partially ` subscribe ` module (because of the spawning tasks and time
197
+ dependence)
198
+ * partially ` presence ` module (because of the spawning tasks and time
199
+ dependence)
192
200
* ` std ` feature (because of the ` std ` library)
193
201
194
- We depend on a random number generator to generate data for debugging purposes.
195
- If you want to use the SDK in a ` no_std ` environment, you'll have to provide
196
- your own random number generator implementation for certain targets.
202
+ We depend on a random number generator to generate data for debugging
203
+ purposes. If you want to use the SDK in a ` no_std ` environment, you'll have
204
+ to provide your own random number generator implementation for certain
205
+ targets.
197
206
198
207
See more:
199
208
200
209
* [ ` getrandom ` crate] ( https://docs.rs/getrandom/latest/getrandom/ )
201
210
* [ no_std examples] ( https://github.com/pubnub/rust/tree/master/examples/no_std/ )
202
211
203
- If you're having problems compiling this crate for more exotic targets, you can try to use the
204
- ` extra_platforms ` feature. Be aware that this feature is ** not supported** and we do not recommend using it.
212
+ If you're having problems compiling this crate for more exotic targets, you
213
+ can try to use the ` extra_platforms ` feature. Be aware that this feature is
214
+ ** not supported** and we do not recommend using it.
205
215
206
216
For more information about this feature. refer to [ Cargo.toml] ( https://github.com/pubnub/rust/blob/master/Cargo.toml ) in the ` [features] ` section.
207
217
208
218
## Support
209
219
210
- If you
** need help
** or have a
** general question
** , contact
[email protected] .
220
+ If you ** need help** or have a ** general question** , contact
221
+
211
222
212
223
## License
213
224
0 commit comments