File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 1
1
use bstr:: { BString , ByteSlice } ;
2
- use byteyarn:: Yarn ;
2
+ use byteyarn:: YarnBox ;
3
3
use gix_glob:: Pattern ;
4
4
5
5
use crate :: {
@@ -59,7 +59,7 @@ impl Outcome {
59
59
self . selected . clear ( ) ;
60
60
self . selected . extend ( attribute_names. map ( |name| {
61
61
(
62
- Yarn :: inlined ( name) . unwrap_or_else ( || name . to_string ( ) . into_boxed_str ( ) . into ( ) ) ,
62
+ YarnBox :: new ( name) . immortalize ( ) ,
63
63
collection. name_to_meta . get ( name) . map ( |meta| meta. id ) ,
64
64
)
65
65
} ) ) ;
@@ -315,7 +315,7 @@ impl MetadataCollection {
315
315
None => {
316
316
let order = AttributeId ( self . name_to_meta . len ( ) ) ;
317
317
self . name_to_meta . insert (
318
- Yarn :: inlined ( name) . unwrap_or_else ( || name . to_string ( ) . into_boxed_str ( ) . into ( ) ) ,
318
+ YarnBox :: new ( name) . immortalize ( ) ,
319
319
Metadata {
320
320
id : order,
321
321
macro_attributes : Default :: default ( ) ,
@@ -335,10 +335,7 @@ impl MetadataCollection {
335
335
Some ( meta) => meta. id ,
336
336
None => {
337
337
let order = AttributeId ( self . name_to_meta . len ( ) ) ;
338
- self . name_to_meta . insert (
339
- Yarn :: inlined ( name) . unwrap_or_else ( || name. to_string ( ) . into_boxed_str ( ) . into ( ) ) ,
340
- order. into ( ) ,
341
- ) ;
338
+ self . name_to_meta . insert ( YarnBox :: new ( name) . immortalize ( ) , order. into ( ) ) ;
342
339
order
343
340
}
344
341
}
Original file line number Diff line number Diff line change 1
1
use bstr:: { BStr , ByteSlice } ;
2
- use byteyarn:: { ByteYarn , YarnRef } ;
2
+ use byteyarn:: { ByteYarn , YarnBox , YarnRef } ;
3
3
4
4
use crate :: { State , StateRef } ;
5
5
@@ -49,10 +49,7 @@ impl<'a> From<ValueRef<'a>> for Value {
49
49
50
50
impl From < & str > for Value {
51
51
fn from ( v : & str ) -> Self {
52
- Value (
53
- ByteYarn :: inlined ( v. as_bytes ( ) )
54
- . unwrap_or_else ( || ByteYarn :: from_boxed_bytes ( v. as_bytes ( ) . to_vec ( ) . into_boxed_slice ( ) ) ) ,
55
- )
52
+ Value ( YarnBox :: new ( v) . immortalize ( ) . into ( ) )
56
53
}
57
54
}
58
55
You can’t perform that action at this time.
0 commit comments