diff --git a/functional/generics-type-classes.html b/functional/generics-type-classes.html index 8342378..684bdfb 100644 --- a/functional/generics-type-classes.html +++ b/functional/generics-type-classes.html @@ -387,7 +387,7 @@ concept, and a slightly different technique. See: impl<T> From<Vec<T, Global>> for BinaryHeap<T>
Example: diff --git a/print.html b/print.html index c5449d9..2ed8ce7 100644 --- a/print.html +++ b/print.html @@ -3514,7 +3514,7 @@ concept, and a slightly different technique. See: impl<T> From<Vec<T, Global>> for BinaryHeap<T>
Example:
diff --git a/searchindex.js b/searchindex.js
index a958678..039fa68 100644
--- a/searchindex.js
+++ b/searchindex.js
@@ -1 +1 @@
-Object.assign(window.search, {"doc_urls":["intro.html#introduction","intro.html#participation","intro.html#design-patterns","intro.html#design-patterns-in-rust","idioms/index.html#idioms","idioms/coercion-arguments.html#use-borrowed-types-for-arguments","idioms/coercion-arguments.html#description","idioms/coercion-arguments.html#example","idioms/coercion-arguments.html#see-also","idioms/concat-format.html#concatenating-strings-with-format","idioms/concat-format.html#description","idioms/concat-format.html#example","idioms/concat-format.html#advantages","idioms/concat-format.html#disadvantages","idioms/ctor.html#constructors","idioms/ctor.html#description","idioms/ctor.html#example","idioms/ctor.html#see-also","idioms/default.html#the-default-trait","idioms/default.html#description","idioms/default.html#example","idioms/default.html#see-also","idioms/deref.html#collections-are-smart-pointers","idioms/deref.html#description","idioms/deref.html#example","idioms/deref.html#motivation","idioms/deref.html#advantages","idioms/deref.html#disadvantages","idioms/deref.html#discussion","idioms/deref.html#see-also","idioms/dtor-finally.html#finalisation-in-destructors","idioms/dtor-finally.html#description","idioms/dtor-finally.html#example","idioms/dtor-finally.html#motivation","idioms/dtor-finally.html#advantages","idioms/dtor-finally.html#disadvantages","idioms/dtor-finally.html#discussion","idioms/dtor-finally.html#see-also","idioms/mem-replace.html#memtake_-replace_-to-keep-owned-values-in-changed-enums","idioms/mem-replace.html#description","idioms/mem-replace.html#example","idioms/mem-replace.html#motivation","idioms/mem-replace.html#advantages","idioms/mem-replace.html#disadvantages","idioms/mem-replace.html#discussion","idioms/mem-replace.html#see-also","idioms/on-stack-dyn-dispatch.html#on-stack-dynamic-dispatch","idioms/on-stack-dyn-dispatch.html#description","idioms/on-stack-dyn-dispatch.html#example","idioms/on-stack-dyn-dispatch.html#motivation","idioms/on-stack-dyn-dispatch.html#advantages","idioms/on-stack-dyn-dispatch.html#disadvantages","idioms/on-stack-dyn-dispatch.html#discussion","idioms/on-stack-dyn-dispatch.html#see-also","idioms/ffi/intro.html#ffi-idioms","idioms/ffi/errors.html#error-handling-in-ffi","idioms/ffi/errors.html#description","idioms/ffi/errors.html#code-example","idioms/ffi/errors.html#flat-enums","idioms/ffi/errors.html#structured-enums","idioms/ffi/errors.html#custom-error-types","idioms/ffi/errors.html#advantages","idioms/ffi/errors.html#disadvantages","idioms/ffi/accepting-strings.html#accepting-strings","idioms/ffi/accepting-strings.html#description","idioms/ffi/accepting-strings.html#motivation","idioms/ffi/accepting-strings.html#code-example","idioms/ffi/accepting-strings.html#advantages","idioms/ffi/accepting-strings.html#disadvantages","idioms/ffi/passing-strings.html#passing-strings","idioms/ffi/passing-strings.html#description","idioms/ffi/passing-strings.html#motivation","idioms/ffi/passing-strings.html#code-example","idioms/ffi/passing-strings.html#advantages","idioms/ffi/passing-strings.html#disadvantages","idioms/option-iter.html#iterating-over-an-option","idioms/option-iter.html#description","idioms/option-iter.html#examples","idioms/option-iter.html#see-also","idioms/pass-var-to-closure.html#pass-variables-to-closure","idioms/pass-var-to-closure.html#description","idioms/pass-var-to-closure.html#example","idioms/pass-var-to-closure.html#advantages","idioms/pass-var-to-closure.html#disadvantages","idioms/priv-extend.html#non_exhaustive-and-private-fields-for-extensibility","idioms/priv-extend.html#description","idioms/priv-extend.html#example","idioms/priv-extend.html#alternative-private-fields-for-structs","idioms/priv-extend.html#discussion","idioms/priv-extend.html#disadvantages","idioms/priv-extend.html#see-also","idioms/rustdoc-init.html#easy-doc-initialization","idioms/rustdoc-init.html#description","idioms/rustdoc-init.html#motivation","idioms/rustdoc-init.html#example","idioms/rustdoc-init.html#advantages","idioms/rustdoc-init.html#disadvantages","idioms/rustdoc-init.html#discussion","idioms/temporary-mutability.html#temporary-mutability","idioms/temporary-mutability.html#description","idioms/temporary-mutability.html#example","idioms/temporary-mutability.html#advantages","idioms/temporary-mutability.html#disadvantages","patterns/index.html#design-patterns","patterns/index.html#design-patterns-in-rust","patterns/index.html#yagni","patterns/behavioural/intro.html#behavioural-patterns","patterns/behavioural/command.html#command","patterns/behavioural/command.html#description","patterns/behavioural/command.html#motivation","patterns/behavioural/command.html#example","patterns/behavioural/command.html#approach-using-trait-objects","patterns/behavioural/command.html#approach-using-function-pointers","patterns/behavioural/command.html#approach-using-fn-trait-objects","patterns/behavioural/command.html#discussion","patterns/behavioural/command.html#see-also","patterns/behavioural/interpreter.html#interpreter","patterns/behavioural/interpreter.html#description","patterns/behavioural/interpreter.html#motivation","patterns/behavioural/interpreter.html#context-free-grammar-for-our-problem","patterns/behavioural/interpreter.html#solution","patterns/behavioural/interpreter.html#discussion","patterns/behavioural/interpreter.html#see-also","patterns/behavioural/newtype.html#newtype","patterns/behavioural/newtype.html#description","patterns/behavioural/newtype.html#example","patterns/behavioural/newtype.html#motivation","patterns/behavioural/newtype.html#advantages","patterns/behavioural/newtype.html#disadvantages","patterns/behavioural/newtype.html#discussion","patterns/behavioural/newtype.html#see-also","patterns/behavioural/RAII.html#raii-with-guards","patterns/behavioural/RAII.html#description","patterns/behavioural/RAII.html#example","patterns/behavioural/RAII.html#motivation","patterns/behavioural/RAII.html#advantages","patterns/behavioural/RAII.html#discussion","patterns/behavioural/RAII.html#see-also","patterns/behavioural/strategy.html#strategy-aka-policy","patterns/behavioural/strategy.html#description","patterns/behavioural/strategy.html#motivation","patterns/behavioural/strategy.html#example","patterns/behavioural/strategy.html#advantages","patterns/behavioural/strategy.html#disadvantages","patterns/behavioural/strategy.html#discussion","patterns/behavioural/strategy.html#see-also","patterns/behavioural/visitor.html#visitor","patterns/behavioural/visitor.html#description","patterns/behavioural/visitor.html#example","patterns/behavioural/visitor.html#motivation","patterns/behavioural/visitor.html#discussion","patterns/behavioural/visitor.html#see-also","patterns/creational/intro.html#creational-patterns","patterns/creational/builder.html#builder","patterns/creational/builder.html#description","patterns/creational/builder.html#example","patterns/creational/builder.html#motivation","patterns/creational/builder.html#advantages","patterns/creational/builder.html#disadvantages","patterns/creational/builder.html#discussion","patterns/creational/builder.html#see-also","patterns/creational/fold.html#fold","patterns/creational/fold.html#description","patterns/creational/fold.html#example","patterns/creational/fold.html#motivation","patterns/creational/fold.html#discussion","patterns/creational/fold.html#see-also","patterns/structural/intro.html#structural-patterns","patterns/structural/compose-structs.html#compose-structs-together-for-better-borrowing","patterns/structural/compose-structs.html#description","patterns/structural/compose-structs.html#example","patterns/structural/compose-structs.html#motivation","patterns/structural/compose-structs.html#advantages","patterns/structural/compose-structs.html#disadvantages","patterns/structural/compose-structs.html#discussion","patterns/structural/small-crates.html#prefer-small-crates","patterns/structural/small-crates.html#description","patterns/structural/small-crates.html#advantages","patterns/structural/small-crates.html#disadvantages","patterns/structural/small-crates.html#examples","patterns/structural/small-crates.html#see-also","patterns/structural/unsafe-mods.html#contain-unsafety-in-small-modules","patterns/structural/unsafe-mods.html#description","patterns/structural/unsafe-mods.html#advantages","patterns/structural/unsafe-mods.html#disadvantages","patterns/structural/unsafe-mods.html#examples","patterns/structural/unsafe-mods.html#see-also","patterns/ffi/intro.html#ffi-patterns","patterns/ffi/export.html#object-based-apis","patterns/ffi/export.html#description","patterns/ffi/export.html#motivation","patterns/ffi/export.html#code-example","patterns/ffi/export.html#advantages","patterns/ffi/export.html#disadvantages","patterns/ffi/wrappers.html#type-consolidation-into-wrappers","patterns/ffi/wrappers.html#description","patterns/ffi/wrappers.html#code-example","patterns/ffi/wrappers.html#advantages","patterns/ffi/wrappers.html#disadvantages","patterns/ffi/wrappers.html#trying-to-wrap-iterators-and-failing","anti_patterns/index.html#anti-patterns","anti_patterns/borrow_clone.html#clone-to-satisfy-the-borrow-checker","anti_patterns/borrow_clone.html#description","anti_patterns/borrow_clone.html#example","anti_patterns/borrow_clone.html#motivation","anti_patterns/borrow_clone.html#see-also","anti_patterns/deny-warnings.html#denywarnings","anti_patterns/deny-warnings.html#description","anti_patterns/deny-warnings.html#example","anti_patterns/deny-warnings.html#advantages","anti_patterns/deny-warnings.html#drawbacks","anti_patterns/deny-warnings.html#alternatives","anti_patterns/deny-warnings.html#see-also","anti_patterns/deref.html#deref-polymorphism","anti_patterns/deref.html#description","anti_patterns/deref.html#example","anti_patterns/deref.html#advantages","anti_patterns/deref.html#disadvantages","anti_patterns/deref.html#discussion","anti_patterns/deref.html#see-also","functional/index.html#functional-usage-of-rust","functional/paradigms.html#programming-paradigms","functional/paradigms.html#imperative","functional/paradigms.html#declarative","functional/generics-type-classes.html#generics-as-type-classes","functional/generics-type-classes.html#description","functional/generics-type-classes.html#example","functional/generics-type-classes.html#advantages","functional/generics-type-classes.html#disadvantages","functional/generics-type-classes.html#alternatives","functional/generics-type-classes.html#see-also","additional_resources/index.html#additional-resources","additional_resources/index.html#talks","additional_resources/index.html#books-online","additional_resources/design-principles.html#design-principles","additional_resources/design-principles.html#a-brief-overview-over-common-design-principles","additional_resources/design-principles.html#solid","additional_resources/design-principles.html#dry-dont-repeat-yourself","additional_resources/design-principles.html#kiss-principle","additional_resources/design-principles.html#law-of-demeter-lod","additional_resources/design-principles.html#design-by-contract-dbc","additional_resources/design-principles.html#encapsulation","additional_resources/design-principles.html#command-query-separationcqs","additional_resources/design-principles.html#principle-of-least-astonishment-pola","additional_resources/design-principles.html#linguistic-modular-units","additional_resources/design-principles.html#self-documentation","additional_resources/design-principles.html#uniform-access","additional_resources/design-principles.html#single-choice","additional_resources/design-principles.html#persistence-closure"],"index":{"documentStore":{"docInfo":{"0":{"body":0,"breadcrumbs":2,"title":1},"1":{"body":7,"breadcrumbs":2,"title":1},"10":{"body":22,"breadcrumbs":5,"title":1},"100":{"body":28,"breadcrumbs":4,"title":1},"101":{"body":7,"breadcrumbs":4,"title":1},"102":{"body":15,"breadcrumbs":4,"title":1},"103":{"body":55,"breadcrumbs":4,"title":2},"104":{"body":15,"breadcrumbs":5,"title":3},"105":{"body":47,"breadcrumbs":3,"title":1},"106":{"body":15,"breadcrumbs":5,"title":2},"107":{"body":0,"breadcrumbs":5,"title":1},"108":{"body":10,"breadcrumbs":5,"title":1},"109":{"body":43,"breadcrumbs":5,"title":1},"11":{"body":20,"breadcrumbs":5,"title":1},"110":{"body":39,"breadcrumbs":5,"title":1},"111":{"body":112,"breadcrumbs":8,"title":4},"112":{"body":110,"breadcrumbs":8,"title":4},"113":{"body":97,"breadcrumbs":9,"title":5},"114":{"body":71,"breadcrumbs":5,"title":1},"115":{"body":6,"breadcrumbs":5,"title":1},"116":{"body":0,"breadcrumbs":5,"title":1},"117":{"body":34,"breadcrumbs":5,"title":1},"118":{"body":26,"breadcrumbs":5,"title":1},"119":{"body":72,"breadcrumbs":8,"title":4},"12":{"body":8,"breadcrumbs":5,"title":1},"120":{"body":97,"breadcrumbs":5,"title":1},"121":{"body":92,"breadcrumbs":5,"title":1},"122":{"body":6,"breadcrumbs":5,"title":1},"123":{"body":36,"breadcrumbs":5,"title":1},"124":{"body":16,"breadcrumbs":5,"title":1},"125":{"body":41,"breadcrumbs":5,"title":1},"126":{"body":36,"breadcrumbs":5,"title":1},"127":{"body":31,"breadcrumbs":5,"title":1},"128":{"body":27,"breadcrumbs":5,"title":1},"129":{"body":65,"breadcrumbs":5,"title":1},"13":{"body":18,"breadcrumbs":5,"title":1},"130":{"body":17,"breadcrumbs":5,"title":1},"131":{"body":0,"breadcrumbs":7,"title":2},"132":{"body":33,"breadcrumbs":6,"title":1},"133":{"body":107,"breadcrumbs":6,"title":1},"134":{"body":15,"breadcrumbs":6,"title":1},"135":{"body":7,"breadcrumbs":6,"title":1},"136":{"body":102,"breadcrumbs":6,"title":1},"137":{"body":14,"breadcrumbs":6,"title":1},"138":{"body":0,"breadcrumbs":7,"title":3},"139":{"body":64,"breadcrumbs":5,"title":1},"14":{"body":0,"breadcrumbs":3,"title":1},"140":{"body":37,"breadcrumbs":5,"title":1},"141":{"body":129,"breadcrumbs":5,"title":1},"142":{"body":30,"breadcrumbs":5,"title":1},"143":{"body":19,"breadcrumbs":5,"title":1},"144":{"body":173,"breadcrumbs":5,"title":1},"145":{"body":7,"breadcrumbs":5,"title":1},"146":{"body":0,"breadcrumbs":5,"title":1},"147":{"body":34,"breadcrumbs":5,"title":1},"148":{"body":120,"breadcrumbs":5,"title":1},"149":{"body":27,"breadcrumbs":5,"title":1},"15":{"body":12,"breadcrumbs":3,"title":1},"150":{"body":61,"breadcrumbs":5,"title":1},"151":{"body":18,"breadcrumbs":5,"title":1},"152":{"body":32,"breadcrumbs":5,"title":2},"153":{"body":0,"breadcrumbs":5,"title":1},"154":{"body":5,"breadcrumbs":5,"title":1},"155":{"body":101,"breadcrumbs":5,"title":1},"156":{"body":8,"breadcrumbs":5,"title":1},"157":{"body":15,"breadcrumbs":5,"title":1},"158":{"body":9,"breadcrumbs":5,"title":1},"159":{"body":79,"breadcrumbs":5,"title":1},"16":{"body":49,"breadcrumbs":3,"title":1},"160":{"body":20,"breadcrumbs":5,"title":1},"161":{"body":0,"breadcrumbs":5,"title":1},"162":{"body":36,"breadcrumbs":5,"title":1},"163":{"body":146,"breadcrumbs":5,"title":1},"164":{"body":52,"breadcrumbs":5,"title":1},"165":{"body":100,"breadcrumbs":5,"title":1},"166":{"body":55,"breadcrumbs":5,"title":1},"167":{"body":11,"breadcrumbs":5,"title":2},"168":{"body":4,"breadcrumbs":10,"title":5},"169":{"body":49,"breadcrumbs":6,"title":1},"17":{"body":6,"breadcrumbs":3,"title":1},"170":{"body":116,"breadcrumbs":6,"title":1},"171":{"body":3,"breadcrumbs":6,"title":1},"172":{"body":9,"breadcrumbs":6,"title":1},"173":{"body":20,"breadcrumbs":6,"title":1},"174":{"body":46,"breadcrumbs":6,"title":1},"175":{"body":0,"breadcrumbs":9,"title":3},"176":{"body":39,"breadcrumbs":7,"title":1},"177":{"body":41,"breadcrumbs":7,"title":1},"178":{"body":60,"breadcrumbs":7,"title":1},"179":{"body":21,"breadcrumbs":7,"title":1},"18":{"body":0,"breadcrumbs":5,"title":2},"180":{"body":5,"breadcrumbs":7,"title":1},"181":{"body":0,"breadcrumbs":11,"title":4},"182":{"body":40,"breadcrumbs":8,"title":1},"183":{"body":13,"breadcrumbs":8,"title":1},"184":{"body":8,"breadcrumbs":8,"title":1},"185":{"body":38,"breadcrumbs":8,"title":1},"186":{"body":6,"breadcrumbs":8,"title":1},"187":{"body":46,"breadcrumbs":8,"title":2},"188":{"body":0,"breadcrumbs":12,"title":3},"189":{"body":40,"breadcrumbs":10,"title":1},"19":{"body":70,"breadcrumbs":4,"title":1},"190":{"body":112,"breadcrumbs":10,"title":1},"191":{"body":273,"breadcrumbs":11,"title":2},"192":{"body":347,"breadcrumbs":10,"title":1},"193":{"body":101,"breadcrumbs":10,"title":1},"194":{"body":0,"breadcrumbs":12,"title":3},"195":{"body":85,"breadcrumbs":10,"title":1},"196":{"body":76,"breadcrumbs":11,"title":2},"197":{"body":17,"breadcrumbs":10,"title":1},"198":{"body":36,"breadcrumbs":10,"title":1},"199":{"body":262,"breadcrumbs":13,"title":4},"2":{"body":20,"breadcrumbs":3,"title":2},"20":{"body":72,"breadcrumbs":4,"title":1},"200":{"body":35,"breadcrumbs":4,"title":2},"201":{"body":0,"breadcrumbs":10,"title":4},"202":{"body":33,"breadcrumbs":7,"title":1},"203":{"body":41,"breadcrumbs":7,"title":1},"204":{"body":151,"breadcrumbs":7,"title":1},"205":{"body":22,"breadcrumbs":7,"title":1},"206":{"body":0,"breadcrumbs":4,"title":1},"207":{"body":13,"breadcrumbs":4,"title":1},"208":{"body":2,"breadcrumbs":4,"title":1},"209":{"body":5,"breadcrumbs":4,"title":1},"21":{"body":15,"breadcrumbs":4,"title":1},"210":{"body":120,"breadcrumbs":4,"title":1},"211":{"body":137,"breadcrumbs":4,"title":1},"212":{"body":26,"breadcrumbs":4,"title":1},"213":{"body":0,"breadcrumbs":6,"title":2},"214":{"body":10,"breadcrumbs":5,"title":1},"215":{"body":131,"breadcrumbs":5,"title":1},"216":{"body":9,"breadcrumbs":5,"title":1},"217":{"body":87,"breadcrumbs":5,"title":1},"218":{"body":90,"breadcrumbs":5,"title":1},"219":{"body":13,"breadcrumbs":5,"title":1},"22":{"body":0,"breadcrumbs":7,"title":3},"220":{"body":35,"breadcrumbs":5,"title":3},"221":{"body":25,"breadcrumbs":6,"title":2},"222":{"body":61,"breadcrumbs":5,"title":1},"223":{"body":95,"breadcrumbs":5,"title":1},"224":{"body":0,"breadcrumbs":8,"title":3},"225":{"body":173,"breadcrumbs":6,"title":1},"226":{"body":378,"breadcrumbs":6,"title":1},"227":{"body":44,"breadcrumbs":6,"title":1},"228":{"body":13,"breadcrumbs":6,"title":1},"229":{"body":23,"breadcrumbs":6,"title":1},"23":{"body":12,"breadcrumbs":5,"title":1},"230":{"body":147,"breadcrumbs":6,"title":1},"231":{"body":4,"breadcrumbs":4,"title":2},"232":{"body":22,"breadcrumbs":3,"title":1},"233":{"body":3,"breadcrumbs":4,"title":2},"234":{"body":0,"breadcrumbs":6,"title":2},"235":{"body":0,"breadcrumbs":10,"title":6},"236":{"body":59,"breadcrumbs":5,"title":1},"237":{"body":8,"breadcrumbs":8,"title":4},"238":{"body":15,"breadcrumbs":6,"title":2},"239":{"body":14,"breadcrumbs":7,"title":3},"24":{"body":47,"breadcrumbs":5,"title":1},"240":{"body":19,"breadcrumbs":7,"title":3},"241":{"body":25,"breadcrumbs":5,"title":1},"242":{"body":17,"breadcrumbs":7,"title":3},"243":{"body":11,"breadcrumbs":7,"title":3},"244":{"body":12,"breadcrumbs":7,"title":3},"245":{"body":15,"breadcrumbs":6,"title":2},"246":{"body":20,"breadcrumbs":6,"title":2},"247":{"body":19,"breadcrumbs":6,"title":2},"248":{"body":25,"breadcrumbs":6,"title":2},"25":{"body":29,"breadcrumbs":5,"title":1},"26":{"body":16,"breadcrumbs":5,"title":1},"27":{"body":21,"breadcrumbs":5,"title":1},"28":{"body":96,"breadcrumbs":5,"title":1},"29":{"body":7,"breadcrumbs":5,"title":1},"3":{"body":72,"breadcrumbs":4,"title":3},"30":{"body":0,"breadcrumbs":5,"title":2},"31":{"body":19,"breadcrumbs":4,"title":1},"32":{"body":35,"breadcrumbs":4,"title":1},"33":{"body":46,"breadcrumbs":4,"title":1},"34":{"body":10,"breadcrumbs":4,"title":1},"35":{"body":51,"breadcrumbs":4,"title":1},"36":{"body":129,"breadcrumbs":4,"title":1},"37":{"body":2,"breadcrumbs":4,"title":1},"38":{"body":0,"breadcrumbs":10,"title":7},"39":{"body":24,"breadcrumbs":4,"title":1},"4":{"body":63,"breadcrumbs":2,"title":1},"40":{"body":90,"breadcrumbs":4,"title":1},"41":{"body":119,"breadcrumbs":4,"title":1},"42":{"body":7,"breadcrumbs":4,"title":1},"43":{"body":38,"breadcrumbs":4,"title":1},"44":{"body":45,"breadcrumbs":4,"title":1},"45":{"body":10,"breadcrumbs":4,"title":1},"46":{"body":0,"breadcrumbs":7,"title":3},"47":{"body":22,"breadcrumbs":5,"title":1},"48":{"body":42,"breadcrumbs":5,"title":1},"49":{"body":38,"breadcrumbs":5,"title":1},"5":{"body":0,"breadcrumbs":9,"title":4},"50":{"body":19,"breadcrumbs":5,"title":1},"51":{"body":23,"breadcrumbs":5,"title":1},"52":{"body":66,"breadcrumbs":5,"title":1},"53":{"body":23,"breadcrumbs":5,"title":1},"54":{"body":44,"breadcrumbs":7,"title":2},"55":{"body":0,"breadcrumbs":10,"title":3},"56":{"body":53,"breadcrumbs":8,"title":1},"57":{"body":0,"breadcrumbs":9,"title":2},"58":{"body":30,"breadcrumbs":9,"title":2},"59":{"body":104,"breadcrumbs":9,"title":2},"6":{"body":77,"breadcrumbs":6,"title":1},"60":{"body":45,"breadcrumbs":10,"title":3},"61":{"body":11,"breadcrumbs":8,"title":1},"62":{"body":7,"breadcrumbs":8,"title":1},"63":{"body":0,"breadcrumbs":9,"title":2},"64":{"body":28,"breadcrumbs":8,"title":1},"65":{"body":83,"breadcrumbs":8,"title":1},"66":{"body":70,"breadcrumbs":9,"title":2},"67":{"body":173,"breadcrumbs":8,"title":1},"68":{"body":1,"breadcrumbs":8,"title":1},"69":{"body":0,"breadcrumbs":9,"title":2},"7":{"body":261,"breadcrumbs":6,"title":1},"70":{"body":36,"breadcrumbs":8,"title":1},"71":{"body":52,"breadcrumbs":8,"title":1},"72":{"body":71,"breadcrumbs":9,"title":2},"73":{"body":85,"breadcrumbs":8,"title":1},"74":{"body":1,"breadcrumbs":8,"title":1},"75":{"body":0,"breadcrumbs":7,"title":3},"76":{"body":18,"breadcrumbs":5,"title":1},"77":{"body":60,"breadcrumbs":5,"title":1},"78":{"body":31,"breadcrumbs":5,"title":1},"79":{"body":0,"breadcrumbs":7,"title":3},"8":{"body":18,"breadcrumbs":6,"title":1},"80":{"body":27,"breadcrumbs":5,"title":1},"81":{"body":42,"breadcrumbs":5,"title":1},"82":{"body":25,"breadcrumbs":5,"title":1},"83":{"body":4,"breadcrumbs":5,"title":1},"84":{"body":0,"breadcrumbs":7,"title":4},"85":{"body":49,"breadcrumbs":4,"title":1},"86":{"body":60,"breadcrumbs":4,"title":1},"87":{"body":94,"breadcrumbs":7,"title":4},"88":{"body":68,"breadcrumbs":4,"title":1},"89":{"body":63,"breadcrumbs":4,"title":1},"9":{"body":0,"breadcrumbs":7,"title":3},"90":{"body":6,"breadcrumbs":4,"title":1},"91":{"body":0,"breadcrumbs":7,"title":3},"92":{"body":15,"breadcrumbs":5,"title":1},"93":{"body":57,"breadcrumbs":5,"title":1},"94":{"body":50,"breadcrumbs":5,"title":1},"95":{"body":7,"breadcrumbs":5,"title":1},"96":{"body":20,"breadcrumbs":5,"title":1},"97":{"body":25,"breadcrumbs":5,"title":1},"98":{"body":0,"breadcrumbs":5,"title":2},"99":{"body":23,"breadcrumbs":4,"title":1}},"docs":{"0":{"body":"","breadcrumbs":"Introduction » Introduction","id":"0","title":"Introduction"},"1":{"body":"If you are interested in contributing to this book, check out the contribution guidelines .","breadcrumbs":"Introduction » Participation","id":"1","title":"Participation"},"10":{"body":"It is possible to build up strings using the push and push_str methods on a mutable String, or using its + operator. However, it is often more convenient to use format!, especially where there is a mix of literal and non-literal strings.","breadcrumbs":"Idioms » Concatenating Strings with format! » Description","id":"10","title":"Description"},"100":{"body":"Say, vector must be sorted before usage. Using nested block: let data = { let mut data = get_vec(); data.sort(); data\n}; // Here `data` is immutable. Using variable rebinding: let mut data = get_vec();\ndata.sort();\nlet data = data; // Here `data` is immutable.","breadcrumbs":"Idioms » Temporary mutability » Example","id":"100","title":"Example"},"101":{"body":"Compiler ensures that you don't accidentally mutate data after some point.","breadcrumbs":"Idioms » Temporary mutability » Advantages","id":"101","title":"Advantages"},"102":{"body":"Nested block requires additional indentation of block body. One more line to return data from block or redefine variable.","breadcrumbs":"Idioms » Temporary mutability » Disadvantages","id":"102","title":"Disadvantages"},"103":{"body":"Design patterns are \"general reusable solutions to a commonly occurring problem within a given context in software design\". Design patterns are a great way to describe the culture of a programming language. Design patterns are very language-specific - what is a pattern in one language may be unnecessary in another due to a language feature, or impossible to express due to a missing feature. If overused, design patterns can add unnecessary complexity to programs. However, they are a great way to share intermediate and advanced level knowledge about a programming language.","breadcrumbs":"Design Patterns » Design Patterns","id":"103","title":"Design Patterns"},"104":{"body":"Rust has many unique features. These features give us great benefit by removing whole classes of problems. Some of them are also patterns that are unique to Rust.","breadcrumbs":"Design Patterns » Design patterns in Rust","id":"104","title":"Design patterns in Rust"},"105":{"body":"If you're not familiar with it, YAGNI is an acronym that stands for You Aren't Going to Need It. It's an important software design principle to apply as you write code. The best code I ever wrote was code I never wrote. If we apply YAGNI to design patterns, we see that the features of Rust allow us to throw out many patterns. For instance, there is no need for the strategy pattern in Rust because we can just use traits . TODO: Maybe include some code to illustrate the traits.","breadcrumbs":"Design Patterns » YAGNI","id":"105","title":"YAGNI"},"106":{"body":"From Wikipedia : Design patterns that identify common communication patterns among objects. By doing so, these patterns increase flexibility in carrying out communication.","breadcrumbs":"Design Patterns » Behavioural » Behavioural Patterns","id":"106","title":"Behavioural Patterns"},"107":{"body":"","breadcrumbs":"Design Patterns » Behavioural » Command » Command","id":"107","title":"Command"},"108":{"body":"The basic idea of the Command pattern is to separate out actions into its own objects and pass them as parameters.","breadcrumbs":"Design Patterns » Behavioural » Command » Description","id":"108","title":"Description"},"109":{"body":"Suppose we have a sequence of actions or transactions encapsulated as objects. We want these actions or commands to be executed or invoked in some order later at different time. These commands may also be triggered as a result of some event. For example, when a user pushes a button, or on arrival of a data packet. In addition, these commands might be undoable. This may come in useful for operations of an editor. We might want to store logs of executed commands so that we could reapply the changes later if the system crashes.","breadcrumbs":"Design Patterns » Behavioural » Command » Motivation","id":"109","title":"Motivation"},"11":{"body":"fn say_hello(name: &str) -> String { // We could construct the result string manually. // let mut result = \"Hello \".to_owned(); // result.push_str(name); // result.push('!'); // result // But using format! is better. format!(\"Hello {}!\", name)\n}","breadcrumbs":"Idioms » Concatenating Strings with format! » Example","id":"11","title":"Example"},"110":{"body":"Define two database operations create table and add field. Each of these operations is a command which knows how to undo the command, e.g., drop table and remove field. When a user invokes a database migration operation then each command is executed in the defined order, and when the user invokes the rollback operation then the whole set of commands is invoked in reverse order.","breadcrumbs":"Design Patterns » Behavioural » Command » Example","id":"110","title":"Example"},"111":{"body":"We define a common trait which encapsulates our command with two operations execute and rollback. All command structs must implement this trait. pub trait Migration { fn execute(&self) -> &str; fn rollback(&self) -> &str;\n} pub struct CreateTable;\nimpl Migration for CreateTable { fn execute(&self) -> &str { \"create table\" } fn rollback(&self) -> &str { \"drop table\" }\n} pub struct AddField;\nimpl Migration for AddField { fn execute(&self) -> &str { \"add field\" } fn rollback(&self) -> &str { \"remove field\" }\n} struct Schema { commands: Vec { fn file_path(&self) -> &Path { &self.file_name } fn auth_info(&self) -> P::AuthInfo { self.protocol.auth_info() }\n} // all protocol-specific impls go into their own block\nimpl FileDownloadRequest { fn file_path(&self) -> &Path { &self.file_name } fn auth_info(&self) -> P::AuthInfo { self.protocol.auth_info() }\n} // all protocol-specific impls go into their own block\nimpl FileDownloadRequest