@@ -18,6 +18,9 @@ use anyhow::Result;
1818#[ derive( Clone , Debug , Default ) ]
1919pub struct Cmdline < ' a > ( Cow < ' a , [ u8 ] > ) ;
2020
21+ /// An owned Cmdline. Alias for `Cmdline<'static>`.
22+ pub type CmdlineOwned = Cmdline < ' static > ;
23+
2124impl < ' a , T : AsRef < [ u8 ] > + ?Sized > From < & ' a T > for Cmdline < ' a > {
2225 /// Creates a new `Cmdline` from any type that can be referenced as bytes.
2326 ///
@@ -27,7 +30,7 @@ impl<'a, T: AsRef<[u8]> + ?Sized> From<&'a T> for Cmdline<'a> {
2730 }
2831}
2932
30- impl < ' a > From < Vec < u8 > > for Cmdline < ' a > {
33+ impl From < Vec < u8 > > for CmdlineOwned {
3134 /// Creates a new `Cmdline` from an owned `Vec<u8>`.
3235 fn from ( input : Vec < u8 > ) -> Self {
3336 Self ( Cow :: Owned ( input) )
@@ -85,7 +88,7 @@ impl<'a> Cmdline<'a> {
8588 /// Creates a new empty owned `Cmdline`.
8689 ///
8790 /// This is equivalent to `Cmdline::default()` but makes ownership explicit.
88- pub fn new ( ) -> Cmdline < ' static > {
91+ pub fn new ( ) -> CmdlineOwned {
8992 Cmdline :: default ( )
9093 }
9194
@@ -670,8 +673,8 @@ mod tests {
670673 assert_eq ! ( kargs. iter( ) . next( ) , None ) ;
671674 assert ! ( kargs. is_owned( ) ) ;
672675
673- // Verify we can store it in a 'static context
674- let _static_kargs: Cmdline < ' static > = Cmdline :: new ( ) ;
676+ // Verify we can store it in an owned ( 'static) context
677+ let _static_kargs: CmdlineOwned = Cmdline :: new ( ) ;
675678 }
676679
677680 #[ test]
0 commit comments