@@ -23,10 +23,10 @@ pub struct BbcodeTag<'a> {
2323 name : & ' a str ,
2424
2525 /// A simple parameter for the tag, e.g. `value` for `[tag=value]something[/tag]`.
26- simple_param : Option < String > ,
26+ simple_param : Option < Cow < ' a , str > > ,
2727
2828 /// Complex parameters, e.g. the map `value1` -> `xxx`, `value2` -> `yyy` for `[tag value1=”xxx” value2=”yyy”]something[/tag]`.
29- complex_params : HashMap < String , String > ,
29+ complex_params : HashMap < Cow < ' a , str > , Cow < ' a , str > > ,
3030
3131 /// The child nodes (or text) contained inside this node.
3232 children : Vec < Arc < BbcodeNode < ' a > > > ,
@@ -51,14 +51,14 @@ impl<'a> BbcodeTag<'a> {
5151 }
5252
5353 /// Add a simple parameter to the tag.
54- pub fn add_simple_param < P : Into < String > > ( & mut self , tag_param : P ) -> & mut Self {
54+ pub fn add_simple_param < P : Into < Cow < ' a , str > > > ( & mut self , tag_param : P ) -> & mut Self {
5555 self . simple_param = Some ( tag_param. into ( ) ) ;
5656 self
5757 }
5858
5959 /// Add a key/value parameter.
6060 #[ cfg( test) ]
61- pub fn with_param < K : Into < String > , V : Into < String > > ( mut self , key : K , value : V ) -> Self {
61+ pub fn with_param < K : Into < & ' a str > , V : Into < Cow < ' a , str > > > ( mut self , key : K , value : V ) -> Self {
6262 self . complex_params . insert ( key. into ( ) , value. into ( ) ) ;
6363 self
6464 }
@@ -89,7 +89,7 @@ impl<'a> BbcodeTag<'a> {
8989 }
9090
9191 /// If it exists, the simple tag parameter of this tag.
92- pub fn simple_param ( & self ) -> & Option < String > {
92+ pub fn simple_param ( & self ) -> & Option < Cow < ' a , str > > {
9393 & self . simple_param
9494 }
9595}
0 commit comments