@@ -25,8 +25,7 @@ use std::io::Write;
25
25
///
26
26
/// ```
27
27
/// use std::io::Write;
28
- /// use sio::{Key, Nonce, Aad, EncWriter, Close};
29
- /// use sio::ring::AES_256_GCM;
28
+ /// use sio::{Key, Nonce, Aad, EncWriter, Close, AES_256_GCM};
30
29
///
31
30
/// // Load your secret keys from a secure location or derive
32
31
/// // them using a secure (password-based) key-derivation-function, like Argon2id.
@@ -87,8 +86,7 @@ impl<A: Algorithm, W: Write> EncWriter<A, W> {
87
86
///
88
87
/// ```
89
88
/// use std::io::Write;
90
- /// use sio::{Key, Nonce, Aad, EncWriter, Close};
91
- /// use sio::ring::AES_256_GCM;
89
+ /// use sio::{Key, Nonce, Aad, EncWriter, Close, AES_256_GCM};
92
90
///
93
91
/// // Load your secret keys from a secure location or derive
94
92
/// // them using a secure (password-based) key-derivation-function, like Argon2id.
@@ -135,8 +133,7 @@ impl<A: Algorithm, W: Write> EncWriter<A, W> {
135
133
///
136
134
/// ```
137
135
/// use std::io::Write;
138
- /// use sio::{Key, Nonce, Aad, EncWriter, Close};
139
- /// use sio::ring::AES_256_GCM;
136
+ /// use sio::{Key, Nonce, Aad, EncWriter, Close, AES_256_GCM};
140
137
///
141
138
/// // Load your secret keys from a secure location or derive
142
139
/// // them using a secure (password-based) key-derivation-function, like Argon2id.
@@ -282,19 +279,19 @@ impl<A: Algorithm, W: Write> Drop for EncWriter<A, W> {
282
279
// - we encountered an error during a write or flush call.
283
280
if !self . panicked && !self . errored {
284
281
// For debugging purposes, we allow disabling the panic
285
- // for debug builds - but only if the feature "must_close "
286
- // (enabled by default) is turned off .
287
- if !( cfg ! ( debug_assertions) && ! cfg ! ( feature = "must_close " ) ) {
282
+ // for debug builds - but only if the feature "debug_panic "
283
+ // is turned on .
284
+ if !( cfg ! ( debug_assertions) && cfg ! ( feature = "debug_panic " ) ) {
288
285
// Actually, Drop implementations should not panic.
289
286
// However, not closing the EncWriter (see: close())
290
287
// implies not encrypting the entire plaintext such that
291
288
// the ciphertext written to the inner writer cannot be
292
289
// decrypted anymore. Consequently, we would "loose" data.
293
290
//
294
291
// We could call close() here if it hasn't been called explicitly
295
- // by callers but that would only succeed if the no other I/O error
292
+ // by callers but that would only succeed if no other I/O error
296
293
// occurs. Otherwise, we are in the same situation as before. Calling
297
- // close() here would an optimistic approach - while in cryptography
294
+ // close() here would be an optimistic approach - while in cryptography
298
295
// we have to be pessimistic.
299
296
assert ! (
300
297
self . closed,
@@ -328,8 +325,7 @@ impl<A: Algorithm, W: Write> Drop for EncWriter<A, W> {
328
325
///
329
326
/// ```
330
327
/// use std::io::Write;
331
- /// use sio::{Key, Nonce, Aad, DecWriter, Close};
332
- /// use sio::ring::AES_256_GCM;
328
+ /// use sio::{Key, Nonce, Aad, DecWriter, Close, AES_256_GCM};
333
329
///
334
330
/// // Load your secret keys from a secure location or derive
335
331
/// // them using a secure (password-based) key-derivation-function, like Argon2id.
@@ -390,8 +386,7 @@ impl<A: Algorithm, W: Write> DecWriter<A, W> {
390
386
///
391
387
/// ```
392
388
/// use std::io::Write;
393
- /// use sio::{Key, Nonce, Aad, DecWriter, Close};
394
- /// use sio::ring::AES_256_GCM;
389
+ /// use sio::{Key, Nonce, Aad, DecWriter, Close, AES_256_GCM};
395
390
///
396
391
/// // Load your secret keys from a secure location or derive
397
392
/// // them using a secure (password-based) key-derivation-function, like Argon2id.
@@ -441,8 +436,7 @@ impl<A: Algorithm, W: Write> DecWriter<A, W> {
441
436
///
442
437
/// ```
443
438
/// use std::io::Write;
444
- /// use sio::{Key, Nonce, Aad, DecWriter, Close};
445
- /// use sio::ring::AES_256_GCM;
439
+ /// use sio::{Key, Nonce, Aad, DecWriter, Close, AES_256_GCM};
446
440
///
447
441
/// // Load your secret keys from a secure location or derive
448
442
/// // them using a secure (password-based) key-derivation-function, like Argon2id.
@@ -588,9 +582,9 @@ impl<A: Algorithm, W: Write> Drop for DecWriter<A, W> {
588
582
// - we encountered an error during a write or flush call.
589
583
if !self . panicked && !self . errored {
590
584
// For debugging purposes,we allow disabling the panic
591
- // for debug builds - but only if the feature "must_close "
592
- // (enabled by default) is turned off .
593
- if !( cfg ! ( debug_assertions) && ! cfg ! ( feature = "must_close " ) ) {
585
+ // for debug builds - but only if the feature "debug_panic "
586
+ // is turned on .
587
+ if !( cfg ! ( debug_assertions) && cfg ! ( feature = "debug_panic " ) ) {
594
588
// Actually, Drop implementations should not panic.
595
589
// However, not closing the DecWriter (see: close())
596
590
// implies not decrypting the entire ciphertext and
@@ -602,7 +596,7 @@ impl<A: Algorithm, W: Write> Drop for DecWriter<A, W> {
602
596
// by callers but that would only succeed if the ciphertext
603
597
// is authentic and no other I/O error occurs. Otherwise, we
604
598
// are in the same situation as before. Calling close() here
605
- // would an optimistic approach - while in cryptography we have
599
+ // would be an optimistic approach - while in cryptography we have
606
600
// to be pessimistic.
607
601
assert ! (
608
602
self . closed,
0 commit comments