Project

General

Profile

Optimization #4497

Updated by Victor Julien over 3 years ago

Older code uses a lot of: 
 <pre><code class="c"> 
 impl SMBVerCmdStat { 
     pub fn new() -> SMBVerCmdStat { 
         return SMBVerCmdStat { 
             ... 
 </code></pre> 
 Newer code uses @Self@: 
 <pre><code class="c"> 
 impl RdpTransaction { 
     fn new(id: u64, item: RdpTransactionItem) -> Self { 
         Self { 
            ... 
 </code></pre> 
 Or even the @Default@ logic log like in: 
 <pre><code class="c"> 
 pub struct IKEState { 
     tx_id: u64, 
     pub transactions: Vec<IKETransaction>, 

     pub ikev1_container: Ikev1Container, 
     pub ikev2_container: Ikev2Container, 
 } 
 </code></pre> 

 By switching to Default by default we can clean things up, and where @Default@ isn't feasible the use of @Self@ is preferred.

Back