File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 47
47
- run : cargo test --verbose --features kv
48
48
- run : cargo test --verbose --features kv_sval
49
49
- run : cargo test --verbose --features kv_serde
50
+ - run : cargo test --verbose --features kv,std
50
51
- run : cargo test --verbose --features "kv kv_std kv_sval kv_serde"
51
52
- run : cargo run --verbose --manifest-path test_max_level_features/Cargo.toml
52
53
- run : cargo run --verbose --manifest-path test_max_level_features/Cargo.toml --release
Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ impl<'v> Value<'v> {
385
385
}
386
386
}
387
387
388
- #[ cfg( feature = "kv_std " ) ]
388
+ #[ cfg( feature = "std " ) ]
389
389
mod std_support {
390
390
use std:: borrow:: Cow ;
391
391
use std:: rc:: Rc ;
@@ -432,20 +432,29 @@ mod std_support {
432
432
}
433
433
}
434
434
435
- impl < ' v > Value < ' v > {
436
- /// Try to convert this value into a string.
437
- pub fn to_cow_str ( & self ) -> Option < Cow < ' v , str > > {
438
- self . inner . to_str ( )
439
- }
440
- }
441
-
442
435
impl < ' v > From < & ' v String > for Value < ' v > {
443
436
fn from ( v : & ' v String ) -> Self {
444
437
Value :: from ( & * * v)
445
438
}
446
439
}
447
440
}
448
441
442
+ #[ cfg( all( feature = "std" , feature = "value-bag" ) ) ]
443
+ impl < ' v > Value < ' v > {
444
+ /// Try to convert this value into a string.
445
+ pub fn to_cow_str ( & self ) -> Option < std:: borrow:: Cow < ' v , str > > {
446
+ self . inner . to_str ( )
447
+ }
448
+ }
449
+
450
+ #[ cfg( all( feature = "std" , not( feature = "value-bag" ) ) ) ]
451
+ impl < ' v > Value < ' v > {
452
+ /// Try to convert this value into a string.
453
+ pub fn to_cow_str ( & self ) -> Option < std:: borrow:: Cow < ' v , str > > {
454
+ self . inner . to_borrowed_str ( ) . map ( std:: borrow:: Cow :: Borrowed )
455
+ }
456
+ }
457
+
449
458
/// A visitor for a [`Value`].
450
459
///
451
460
/// Also see [`Value`'s documentation on seralization]. Value visitors are a simple alternative
You can’t perform that action at this time.
0 commit comments