@@ -107,7 +107,8 @@ impl Keyring {
107
107
/// Requests a keyring with the given description by searching the thread, process, and session
108
108
/// keyrings.
109
109
pub fn request < D > ( description : D ) -> Result < Self >
110
- where D : AsRef < str > ,
110
+ where
111
+ D : AsRef < str > ,
111
112
{
112
113
Keyring :: new_impl ( 0 ) . request_keyring ( description)
113
114
}
@@ -118,8 +119,9 @@ impl Keyring {
118
119
/// If it is not found, the `info` string will be handed off to `/sbin/request-key` to generate
119
120
/// the key.
120
121
pub fn request_with_fallback < D , I > ( description : D , info : I ) -> Result < Self >
121
- where D : AsRef < str > ,
122
- I : AsRef < str > ,
122
+ where
123
+ D : AsRef < str > ,
124
+ I : AsRef < str > ,
123
125
{
124
126
Keyring :: new_impl ( 0 ) . request_keyring_with_fallback ( description, info)
125
127
}
@@ -150,7 +152,8 @@ impl Keyring {
150
152
/// If a keyring named `name` exists, attach it as the session keyring (requires the `search`
151
153
/// permission). If a keyring does not exist, create it and attach it as the session keyring.
152
154
pub fn join_session < N > ( name : N ) -> Result < Self >
153
- where N : AsRef < str > ,
155
+ where
156
+ N : AsRef < str > ,
154
157
{
155
158
let name_cstr = CString :: new ( name. as_ref ( ) ) . unwrap ( ) ;
156
159
let res = unsafe { keyctl_join_session_keyring ( name_cstr. as_ptr ( ) ) } ;
@@ -208,7 +211,8 @@ impl Keyring {
208
211
/// `link` permission on the key exist) and return it. Requires the `search` permission on the
209
212
/// keyring. Any children keyrings without the `search` permission are ignored.
210
213
pub fn search_for_key < D > ( & self , description : D ) -> Result < Key >
211
- where D : AsRef < str > ,
214
+ where
215
+ D : AsRef < str > ,
212
216
{
213
217
let res = self . search_impl ( "user" , description. as_ref ( ) ) ?;
214
218
check_call ( res, Key :: new_impl ( res as key_serial_t ) )
@@ -221,7 +225,8 @@ impl Keyring {
221
225
/// permission on the keyring. Any children keyrings without the `search` permission are
222
226
/// ignored.
223
227
pub fn search_for_keyring < D > ( & self , description : D ) -> Result < Self >
224
- where D : AsRef < str > ,
228
+ where
229
+ D : AsRef < str > ,
225
230
{
226
231
let res = self . search_impl ( "keyring" , description. as_ref ( ) ) ?;
227
232
check_call ( res, Keyring :: new_impl ( res as key_serial_t ) )
@@ -294,7 +299,8 @@ impl Keyring {
294
299
/// If a keyring with the same description already, the link to the old keyring will be
295
300
/// removed. Requires `write` permission on the keyring.
296
301
pub fn add_keyring < D > ( & mut self , description : D ) -> Result < Self >
297
- where D : Borrow < <keytypes:: Keyring as KeyType >:: Description > ,
302
+ where
303
+ D : Borrow < <keytypes:: Keyring as KeyType >:: Description > ,
298
304
{
299
305
let key = self . add_key :: < keytypes:: Keyring , _ , _ > ( description, ( ) ) ?;
300
306
Ok ( Keyring :: new_impl ( key. id ) )
@@ -313,7 +319,8 @@ impl Keyring {
313
319
///
314
320
/// If it is found, it is attached to the keyring.
315
321
pub fn request_key < D > ( & self , description : D ) -> Result < Key >
316
- where D : AsRef < str > ,
322
+ where
323
+ D : AsRef < str > ,
317
324
{
318
325
let res = self . request_impl ( "user" , description. as_ref ( ) ) ?;
319
326
check_call ( i64:: from ( res) , Key :: new_impl ( res) )
@@ -324,7 +331,8 @@ impl Keyring {
324
331
///
325
332
/// If it is found, it is attached to the keyring.
326
333
pub fn request_keyring < D > ( & self , description : D ) -> Result < Self >
327
- where D : AsRef < str > ,
334
+ where
335
+ D : AsRef < str > ,
328
336
{
329
337
let res = self . request_impl ( "keyring" , description. as_ref ( ) ) ?;
330
338
check_call ( i64:: from ( res) , Keyring :: new_impl ( res) )
@@ -349,8 +357,9 @@ impl Keyring {
349
357
/// the key. If found, it will be attached to the current keyring. Requires `write` permission
350
358
/// to the keyring.
351
359
pub fn request_key_with_fallback < D , I > ( & self , description : D , info : I ) -> Result < Key >
352
- where D : AsRef < str > ,
353
- I : AsRef < str > ,
360
+ where
361
+ D : AsRef < str > ,
362
+ I : AsRef < str > ,
354
363
{
355
364
let res = self . request_fallback_impl ( "user" , description. as_ref ( ) , info. as_ref ( ) ) ?;
356
365
check_call ( i64:: from ( res) , Key :: new_impl ( res) )
@@ -363,8 +372,9 @@ impl Keyring {
363
372
/// the key. If found, it will be attached to the current keyring. Requires `write` permission
364
373
/// to the keyring.
365
374
pub fn request_keyring_with_fallback < D , I > ( & self , description : D , info : I ) -> Result < Self >
366
- where D : AsRef < str > ,
367
- I : AsRef < str > ,
375
+ where
376
+ D : AsRef < str > ,
377
+ I : AsRef < str > ,
368
378
{
369
379
let res = self . request_fallback_impl ( "keyring" , description. as_ref ( ) , info. as_ref ( ) ) ?;
370
380
check_call ( i64:: from ( res) , Keyring :: new_impl ( res) )
@@ -484,7 +494,8 @@ impl Key {
484
494
/// Requests a key with the given description by searching the thread, process, and session
485
495
/// keyrings.
486
496
pub fn request < D > ( description : D ) -> Result < Self >
487
- where D : AsRef < str > ,
497
+ where
498
+ D : AsRef < str > ,
488
499
{
489
500
Keyring :: new_impl ( 0 ) . request_key ( description)
490
501
}
@@ -495,15 +506,17 @@ impl Key {
495
506
/// If it is not found, the `info` string will be handed off to `/sbin/request-key` to generate
496
507
/// the key.
497
508
pub fn request_with_fallback < D , I > ( description : D , info : I ) -> Result < Self >
498
- where D : AsRef < str > ,
499
- I : AsRef < str > ,
509
+ where
510
+ D : AsRef < str > ,
511
+ I : AsRef < str > ,
500
512
{
501
513
Keyring :: new_impl ( 0 ) . request_key_with_fallback ( description, info)
502
514
}
503
515
504
516
/// Update the payload in the key.
505
517
pub fn update < D > ( & mut self , data : D ) -> Result < ( ) >
506
- where D : AsRef < [ u8 ] > ,
518
+ where
519
+ D : AsRef < [ u8 ] > ,
507
520
{
508
521
let data = data. as_ref ( ) ;
509
522
check_call ( unsafe {
@@ -664,7 +677,8 @@ impl KeyManager {
664
677
665
678
/// Instantiate the key with the given payload.
666
679
pub fn instantiate < P > ( self , keyring : & Keyring , payload : P ) -> Result < ( ) >
667
- where P : AsRef < [ u8 ] > ,
680
+ where
681
+ P : AsRef < [ u8 ] > ,
668
682
{
669
683
let payload = payload. as_ref ( ) ;
670
684
check_call ( unsafe {
0 commit comments