<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wiki.squi.fr/index.php?action=history&amp;feed=atom&amp;title=Rust_%3A_if_let</id>
	<title>Rust : if let - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.squi.fr/index.php?action=history&amp;feed=atom&amp;title=Rust_%3A_if_let"/>
	<link rel="alternate" type="text/html" href="https://wiki.squi.fr/index.php?title=Rust_:_if_let&amp;action=history"/>
	<updated>2026-06-12T02:37:15Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.squi.fr/index.php?title=Rust_:_if_let&amp;diff=2361&amp;oldid=prev</id>
		<title>Justine le 3 novembre 2022 à 09:19</title>
		<link rel="alternate" type="text/html" href="https://wiki.squi.fr/index.php?title=Rust_:_if_let&amp;diff=2361&amp;oldid=prev"/>
		<updated>2022-11-03T09:19:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 3 novembre 2022 à 09:19&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Ligne 1 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 1 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/del&gt;&amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight lang=&#039;rust&#039;&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;fn main() {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;fn main() {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     //if let est une syntaxe spéciale qui permet de simplifier&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     //if let est une syntaxe spéciale qui permet de simplifier&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l35&quot;&gt;Ligne 35 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 35 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Justine</name></author>
	</entry>
	<entry>
		<id>https://wiki.squi.fr/index.php?title=Rust_:_if_let&amp;diff=2353&amp;oldid=prev</id>
		<title>Justine : Page créée avec «  &lt;nowiki&gt; fn main() {     //if let est une syntaxe spéciale qui permet de simplifier      //Prenons un exemple un peu verbeux     //on veut juste savoir si la variable est pas vide     let config_max = Some(3u8);     match config_max {         Some(max) =&gt; println!(&quot;The maximum is configured to be {}&quot;, max),         _ =&gt; (),     }      //On peut simplifier:     let conf_max = Some(30u8);     if let Some(max) = conf_max {         println!(&quot;The maximum is configur... »</title>
		<link rel="alternate" type="text/html" href="https://wiki.squi.fr/index.php?title=Rust_:_if_let&amp;diff=2353&amp;oldid=prev"/>
		<updated>2022-11-03T09:14:13Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec «  &amp;lt;nowiki&amp;gt; fn main() {     //if let est une syntaxe spéciale qui permet de simplifier      //Prenons un exemple un peu verbeux     //on veut juste savoir si la variable est pas vide     let config_max = Some(3u8);     match config_max {         Some(max) =&amp;gt; println!(&amp;quot;The maximum is configured to be {}&amp;quot;, max),         _ =&amp;gt; (),     }      //On peut simplifier:     let conf_max = Some(30u8);     if let Some(max) = conf_max {         println!(&amp;quot;The maximum is configur... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt; &amp;lt;nowiki&amp;gt;&lt;br /&gt;
fn main() {&lt;br /&gt;
    //if let est une syntaxe spéciale qui permet de simplifier&lt;br /&gt;
&lt;br /&gt;
    //Prenons un exemple un peu verbeux&lt;br /&gt;
    //on veut juste savoir si la variable est pas vide&lt;br /&gt;
    let config_max = Some(3u8);&lt;br /&gt;
    match config_max {&lt;br /&gt;
        Some(max) =&amp;gt; println!(&amp;quot;The maximum is configured to be {}&amp;quot;, max),&lt;br /&gt;
        _ =&amp;gt; (),&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //On peut simplifier:&lt;br /&gt;
    let conf_max = Some(30u8);&lt;br /&gt;
    if let Some(max) = conf_max {&lt;br /&gt;
        println!(&amp;quot;The maximum is configured to be {}&amp;quot;, max);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //Même chose avec du else en plus&lt;br /&gt;
    //(..reprend l&amp;#039;exemple pour les matches, avec les enum Coin etc)&lt;br /&gt;
    //On simplifie ça...&lt;br /&gt;
    let mut count = 0;&lt;br /&gt;
    match coin {&lt;br /&gt;
        Coin::Quarter(state) =&amp;gt; println!(&amp;quot;State quarter from {:?}!&amp;quot;, state),&lt;br /&gt;
        _ =&amp;gt; count += 1,&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    //...en ça&lt;br /&gt;
    let mut count = 0;&lt;br /&gt;
    if let Coin::Quarter(state) = coin {&lt;br /&gt;
        println!(&amp;quot;State quarter from {:?}!&amp;quot;, state);&lt;br /&gt;
    } else {&lt;br /&gt;
        count += 1;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Justine</name></author>
	</entry>
</feed>