@@ -59,7 +59,7 @@ pub mod flags {
5959pub struct DiameterMessage {
6060 header : DiameterHeader ,
6161 avps : Vec < Avp > ,
62- dictionary : Arc < Dictionary > ,
62+ dict : Arc < Dictionary > ,
6363}
6464
6565/// Represents the header part of a Diameter message.
@@ -115,7 +115,7 @@ impl DiameterMessage {
115115 flags : u8 ,
116116 hop_by_hop_id : u32 ,
117117 end_to_end_id : u32 ,
118- dictionary : Arc < Dictionary > ,
118+ dict : Arc < Dictionary > ,
119119 ) -> DiameterMessage {
120120 let header = DiameterHeader {
121121 version : 1 ,
@@ -127,11 +127,7 @@ impl DiameterMessage {
127127 end_to_end_id,
128128 } ;
129129 let avps = Vec :: new ( ) ;
130- DiameterMessage {
131- header,
132- avps,
133- dictionary,
134- }
130+ DiameterMessage { header, avps, dict }
135131 }
136132
137133 /// Returns a reference to the AVP with the specified code,
@@ -153,13 +149,13 @@ impl DiameterMessage {
153149
154150 // Adds an AVP to the message with the specified parameters.
155151 pub fn add_avp ( & mut self , code : u32 , vendor_id : Option < u32 > , flags : u8 , value : AvpValue ) {
156- let avp = Avp :: new ( code, vendor_id, flags, value, Arc :: clone ( & self . dictionary ) ) ;
152+ let avp = Avp :: new ( code, vendor_id, flags, value, Arc :: clone ( & self . dict ) ) ;
157153 self . add ( avp) ;
158154 }
159155
160156 /// Adds an AVP to the message by name.
161157 pub fn add_avp_by_name ( & mut self , avp_name : & str , value : AvpValue ) -> Result < ( ) > {
162- let avp = Avp :: from_name ( avp_name, value, Arc :: clone ( & self . dictionary ) ) ?;
158+ let avp = Avp :: from_name ( avp_name, value, Arc :: clone ( & self . dict ) ) ?;
163159 self . add ( avp) ;
164160 Ok ( ( ) )
165161 }
@@ -218,11 +214,7 @@ impl DiameterMessage {
218214 ) ) ;
219215 }
220216
221- Ok ( DiameterMessage {
222- header,
223- avps,
224- dictionary : dict,
225- } )
217+ Ok ( DiameterMessage { header, avps, dict } )
226218 }
227219
228220 /// Encodes the Diameter message to the given writer.
@@ -247,7 +239,7 @@ impl DiameterMessage {
247239 ) ?;
248240
249241 for avp in & self . avps {
250- avp. fmt ( f, depth, self . dictionary . as_ref ( ) ) ?;
242+ avp. fmt ( f, depth) ?;
251243 write ! ( f, "\n " ) ?;
252244 }
253245
0 commit comments