diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..e352fe7d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +chemfiles-sys/chemfiles +target/ +Cargo.lock diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/0.10.0/.lock b/0.10.0/.lock new file mode 100755 index 000000000..e69de29bb diff --git a/0.10.0/COPYRIGHT.txt b/0.10.0/COPYRIGHT.txt new file mode 100644 index 000000000..af77776cc --- /dev/null +++ b/0.10.0/COPYRIGHT.txt @@ -0,0 +1,45 @@ +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff, FiraSans-Medium.woff): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.woff, SourceCodePro-Semibold.woff): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif Pro (SourceSerifPro-Regular.ttf.woff, + SourceSerifPro-Bold.ttf.woff, SourceSerifPro-It.ttf.woff): + + Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/), with + Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of + Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerifPro-LICENSE.txt. + +This copyright file is intended to be distributed with rustdoc output. diff --git a/0.10.0/FiraSans-LICENSE.txt b/0.10.0/FiraSans-LICENSE.txt new file mode 100644 index 000000000..d444ea92b --- /dev/null +++ b/0.10.0/FiraSans-LICENSE.txt @@ -0,0 +1,94 @@ +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.0/FiraSans-Medium.woff b/0.10.0/FiraSans-Medium.woff new file mode 100644 index 000000000..7d742c5fb Binary files /dev/null and b/0.10.0/FiraSans-Medium.woff differ diff --git a/0.10.0/FiraSans-Regular.woff b/0.10.0/FiraSans-Regular.woff new file mode 100644 index 000000000..d8e0363f4 Binary files /dev/null and b/0.10.0/FiraSans-Regular.woff differ diff --git a/0.10.0/LICENSE-APACHE.txt b/0.10.0/LICENSE-APACHE.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/0.10.0/LICENSE-APACHE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/0.10.0/LICENSE-MIT.txt b/0.10.0/LICENSE-MIT.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/0.10.0/LICENSE-MIT.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/0.10.0/SourceCodePro-LICENSE.txt b/0.10.0/SourceCodePro-LICENSE.txt new file mode 100644 index 000000000..07542572e --- /dev/null +++ b/0.10.0/SourceCodePro-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.0/SourceCodePro-Regular.woff b/0.10.0/SourceCodePro-Regular.woff new file mode 100644 index 000000000..557667090 Binary files /dev/null and b/0.10.0/SourceCodePro-Regular.woff differ diff --git a/0.10.0/SourceCodePro-Semibold.woff b/0.10.0/SourceCodePro-Semibold.woff new file mode 100644 index 000000000..ca972a11d Binary files /dev/null and b/0.10.0/SourceCodePro-Semibold.woff differ diff --git a/0.10.0/SourceSerifPro-Bold.ttf.woff b/0.10.0/SourceSerifPro-Bold.ttf.woff new file mode 100644 index 000000000..ca254318f Binary files /dev/null and b/0.10.0/SourceSerifPro-Bold.ttf.woff differ diff --git a/0.10.0/SourceSerifPro-It.ttf.woff b/0.10.0/SourceSerifPro-It.ttf.woff new file mode 100644 index 000000000..a287bbe6e Binary files /dev/null and b/0.10.0/SourceSerifPro-It.ttf.woff differ diff --git a/0.10.0/SourceSerifPro-LICENSE.md b/0.10.0/SourceSerifPro-LICENSE.md new file mode 100644 index 000000000..22cb755f2 --- /dev/null +++ b/0.10.0/SourceSerifPro-LICENSE.md @@ -0,0 +1,93 @@ +Copyright 2014-2018 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.0/SourceSerifPro-Regular.ttf.woff b/0.10.0/SourceSerifPro-Regular.ttf.woff new file mode 100644 index 000000000..a3d55cfdf Binary files /dev/null and b/0.10.0/SourceSerifPro-Regular.ttf.woff differ diff --git a/0.10.0/ayu.css b/0.10.0/ayu.css new file mode 100644 index 000000000..88b5428aa --- /dev/null +++ b/0.10.0/ayu.css @@ -0,0 +1 @@ + body{background-color:#0f1419;color:#c5c5c5;}h1,h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){color:white;}h1.fqn{border-bottom-color:#5c6773;}h1.fqn a{color:#fff;}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod){border-bottom-color:#5c6773;}h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant){border:none;}.in-band{background-color:#0f1419;}.invisible{background:rgba(0,0,0,0);}code{color:#ffb454;}h3>code,h4>code,h5>code{color:#e6e1cf;}pre>code{color:#e6e1cf;}span code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}.docblock code,.docblock-short code{background-color:#191f26;}pre{color:#e6e1cf;background-color:#191f26;}.sidebar{background-color:#14191f;}.logo-container.rust-logo>img{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}*{scrollbar-color:#5c6773 transparent;}.sidebar{scrollbar-color:#5c6773 transparent;}::-webkit-scrollbar-track{background-color:transparent;}::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar::-webkit-scrollbar-track{background-color:transparent;}.sidebar::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar .current{background-color:transparent;color:#ffb44c;}.source .sidebar{background-color:#0f1419;}.sidebar .location{border-color:#000;background-color:#0f1419;color:#fff;}.sidebar-elems .location{color:#ff7733;}.sidebar-elems .location a{color:#fff;}.sidebar .version{border-bottom-color:#424c57;}.sidebar-title{border-top-color:#5c6773;border-bottom-color:#5c6773;}.block a:hover{background:transparent;color:#ffb44c;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#5c6773;}.docblock table,.docblock table td,.docblock table th{border-color:#5c6773;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#c5c5c5;}.content .highlighted{color:#000 !important;background-color:#c6afb3;}.content .highlighted a,.content .highlighted span{color:#000 !important;}.content .highlighted{background-color:#c6afb3;}.search-results a{color:#0096cf;}.search-results a span.desc{color:#c5c5c5;}.content .stability::before{color:#ccc;}.content span.foreigntype,.content a.foreigntype{color:#ef57ff;}.content span.union,.content a.union{color:#98a01c;}.content span.constant,.content a.constant,.content span.static,.content a.static{color:#6380a0;}.content span.primitive,.content a.primitive{color:#32889b;}.content span.traitalias,.content a.traitalias{color:#57d399;}.content span.keyword,.content a.keyword{color:#de5249;}.content span.externcrate,.content span.mod,.content a.mod{color:#acccf9;}.content span.struct,.content a.struct{color:#ffa0a5;}.content span.enum,.content a.enum{color:#99e0c9;}.content span.trait,.content a.trait{color:#39AFD7;}.content span.type,.content a.type{color:#cfbcf5;}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod,.content .fnname{color:#fdd687;}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:#a37acc;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}nav:not(.sidebar){border-bottom-color:#424c57;}nav.main .current{border-top-color:#5c6773;border-bottom-color:#5c6773;}nav.main .separator{border:1px solid #5c6773;}a{color:#c5c5c5;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.stability a,#help a{color:#39AFD7;}.collapse-toggle{color:#999;}#crate-search{color:#c5c5c5;background-color:#141920;box-shadow:0 0 0 1px #424c57,0 0 0 2px transparent;border-color:#424c57;}.search-input{color:#ffffff;background-color:#141920;box-shadow:0 0 0 1px #424c57,0 0 0 2px transparent;transition:box-shadow 150ms ease-in-out;}#crate-search+.search-input:focus{box-shadow:0 0 0 1px #148099,0 0 0 2px transparent;}.search-focus:disabled{color:#929292;}.module-item .stab{color:#000;}.stab.unstable,.stab.deprecated,.stab.portability{color:#c5c5c5;background:#314559 !important;border-style:none !important;border-radius:4px;padding:3px 6px 3px 6px;}.stab.portability>code{color:#e6e1cf;background-color:transparent;}#help>div{background:#14191f;box-shadow:0px 6px 20px 0px black;border:none;border-radius:4px;}#help>div>span{border-bottom-color:#5c6773;}.since{color:grey;}tr.result span.primitive::after,tr.result span.keyword::after{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .op,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}pre.rust .attribute .ident,pre.rust .attribute .op{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}.toggle-label{color:#999;}:target>code,:target>.in-band{background:rgba(255,236,164,0.06);border-right:3px solid rgba(255,180,76,0.85);}pre.compile_fail{border-left:2px solid rgba(255,0,0,.4);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.4);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#39AFD7;}.tooltip .tooltiptext{background-color:#314559;color:#c5c5c5;border:1px solid #5c6773;}.tooltip .tooltiptext::after{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;border-color:#5c6773;}#titles>div.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>div:not(.selected){background-color:transparent !important;border:none;}#titles>div:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>div>div.count{color:#888;}.content .highlighted.mod,.content .highlighted.externcrate{}.search-input:focus{}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{}.content .highlighted.trait{}.content span.struct,.content a.struct,.block a.current.struct{}#titles>div:hover,#titles>div.selected{}.content .highlighted.traitalias{}.content span.type,.content a.type,.block a.current.type{}.content span.union,.content a.union,.block a.current.union{}.content .highlighted.foreigntype{}pre.rust .lifetime{}.content .highlighted.primitive{}.content .highlighted.constant,.content .highlighted.static{}.stab.unstable{}.content .highlighted.fn,.content .highlighted.method,.content .highlighted.tymethod{}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){}.content span.enum,.content a.enum,.block a.current.enum{}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{}.content span.keyword,.content a.keyword,.block a.current.keyword{}pre.rust .comment{}.content .highlighted.enum{}.content .highlighted.struct{}.content .highlighted.keyword{}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{}pre.rust .kw{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{}pre.rust .doccomment{}.stab.deprecated{}.content .highlighted.attr,.content .highlighted.derive,.content .highlighted.macro{}.stab.portability{}.content .highlighted.union{}.content span.primitive,.content a.primitive,.block a.current.primitive{}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{}.content .highlighted.type{}pre.rust .kw-2,pre.rust .prelude-ty{}.content span.trait,.content a.trait,.block a.current.trait{}@media (max-width:700px){.sidebar-menu{background-color:#14191f;border-bottom-color:#5c6773;border-right-color:#5c6773;}.sidebar-elems{background-color:#14191f;border-right-color:#5c6773;}#sidebar-filler{background-color:#14191f;border-bottom-color:#5c6773;}}kbd{color:#c5c5c5;background-color:#314559;border-color:#5c6773;border-bottom-color:#5c6773;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,.help-button{border-color:#5c6773;background-color:#0f1419;color:#fff;}#theme-picker>img,#settings-menu>img{filter:invert(100);}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,.help-button:hover,.help-button:focus{border-color:#e0e0e0;}#theme-choices{border-color:#5c6773;background-color:#0f1419;}#theme-choices>button:not(:first-child){border-top-color:#5c6773;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:rgba(110,110,110,0.33);}@media (max-width:700px){#theme-picker{background:#0f1419;}}#all-types{background-color:#14191f;}#all-types:hover{background-color:rgba(70,70,70,0.33);}.search-results td span.alias{color:#c5c5c5;}.search-results td span.grey{color:#999;}#sidebar-toggle{background-color:#14191f;}#sidebar-toggle:hover{background-color:rgba(70,70,70,0.33);}#source-sidebar{background-color:#14191f;}#source-sidebar>.title{color:#fff;border-bottom-color:#5c6773;}div.files>a:hover,div.name:hover{background-color:#14191f;color:#ffb44c;}div.files>.selected{background-color:#14191f;color:#ffb44c;}.setting-line>.title{border-bottom-color:#5c6773;}input:checked+.slider{background-color:#ffb454 !important;} \ No newline at end of file diff --git a/0.10.0/brush.svg b/0.10.0/brush.svg new file mode 100644 index 000000000..ea266e856 --- /dev/null +++ b/0.10.0/brush.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.0/chemfiles/all.html b/0.10.0/chemfiles/all.html new file mode 100644 index 000000000..140ed0941 --- /dev/null +++ b/0.10.0/chemfiles/all.html @@ -0,0 +1,6 @@ +List of all items in this crate + +

[] + + List of all items

Structs

Enums

Functions

\ No newline at end of file diff --git a/0.10.0/chemfiles/atom/struct.Atom.html b/0.10.0/chemfiles/atom/struct.Atom.html new file mode 100644 index 000000000..fce480c69 --- /dev/null +++ b/0.10.0/chemfiles/atom/struct.Atom.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Atom.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/atom/struct.AtomMut.html b/0.10.0/chemfiles/atom/struct.AtomMut.html new file mode 100644 index 000000000..a62923670 --- /dev/null +++ b/0.10.0/chemfiles/atom/struct.AtomMut.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.AtomMut.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/atom/struct.AtomRef.html b/0.10.0/chemfiles/atom/struct.AtomRef.html new file mode 100644 index 000000000..042ac5995 --- /dev/null +++ b/0.10.0/chemfiles/atom/struct.AtomRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.AtomRef.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/cell/enum.CellShape.html b/0.10.0/chemfiles/cell/enum.CellShape.html new file mode 100644 index 000000000..e1c2cc748 --- /dev/null +++ b/0.10.0/chemfiles/cell/enum.CellShape.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.CellShape.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/cell/struct.UnitCell.html b/0.10.0/chemfiles/cell/struct.UnitCell.html new file mode 100644 index 000000000..cddcfc6bf --- /dev/null +++ b/0.10.0/chemfiles/cell/struct.UnitCell.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.UnitCell.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/cell/struct.UnitCellMut.html b/0.10.0/chemfiles/cell/struct.UnitCellMut.html new file mode 100644 index 000000000..c6b7d5aee --- /dev/null +++ b/0.10.0/chemfiles/cell/struct.UnitCellMut.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.UnitCellMut.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/cell/struct.UnitCellRef.html b/0.10.0/chemfiles/cell/struct.UnitCellRef.html new file mode 100644 index 000000000..0b0ac3556 --- /dev/null +++ b/0.10.0/chemfiles/cell/struct.UnitCellRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.UnitCellRef.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/enum.BondOrder.html b/0.10.0/chemfiles/enum.BondOrder.html new file mode 100644 index 000000000..930926ff7 --- /dev/null +++ b/0.10.0/chemfiles/enum.BondOrder.html @@ -0,0 +1,56 @@ +chemfiles::BondOrder - Rust + +

[][src]Enum chemfiles::BondOrder

#[repr(C)]
+#[non_exhaustive]pub enum BondOrder {
+    Unknown,
+    Single,
+    Double,
+    Triple,
+    Quadruple,
+    Quintuplet,
+    Amide,
+    Aromatic,
+}

Possible bond order associated with bonds

+

+ Variants (Non-exhaustive)

+
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unknown

Unknown or unspecified bond order

+
Single

Single bond

+
Double

Double bond

+
Triple

Triple bond

+
Quadruple

Quadruple bond (present in some metals)

+
Quintuplet

Quintuplet bond (present in some metals)

+
Amide

Amide bond (required by some file formats)

+
Aromatic

Aromatic bond (required by some file formats)

+

Trait Implementations

impl Clone for BondOrder[src]

impl Copy for BondOrder[src]

impl Debug for BondOrder[src]

impl Eq for BondOrder[src]

impl From<chfl_bond_order> for BondOrder[src]

impl Ord for BondOrder[src]

impl PartialEq<BondOrder> for BondOrder[src]

impl PartialOrd<BondOrder> for BondOrder[src]

impl StructuralEq for BondOrder[src]

impl StructuralPartialEq for BondOrder[src]

Auto Trait Implementations

impl RefUnwindSafe for BondOrder

impl Send for BondOrder

impl Sync for BondOrder

impl Unpin for BondOrder

impl UnwindSafe for BondOrder

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/enum.CellShape.html b/0.10.0/chemfiles/enum.CellShape.html new file mode 100644 index 000000000..2b0b27bbb --- /dev/null +++ b/0.10.0/chemfiles/enum.CellShape.html @@ -0,0 +1,35 @@ +chemfiles::CellShape - Rust + +

[][src]Enum chemfiles::CellShape

pub enum CellShape {
+    Orthorhombic,
+    Triclinic,
+    Infinite,
+}

Available unit cell shapes.

+

+ Variants

+
Orthorhombic

Orthorhombic cell, with the three angles equals to 90°.

+
Triclinic

Triclinic cell, with any values for the angles.

+
Infinite

Infinite cell, to use when there is no cell.

+

Trait Implementations

impl Clone for CellShape[src]

impl Debug for CellShape[src]

impl Eq for CellShape[src]

impl From<CellShape> for chfl_cellshape[src]

impl From<chfl_cellshape> for CellShape[src]

impl PartialEq<CellShape> for CellShape[src]

impl StructuralEq for CellShape[src]

impl StructuralPartialEq for CellShape[src]

Auto Trait Implementations

impl RefUnwindSafe for CellShape

impl Send for CellShape

impl Sync for CellShape

impl Unpin for CellShape

impl UnwindSafe for CellShape

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/enum.Property.html b/0.10.0/chemfiles/enum.Property.html new file mode 100644 index 000000000..571c5bf3f --- /dev/null +++ b/0.10.0/chemfiles/enum.Property.html @@ -0,0 +1,48 @@ +chemfiles::Property - Rust + +

[][src]Enum chemfiles::Property

pub enum Property {
+    Bool(bool),
+    Double(f64),
+    String(String),
+    Vector3D([f64; 3]),
+}

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

+ Variants

+
Bool(bool)

Boolean property

+
Double(f64)

Floating point property

+
String(String)

String property

+
Vector3D([f64; 3])

3-dimensional vector property

+

Trait Implementations

impl Clone for Property[src]

impl Debug for Property[src]

impl<'a> From<&'a str> for Property[src]

impl From<[f64; 3]> for Property[src]

impl From<String> for Property[src]

impl From<bool> for Property[src]

impl From<f64> for Property[src]

impl PartialEq<Property> for Property[src]

impl PartialOrd<Property> for Property[src]

impl StructuralPartialEq for Property[src]

Auto Trait Implementations

impl RefUnwindSafe for Property

impl Send for Property

impl Sync for Property

impl Unpin for Property

impl UnwindSafe for Property

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/enum.Status.html b/0.10.0/chemfiles/enum.Status.html new file mode 100644 index 000000000..c8829d296 --- /dev/null +++ b/0.10.0/chemfiles/enum.Status.html @@ -0,0 +1,50 @@ +chemfiles::Status - Rust + +

[][src]Enum chemfiles::Status

#[repr(C)]
+#[non_exhaustive]pub enum Status {
+    Success,
+    MemoryError,
+    FileError,
+    FormatError,
+    SelectionError,
+    ConfigurationError,
+    OutOfBounds,
+    PropertyError,
+    ChemfilesError,
+    StdCppError,
+    UTF8PathError,
+}

Possible causes of error in chemfiles

+

+ Variants (Non-exhaustive)

+
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Success

No error

+
MemoryError

Error in memory allocations

+
FileError

Error while reading or writing a file

+
FormatError

Error in file formatting, i.e. the file is invalid

+
SelectionError

Error in selection string syntax

+
ConfigurationError

Error in configuration files syntax

+
OutOfBounds

Error for out of bounds indexing

+
PropertyError

Error related to properties

+
ChemfilesError

Exception in the C++ chemfiles library

+
StdCppError

Exception in the C++ standard library

+
UTF8PathError

The given path is not valid UTF8

+

Trait Implementations

impl Clone for Status[src]

impl Debug for Status[src]

impl PartialEq<Status> for Status[src]

impl StructuralPartialEq for Status[src]

Auto Trait Implementations

impl RefUnwindSafe for Status

impl Send for Status

impl Sync for Status

impl Unpin for Status

impl UnwindSafe for Status

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/errors/enum.Status.html b/0.10.0/chemfiles/errors/enum.Status.html new file mode 100644 index 000000000..1ea316611 --- /dev/null +++ b/0.10.0/chemfiles/errors/enum.Status.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.Status.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/errors/fn.set_warning_callback.html b/0.10.0/chemfiles/errors/fn.set_warning_callback.html new file mode 100644 index 000000000..bf8004830 --- /dev/null +++ b/0.10.0/chemfiles/errors/fn.set_warning_callback.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/fn.set_warning_callback.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/errors/struct.Error.html b/0.10.0/chemfiles/errors/struct.Error.html new file mode 100644 index 000000000..413e6df25 --- /dev/null +++ b/0.10.0/chemfiles/errors/struct.Error.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Error.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/fn.add_configuration.html b/0.10.0/chemfiles/fn.add_configuration.html new file mode 100644 index 000000000..b1ee8d62f --- /dev/null +++ b/0.10.0/chemfiles/fn.add_configuration.html @@ -0,0 +1,16 @@ +chemfiles::add_configuration - Rust + +

[][src]Function chemfiles::add_configuration

pub fn add_configuration<S>(path: S) -> Result<(), Error> where
    S: AsRef<str>, 

Read configuration data from the file at path.

+

By default, chemfiles reads configuration from any file named +.chemfiles.toml in the current directory or any parent directory. This +function can be used to add data from another configuration file. Data from +the new configuration file will overwrite any existing data.

+

Errors

+

This function will fail if there is no file at path, or if the file is +incorrectly formatted.

+

Example

+
+chemfiles::add_configuration("local-config.toml").unwrap();
+// from now on, the data from "local-config.toml" will be used
+
\ No newline at end of file diff --git a/0.10.0/chemfiles/fn.formats_list.html b/0.10.0/chemfiles/fn.formats_list.html new file mode 100644 index 000000000..ad7a6e6d5 --- /dev/null +++ b/0.10.0/chemfiles/fn.formats_list.html @@ -0,0 +1,16 @@ +chemfiles::formats_list - Rust + +

[][src]Function chemfiles::formats_list

#[must_use]pub fn formats_list() -> Vec<FormatMetadata>

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Example

+
+let formats = chemfiles::formats_list();
+println!("chemfiles supports {} formats:", formats.len());
+for format in &formats {
+    println!(
+        "   {:<15} {}",
+        format.name,
+        format.extension.as_deref().unwrap_or("")
+    );
+}
+
\ No newline at end of file diff --git a/0.10.0/chemfiles/fn.set_warning_callback.html b/0.10.0/chemfiles/fn.set_warning_callback.html new file mode 100644 index 000000000..63d226e9a --- /dev/null +++ b/0.10.0/chemfiles/fn.set_warning_callback.html @@ -0,0 +1,6 @@ +chemfiles::set_warning_callback - Rust + +

[][src]Function chemfiles::set_warning_callback

pub fn set_warning_callback<F>(callback: F) where
    F: WarningCallback + 'static, 

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/fn.version.html b/0.10.0/chemfiles/fn.version.html new file mode 100644 index 000000000..5d6d08b8b --- /dev/null +++ b/0.10.0/chemfiles/fn.version.html @@ -0,0 +1,9 @@ +chemfiles::version - Rust + +

[][src]Function chemfiles::version

pub fn version() -> String

Get the version of the chemfiles library.

+

Example

+
+let version = chemfiles::version();
+assert!(version.starts_with("0.10"));
+
\ No newline at end of file diff --git a/0.10.0/chemfiles/frame/struct.Frame.html b/0.10.0/chemfiles/frame/struct.Frame.html new file mode 100644 index 000000000..0bcf1ad5e --- /dev/null +++ b/0.10.0/chemfiles/frame/struct.Frame.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Frame.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/index.html b/0.10.0/chemfiles/index.html new file mode 100644 index 000000000..7969e87a9 --- /dev/null +++ b/0.10.0/chemfiles/index.html @@ -0,0 +1,62 @@ +chemfiles - Rust + +

[][src]Crate chemfiles

Chemfiles is a multi-language library written in modern C++ for reading and +writing from and to molecular trajectory files. These files are created by +your favorite theoretical chemistry program, and contains information about +atomic or residues names and positions. Some format also have additional +information, such as velocities, forces, energy, …

+

This crate expose the C API of chemfiles to Rust, and make all the +functionalities accessible. For more information on the C++ library, +please see its documentation. Specifically, the following pages +are worth reading:

+ +

Structs

+
Atom

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
AtomMut

An analog to a mutable reference to an atom (&mut Atom)

+
AtomRef

An analog to a reference to an atom (&Atom)

+
Error

Error type for Chemfiles.

+
FormatMetadata

FormatMetadata contains metdata associated with one format.

+
Frame

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+
Match

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+
PropertiesIter

An iterator over the properties in an atom/frame/residue

+
Residue

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+
ResidueRef

An analog to a reference to a residue (&Residue)

+
Selection

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+
Topology

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, ...). It will +also contain all the residues information if it is available.

+
TopologyRef

An analog to a reference to a topology (&Topology)

+
Trajectory

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+
UnitCell

An UnitCell represent the box containing the atoms, and its periodicity.

+
UnitCellMut

An analog to a mutable reference to an unit cell (&mut UnitCell)

+
UnitCellRef

An analog to a reference to an unit cell (&UnitCell)

+

Enums

+
BondOrder

Possible bond order associated with bonds

+
CellShape

Available unit cell shapes.

+
Property

A Property is a piece of data that can be associated with an Atom or a +Frame.

+
Status

Possible causes of error in chemfiles

+

Functions

+
add_configuration

Read configuration data from the file at path.

+
formats_list

Get the list of formats known by chemfiles, as well as all associated metadata.

+
set_warning_callback

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
version

Get the version of the chemfiles library.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/metadata/fn.formats_list.html b/0.10.0/chemfiles/metadata/fn.formats_list.html new file mode 100644 index 000000000..93b494c4c --- /dev/null +++ b/0.10.0/chemfiles/metadata/fn.formats_list.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/fn.formats_list.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/metadata/struct.FormatMetadata.html b/0.10.0/chemfiles/metadata/struct.FormatMetadata.html new file mode 100644 index 000000000..f380c5718 --- /dev/null +++ b/0.10.0/chemfiles/metadata/struct.FormatMetadata.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.FormatMetadata.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/property/enum.Property.html b/0.10.0/chemfiles/property/enum.Property.html new file mode 100644 index 000000000..b3727aac1 --- /dev/null +++ b/0.10.0/chemfiles/property/enum.Property.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.Property.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/property/struct.PropertiesIter.html b/0.10.0/chemfiles/property/struct.PropertiesIter.html new file mode 100644 index 000000000..815bc6c1c --- /dev/null +++ b/0.10.0/chemfiles/property/struct.PropertiesIter.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.PropertiesIter.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/residue/struct.Residue.html b/0.10.0/chemfiles/residue/struct.Residue.html new file mode 100644 index 000000000..d9b75c1b0 --- /dev/null +++ b/0.10.0/chemfiles/residue/struct.Residue.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Residue.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/residue/struct.ResidueRef.html b/0.10.0/chemfiles/residue/struct.ResidueRef.html new file mode 100644 index 000000000..7219dbf27 --- /dev/null +++ b/0.10.0/chemfiles/residue/struct.ResidueRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.ResidueRef.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/selection/struct.Match.html b/0.10.0/chemfiles/selection/struct.Match.html new file mode 100644 index 000000000..848ab37f8 --- /dev/null +++ b/0.10.0/chemfiles/selection/struct.Match.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Match.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/selection/struct.Selection.html b/0.10.0/chemfiles/selection/struct.Selection.html new file mode 100644 index 000000000..2268a4ddb --- /dev/null +++ b/0.10.0/chemfiles/selection/struct.Selection.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Selection.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/sidebar-items.js b/0.10.0/chemfiles/sidebar-items.js new file mode 100644 index 000000000..c0f5040b0 --- /dev/null +++ b/0.10.0/chemfiles/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["BondOrder","Possible bond order associated with bonds"],["CellShape","Available unit cell shapes."],["Property","A `Property` is a piece of data that can be associated with an `Atom` or a `Frame`."],["Status","Possible causes of error in chemfiles"]],"fn":[["add_configuration","Read configuration data from the file at `path`."],["formats_list","Get the list of formats known by chemfiles, as well as all associated metadata."],["set_warning_callback","Use `callback` for every chemfiles warning. The callback will be passed the warning message. This will drop any previous warning callback."],["version","Get the version of the chemfiles library."]],"struct":[["Atom","An `Atom` is a particle in the current `Frame`. It stores the following atomic properties:"],["AtomMut","An analog to a mutable reference to an atom (`&mut Atom`)"],["AtomRef","An analog to a reference to an atom (`&Atom`)"],["Error","Error type for Chemfiles."],["FormatMetadata","`FormatMetadata` contains metdata associated with one format."],["Frame","A `Frame` contains data from one simulation step: the current unit cell, the topology, the positions, and the velocities of the particles in the system. If some information is missing (topology or velocity or unit cell), the corresponding data is filled with a default value."],["Match","A `Match` is a set of atomic indexes matching a given selection. It can mostly be used like a `&[usize]`."],["PropertiesIter","An iterator over the properties in an atom/frame/residue"],["Residue","A `Residue` is a group of atoms belonging to the same logical unit. They can be small molecules, amino-acids in a protein, monomers in polymers, etc."],["ResidueRef","An analog to a reference to a residue (`&Residue`)"],["Selection","A `Selection` allow to select atoms in a `Frame`, from a selection language. The selection language is built by combining basic operations. Each basic operation follows the `[()] ` structure, where `` is a comparison operator in `== != < <= > >=`."],["Topology","A `Topology` contains the definition of all the atoms in the system, and the liaisons between the atoms (bonds, angles, dihedrals, ...). It will also contain all the residues information if it is available."],["TopologyRef","An analog to a reference to a topology (`&Topology`)"],["Trajectory","The `Trajectory` type is the main entry point when using chemfiles. A `Trajectory` behave a bit like a file, allowing to read and/or write `Frame`."],["UnitCell","An `UnitCell` represent the box containing the atoms, and its periodicity."],["UnitCellMut","An analog to a mutable reference to an unit cell (`&mut UnitCell`)"],["UnitCellRef","An analog to a reference to an unit cell (`&UnitCell`)"]]}); \ No newline at end of file diff --git a/0.10.0/chemfiles/struct.Atom.html b/0.10.0/chemfiles/struct.Atom.html new file mode 100644 index 000000000..6440e7cbc --- /dev/null +++ b/0.10.0/chemfiles/struct.Atom.html @@ -0,0 +1,142 @@ +chemfiles::Atom - Rust + +

[][src]Struct chemfiles::Atom

pub struct Atom { /* fields omitted */ }

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
    +
  • atom name;
  • +
  • atom type;
  • +
  • atom mass;
  • +
  • atom charge.
  • +
+

The atom name is usually an unique identifier (H1, C_a) while the +atom type will be shared between all particles of the same type: H, +Ow, CH3.

+

Implementations

impl Atom[src]

pub fn new<'a>(name: impl Into<&'a str>) -> Atom[src]

Create an atom with the given name, and set the atom type to name.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

pub fn mass(&self) -> f64[src]

Get the atom mass, in atomic mass units.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

pub fn set_mass(&mut self, mass: f64)[src]

Set the atom mass to mass, in atomic mass units.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

pub fn charge(&self) -> f64[src]

Get the atom charge, in number of the electron charge e.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

pub fn set_charge(&mut self, charge: f64)[src]

Set the atom charge to charge, in number of the electron charge e.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

pub fn name(&self) -> String[src]

Get the atom name.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

pub fn atomic_type(&self) -> String[src]

Get the atom type.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

pub fn set_name<'a>(&mut self, name: impl Into<&'a str>)[src]

Set the atom name to name.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>)[src]

Set the atom type to atomic_type.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

pub fn full_name(&self) -> String[src]

Try to get the full name of the atom from the atomic type. For example, +the full name of "He" is "Helium", and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
+let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

pub fn vdw_radius(&self) -> f64[src]

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

pub fn covalent_radius(&self) -> f64[src]

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

pub fn atomic_number(&self) -> u64[src]

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

pub fn set(&mut self, name: &str, property: impl Into<Property>)[src]

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this atom, if it exist.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl Clone for Atom[src]

impl Drop for Atom[src]

Auto Trait Implementations

impl RefUnwindSafe for Atom

impl !Send for Atom

impl !Sync for Atom

impl Unpin for Atom

impl UnwindSafe for Atom

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.AtomMut.html b/0.10.0/chemfiles/struct.AtomMut.html new file mode 100644 index 000000000..082f67f62 --- /dev/null +++ b/0.10.0/chemfiles/struct.AtomMut.html @@ -0,0 +1,123 @@ +chemfiles::AtomMut - Rust + +

[][src]Struct chemfiles::AtomMut

pub struct AtomMut<'a> { /* fields omitted */ }

An analog to a mutable reference to an atom (&mut Atom)

+

Methods from Deref<Target = Atom>

pub fn mass(&self) -> f64[src]

Get the atom mass, in atomic mass units.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

pub fn set_mass(&mut self, mass: f64)[src]

Set the atom mass to mass, in atomic mass units.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

pub fn charge(&self) -> f64[src]

Get the atom charge, in number of the electron charge e.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

pub fn set_charge(&mut self, charge: f64)[src]

Set the atom charge to charge, in number of the electron charge e.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

pub fn name(&self) -> String[src]

Get the atom name.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

pub fn atomic_type(&self) -> String[src]

Get the atom type.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

pub fn set_name<'a>(&mut self, name: impl Into<&'a str>)[src]

Set the atom name to name.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>)[src]

Set the atom type to atomic_type.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

pub fn full_name(&self) -> String[src]

Try to get the full name of the atom from the atomic type. For example, +the full name of "He" is "Helium", and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
+let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

pub fn vdw_radius(&self) -> f64[src]

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

pub fn covalent_radius(&self) -> f64[src]

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

pub fn atomic_number(&self) -> u64[src]

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

pub fn set(&mut self, name: &str, property: impl Into<Property>)[src]

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this atom, if it exist.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl<'a> Deref for AtomMut<'a>[src]

type Target = Atom

The resulting type after dereferencing.

+

impl<'a> DerefMut for AtomMut<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for AtomMut<'a>

impl<'a> !Send for AtomMut<'a>

impl<'a> !Sync for AtomMut<'a>

impl<'a> Unpin for AtomMut<'a>

impl<'a> !UnwindSafe for AtomMut<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.AtomRef.html b/0.10.0/chemfiles/struct.AtomRef.html new file mode 100644 index 000000000..586b394c5 --- /dev/null +++ b/0.10.0/chemfiles/struct.AtomRef.html @@ -0,0 +1,83 @@ +chemfiles::AtomRef - Rust + +

[][src]Struct chemfiles::AtomRef

pub struct AtomRef<'a> { /* fields omitted */ }

An analog to a reference to an atom (&Atom)

+

Methods from Deref<Target = Atom>

pub fn mass(&self) -> f64[src]

Get the atom mass, in atomic mass units.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

pub fn charge(&self) -> f64[src]

Get the atom charge, in number of the electron charge e.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

pub fn name(&self) -> String[src]

Get the atom name.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

pub fn atomic_type(&self) -> String[src]

Get the atom type.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

pub fn full_name(&self) -> String[src]

Try to get the full name of the atom from the atomic type. For example, +the full name of "He" is "Helium", and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
+let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

pub fn vdw_radius(&self) -> f64[src]

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

pub fn covalent_radius(&self) -> f64[src]

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

pub fn atomic_number(&self) -> u64[src]

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this atom, if it exist.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl<'a> Deref for AtomRef<'a>[src]

type Target = Atom

The resulting type after dereferencing.

+

Auto Trait Implementations

impl<'a> RefUnwindSafe for AtomRef<'a>

impl<'a> !Send for AtomRef<'a>

impl<'a> !Sync for AtomRef<'a>

impl<'a> Unpin for AtomRef<'a>

impl<'a> UnwindSafe for AtomRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.Error.html b/0.10.0/chemfiles/struct.Error.html new file mode 100644 index 000000000..06bbc14dd --- /dev/null +++ b/0.10.0/chemfiles/struct.Error.html @@ -0,0 +1,39 @@ +chemfiles::Error - Rust + +

[][src]Struct chemfiles::Error

pub struct Error {
+    pub status: Status,
+    pub message: String,
+}

Error type for Chemfiles.

+

+ Fields

status: Status

The error status code

+
message: String

A message describing the error cause

+

Implementations

impl Error[src]

pub fn last_error() -> String[src]

Get the last error message from the C++ library.

+

pub fn cleanup()[src]

Clear any error from the C++ library

+

Trait Implementations

impl Clone for Error[src]

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

impl From<chfl_status> for Error[src]

impl PartialEq<Error> for Error[src]

impl StructuralPartialEq for Error[src]

Auto Trait Implementations

impl RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl UnwindSafe for Error

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.FormatMetadata.html b/0.10.0/chemfiles/struct.FormatMetadata.html new file mode 100644 index 000000000..c8349798e --- /dev/null +++ b/0.10.0/chemfiles/struct.FormatMetadata.html @@ -0,0 +1,52 @@ +chemfiles::FormatMetadata - Rust + +

[][src]Struct chemfiles::FormatMetadata

pub struct FormatMetadata {
+    pub name: &'static str,
+    pub extension: Option<&'static str>,
+    pub description: &'static str,
+    pub reference: &'static str,
+    pub read: bool,
+    pub write: bool,
+    pub memory: bool,
+    pub positions: bool,
+    pub velocities: bool,
+    pub unit_cell: bool,
+    pub atoms: bool,
+    pub bonds: bool,
+    pub residues: bool,
+}

FormatMetadata contains metdata associated with one format.

+

+ Fields

name: &'static str

Name of the format.

+
extension: Option<&'static str>

Extension associated with the format.

+
description: &'static str

Extended, user-facing description of the format.

+
reference: &'static str

URL pointing to the format definition/reference.

+
read: bool

Is reading files in this format implemented?

+
write: bool

Is writing files in this format implemented?

+
memory: bool

Does this format support in-memory IO?

+
positions: bool

Does this format support storing atomic positions?

+
velocities: bool

Does this format support storing atomic velocities?

+
unit_cell: bool

Does this format support storing unit cell information?

+
atoms: bool

Does this format support storing atom names or types?

+
bonds: bool

Does this format support storing bonds between atoms?

+
residues: bool

Does this format support storing residues?

+

Trait Implementations

impl Clone for FormatMetadata[src]

impl Debug for FormatMetadata[src]

impl Eq for FormatMetadata[src]

impl PartialEq<FormatMetadata> for FormatMetadata[src]

impl StructuralEq for FormatMetadata[src]

impl StructuralPartialEq for FormatMetadata[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.Frame.html b/0.10.0/chemfiles/struct.Frame.html new file mode 100644 index 000000000..d85957c8e --- /dev/null +++ b/0.10.0/chemfiles/struct.Frame.html @@ -0,0 +1,387 @@ +chemfiles::Frame - Rust + +

[][src]Struct chemfiles::Frame

pub struct Frame { /* fields omitted */ }

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

Implementations

impl Frame[src]

pub fn new() -> Frame[src]

Create an empty frame. It will be resized by the library as needed.

+

Example

+
+let frame = Frame::new();
+
+assert_eq!(frame.size(), 0);
+

pub fn atom(&self, index: usize) -> AtomRef<'_>[src]

Get a reference to the atom at the given index in this frame.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+let atom = frame.atom(0);
+assert_eq!(atom.name(), "Zn");
+

pub fn atom_mut(&mut self, index: usize) -> AtomMut<'_>[src]

Get a mutable reference to the atom at the given index in this frame.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+assert_eq!(frame.atom(0).name(), "Zn");
+
+frame.atom_mut(0).set_name("Fe");
+assert_eq!(frame.atom(0).name(), "Fe");
+

pub fn size(&self) -> usize[src]

Get the current number of atoms in this frame.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.size(), 0);
+
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

pub fn resize(&mut self, natoms: usize)[src]

Resize the positions and the velocities in this frame, to make space for +natoms atoms. Previous data is conserved, as well as the presence of +absence of velocities.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

pub fn add_atom(
    &mut self,
    atom: &Atom,
    position: [f64; 3],
    velocity: impl Into<Option<[f64; 3]>>
)
[src]

Add an Atom and the corresponding position and optionally velocity +data to this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+
+frame.add_velocities();
+frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+

pub fn remove(&mut self, i: usize)[src]

Remove the atom at index i in this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+assert_eq!(frame.size(), 3);
+
+frame.remove(1);
+assert_eq!(frame.size(), 2);
+assert_eq!(frame.atom(1).name(), "Sn");
+

pub fn add_bond(&mut self, i: usize, j: usize)[src]

Add a bond between the atoms at indexes i and j in the frame.

+

The bond order is set to BondOrder::Unknown.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+assert_eq!(frame.topology().bonds_count(), 3);
+
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+

pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder)[src]

Add a bond between the atoms at indexes i and j in the frame +with the given bond order.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(2);
+
+frame.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+

pub fn remove_bond(&mut self, i: usize, j: usize)[src]

Remove any existing bond between the atoms at indexes i and j in +the frame.

+

This function does nothing if there is no bond between i and j.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+
+frame.remove_bond(2, 4);
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+

pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error>[src]

Add a copy of residue to this frame.

+

Errors

+

This function fails is the residue id is already in this frame's +topology, or if the residue contain atoms that are already in another +residue.

+

Example

+
+let mut frame = Frame::new();
+
+let residue = Residue::new("foo");
+frame.add_residue(&residue).unwrap();
+
+let topology = frame.topology();
+assert_eq!(topology.residues_count(), 1);
+assert_eq!(topology.residue(0).unwrap().name(), "foo");
+

pub fn distance(&self, i: usize, j: usize) -> f64[src]

Get the distance between the atoms at indexes i and j in this frame, +accounting for periodic boundary conditions. The result is expressed in +Angstroms.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+
+assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+

pub fn angle(&self, i: usize, j: usize, k: usize) -> f64[src]

Get the angle formed by the atoms at indexes i, j and k in this +frame, accounting for periodic boundary conditions. The result is +expressed in radians.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+

pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64[src]

Get the dihedral angle formed by the atoms at indexes i, j, k and +m in this frame, accounting for periodic boundary conditions. The +result is expressed in radians.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+
+assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+

pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64[src]

Get the out of plane distance formed by the atoms at indexes i, j, +k and m in this frame, accounting for periodic boundary conditions. +The result is expressed in angstroms.

+

This is the distance between the atom j and the ikm plane. The j atom +is the center of the improper dihedral angle formed by i, j, k and m.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+

pub fn positions(&self) -> &[[f64; 3]][src]

Get a view into the positions of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+
+let positions = frame.positions();
+assert_eq!(positions.len(), 67);
+assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+

pub fn positions_mut(&mut self) -> &mut [[f64; 3]][src]

Get a mutable view into the positions of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+{
+    let positions = frame.positions_mut();
+    assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    positions[0] = [1.0, 2.0, 3.0];
+}
+
+let positions = frame.positions();
+assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+

pub fn velocities(&self) -> &[[f64; 3]][src]

Get a view into the velocities of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+
+let velocities = frame.velocities();
+assert_eq!(velocities.len(), 67);
+assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+

pub fn velocities_mut(&mut self) -> &mut [[f64; 3]][src]

Get a mutable view into the velocities of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+{
+    let velocities = frame.velocities_mut();
+    assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    velocities[0] = [1.0, 2.0, 3.0];
+}
+
+let velocities = frame.velocities();
+assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+

pub fn has_velocities(&self) -> bool[src]

Check if this frame contains velocity data.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

pub fn add_velocities(&mut self)[src]

Add velocity data to this frame. If the frame already have velocities, +this does nothing.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

pub fn cell(&self) -> UnitCellRef<'_>[src]

Get a reference to the UnitCell from this frame.

+

Example

+
+let frame = Frame::new();
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Infinite);
+

pub fn cell_mut(&mut self) -> UnitCellMut<'_>[src]

Get a mutable reference to the UnitCell from this frame.

+

Example

+
+let mut frame = Frame::new();
+
+assert_eq!(frame.cell().shape(), CellShape::Infinite);
+
+frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+

pub fn set_cell(&mut self, cell: &UnitCell)[src]

Set the UnitCell of this frame to cell.

+

Example

+
+let mut frame = Frame::new();
+
+frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+

pub fn topology(&self) -> TopologyRef<'_>[src]

Get a reference to the Topology of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(42);
+
+let topology = frame.topology();
+assert_eq!(topology.size(), 42);
+

pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error>[src]

Set the Topology of this frame to topology.

+

Errors

+

This function fails if the topology contains a different number of atoms +than this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(2);
+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Cl"));
+topology.add_atom(&Atom::new("Cl"));
+topology.add_bond(0, 1);
+
+frame.set_topology(&topology).unwrap();
+assert_eq!(frame.atom(0).name(), "Cl");
+

pub fn step(&self) -> usize[src]

Get this frame step, i.e. the frame number in the trajectory

+

Example

+
+let frame = Frame::new();
+assert_eq!(frame.step(), 0);
+

pub fn set_step(&mut self, step: usize)[src]

Set this frame step to step.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
+frame.set_step(10);
+assert_eq!(frame.step(), 10);
+

pub fn guess_bonds(&mut self) -> Result<(), Error>[src]

Guess the bonds, angles and dihedrals in this frame.

+

The bonds are guessed using a distance-based algorithm, and then angles +and dihedrals are guessed from the bonds.

+

Errors

+

This function can fail if the covalent radius is unknown for some atoms +in the frame.

+

Example

+
+let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+assert_eq!(frame.topology().bonds_count(), 0);
+
+frame.guess_bonds().unwrap();
+assert_eq!(frame.topology().bonds_count(), 1);
+

pub fn clear_bonds(&mut self)[src]

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology of the frame.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+
+frame.add_bond(0, 1);
+frame.add_bond(1, 2);
+
+assert_eq!(frame.topology().bonds().len(), 2);
+assert_eq!(frame.topology().angles().len(), 1);
+
+frame.clear_bonds();
+assert!(frame.topology().bonds().is_empty());
+assert!(frame.topology().angles().is_empty());
+

pub fn set(&mut self, name: &str, property: impl Into<Property>)[src]

Add a new property with the given name to this frame.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
+let mut frame = Frame::new();
+frame.set("a string", "hello");
+frame.set("a double", 4.3);
+
+assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this frame, if it exist.

+

Examples

+
+let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+
+assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(frame.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
+let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+frame.set("bar", Property::Bool(false));
+
+for (name, property) in frame.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl Clone for Frame[src]

impl Drop for Frame[src]

Auto Trait Implementations

impl RefUnwindSafe for Frame

impl !Send for Frame

impl !Sync for Frame

impl Unpin for Frame

impl UnwindSafe for Frame

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.Match.html b/0.10.0/chemfiles/struct.Match.html new file mode 100644 index 000000000..5913e0116 --- /dev/null +++ b/0.10.0/chemfiles/struct.Match.html @@ -0,0 +1,56 @@ +chemfiles::Match - Rust + +

[][src]Struct chemfiles::Match

pub struct Match { /* fields omitted */ }

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

Implementations

impl Match[src]

pub fn len(&self) -> usize[src]

Get the length of the Match.

+

Example

+
+let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+

pub fn new(atoms: &[usize]) -> Match[src]

Create a new match containing the atoms in the atoms slice.

+

Panics

+

If the slice contains more than 4 elements, which is the maximal size +of a match.

+

Example

+
+let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+assert_eq!(atomic_match[0], 3);
+assert_eq!(atomic_match[1], 4);
+assert_eq!(atomic_match[2], 5);
+

pub fn iter(&self) -> Iter<'_, usize>[src]

Iterate over the atomic indexes in the match.

+

Example

+
+let atomic_match = Match::new(&[3, 4, 5]);
+let mut iter = atomic_match.iter();
+
+assert_eq!(iter.next(), Some(&3));
+assert_eq!(iter.next(), Some(&4));
+assert_eq!(iter.next(), Some(&5));
+assert_eq!(iter.next(), None);
+

Trait Implementations

impl Clone for Match[src]

impl Debug for Match[src]

impl Eq for Match[src]

impl Index<usize> for Match[src]

type Output = usize

The returned type after indexing.

+

impl<'a> IntoIterator for &'a Match[src]

type Item = &'a usize

The type of the elements being iterated over.

+

type IntoIter = Iter<'a, usize>

Which kind of iterator are we turning this into?

+

impl PartialEq<Match> for Match[src]

impl StructuralEq for Match[src]

impl StructuralPartialEq for Match[src]

Auto Trait Implementations

impl RefUnwindSafe for Match

impl Send for Match

impl Sync for Match

impl Unpin for Match

impl UnwindSafe for Match

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.PropertiesIter.html b/0.10.0/chemfiles/struct.PropertiesIter.html new file mode 100644 index 000000000..288931ea4 --- /dev/null +++ b/0.10.0/chemfiles/struct.PropertiesIter.html @@ -0,0 +1,128 @@ +chemfiles::PropertiesIter - Rust + +

[][src]Struct chemfiles::PropertiesIter

pub struct PropertiesIter<'a> { /* fields omitted */ }

An iterator over the properties in an atom/frame/residue

+

Trait Implementations

impl<'a> Iterator for PropertiesIter<'a>[src]

type Item = (String, Property)

The type of the elements being iterated over.

+

Auto Trait Implementations

impl<'a> !RefUnwindSafe for PropertiesIter<'a>

impl<'a> !Send for PropertiesIter<'a>

impl<'a> !Sync for PropertiesIter<'a>

impl<'a> Unpin for PropertiesIter<'a>

impl<'a> !UnwindSafe for PropertiesIter<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.Residue.html b/0.10.0/chemfiles/struct.Residue.html new file mode 100644 index 000000000..7b89b576e --- /dev/null +++ b/0.10.0/chemfiles/struct.Residue.html @@ -0,0 +1,119 @@ +chemfiles::Residue - Rust + +

[][src]Struct chemfiles::Residue

pub struct Residue { /* fields omitted */ }

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

Implementations

impl Residue[src]

pub fn new<'a>(name: impl Into<&'a str>) -> Residue[src]

Create a new residue with the given name

+

Example

+
+let residue = Residue::new("ALA");
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), None);
+

pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue[src]

Create a new residue with the given name and id as identifier.

+

Example

+
+let residue = Residue::with_id("ALA", 67);
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), Some(67));
+

pub fn size(&self) -> usize[src]

Get the number of atoms in this residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

pub fn id(&self) -> Option<i64>[src]

Get the identifier of this residue in the initial topology file.

+

Example

+
+let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

pub fn name(&self) -> String[src]

Get the name of this residue.

+

Example

+
+let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

pub fn add_atom(&mut self, atom: usize)[src]

Add the atom at index atom in this residue.

+

This will fail if the atom is already in the residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+assert_eq!(residue.contains(56), true);
+
+// Adding the same atom twice is fine
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+

pub fn contains(&self, atom: usize) -> bool[src]

Check if the atom at index i is in this residue

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

pub fn atoms(&self) -> Vec<usize>[src]

Get the list of atoms of this residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

pub fn set(&mut self, name: &str, property: impl Into<Property>)[src]

Add a new property with the given name to this residue.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("a string", "hello");
+residue.set("a double", 3.2);
+
+assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this frame, if it exist.

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl Clone for Residue[src]

impl Drop for Residue[src]

Auto Trait Implementations

impl RefUnwindSafe for Residue

impl !Send for Residue

impl !Sync for Residue

impl Unpin for Residue

impl UnwindSafe for Residue

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.ResidueRef.html b/0.10.0/chemfiles/struct.ResidueRef.html new file mode 100644 index 000000000..595710f1c --- /dev/null +++ b/0.10.0/chemfiles/struct.ResidueRef.html @@ -0,0 +1,74 @@ +chemfiles::ResidueRef - Rust + +

[][src]Struct chemfiles::ResidueRef

pub struct ResidueRef<'a> { /* fields omitted */ }

An analog to a reference to a residue (&Residue)

+

Methods from Deref<Target = Residue>

pub fn size(&self) -> usize[src]

Get the number of atoms in this residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

pub fn id(&self) -> Option<i64>[src]

Get the identifier of this residue in the initial topology file.

+

Example

+
+let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

pub fn name(&self) -> String[src]

Get the name of this residue.

+

Example

+
+let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

pub fn contains(&self, atom: usize) -> bool[src]

Check if the atom at index i is in this residue

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

pub fn atoms(&self) -> Vec<usize>[src]

Get the list of atoms of this residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this frame, if it exist.

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl<'a> Deref for ResidueRef<'a>[src]

type Target = Residue

The resulting type after dereferencing.

+

Auto Trait Implementations

impl<'a> RefUnwindSafe for ResidueRef<'a>

impl<'a> !Send for ResidueRef<'a>

impl<'a> !Sync for ResidueRef<'a>

impl<'a> Unpin for ResidueRef<'a>

impl<'a> UnwindSafe for ResidueRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.Selection.html b/0.10.0/chemfiles/struct.Selection.html new file mode 100644 index 000000000..6f7f37c0e --- /dev/null +++ b/0.10.0/chemfiles/struct.Selection.html @@ -0,0 +1,82 @@ +chemfiles::Selection - Rust + +

[][src]Struct chemfiles::Selection

pub struct Selection { /* fields omitted */ }

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

Implementations

impl Selection[src]

pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error>[src]

Create a new selection from the given selection string.

+

Errors

+

This function fails if the selection string is invalid.

+

Example

+
+let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+

pub fn size(&self) -> usize[src]

Get the size of the selection, i.e. the number of atoms we are selecting +together.

+

This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond' +context, 3 for the 'three' and 'angles' context and 4 for the 'four' +and 'dihedral' context.

+

Example

+
+let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+assert_eq!(selection.size(), 2);
+

pub fn string(&self) -> String[src]

Get the selection string used to create this selection.

+

Example

+
+let selection = Selection::new("name H").unwrap();
+assert_eq!(selection.string(), "name H");
+

pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match>[src]

Evaluate a selection for a given frame, and return the corresponding +matches.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+let matches = selection.evaluate(&frame);
+
+assert_eq!(matches.len(), 2);
+
+assert_eq!(matches[0].len(), 2);
+assert_eq!(matches[0][0], 0);
+assert_eq!(matches[0][1], 1);
+
+assert_eq!(matches[1].len(), 2);
+assert_eq!(matches[1][0], 2);
+assert_eq!(matches[1][1], 1);
+

pub fn list(&mut self, frame: &Frame) -> Vec<usize>[src]

Evaluates a selection of size 1 on a given frame. This function +returns the list of atomic indexes in the frame matching this selection.

+

Panics

+

If the selection size is not 1

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("name H").unwrap();
+let matches = selection.list(&frame);
+
+assert_eq!(matches.len(), 2);
+assert_eq!(matches[0], 0);
+assert_eq!(matches[1], 2);
+

Trait Implementations

impl Clone for Selection[src]

impl Drop for Selection[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.Topology.html b/0.10.0/chemfiles/struct.Topology.html new file mode 100644 index 000000000..1e168989e --- /dev/null +++ b/0.10.0/chemfiles/struct.Topology.html @@ -0,0 +1,311 @@ +chemfiles::Topology - Rust + +

[][src]Struct chemfiles::Topology

pub struct Topology { /* fields omitted */ }

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, ...). It will +also contain all the residues information if it is available.

+

Implementations

impl Topology[src]

pub fn new() -> Topology[src]

Create a new empty topology.

+

Example

+
+let topology = Topology::new();
+assert_eq!(topology.size(), 0);
+

pub fn atom(&self, index: usize) -> AtomRef<'_>[src]

Get a reference of the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

pub fn atom_mut(&mut self, index: usize) -> AtomMut<'_>[src]

Get a mutable reference to the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(6);
+
+assert_eq!(topology.atom(4).name(), "");
+
+topology.atom_mut(4).set_name("Fe");
+assert_eq!(topology.atom(4).name(), "Fe");
+

pub fn size(&self) -> usize[src]

Get the current number of atoms in this topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

pub fn resize(&mut self, natoms: usize)[src]

Resize this topology to hold natoms atoms, inserting dummy atoms if +the new size if bigger than the old one.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

pub fn add_atom(&mut self, atom: &Atom)[src]

Add an Atom at the end of this topology

+

Example

+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Mg"));
+
+let atom = topology.atom(0);
+assert_eq!(atom.name(), "Mg");
+

pub fn remove(&mut self, index: usize)[src]

Remove an Atom from this topology by index. This modify all the +other atoms indexes.

+

Panics

+

If the index is out of bounds

+

Example

+
+let mut topology = Topology::new();
+topology.resize(9);
+assert_eq!(topology.size(), 9);
+
+topology.remove(7);
+assert_eq!(topology.size(), 8);
+

pub fn bonds_count(&self) -> usize[src]

Get the number of bonds in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

pub fn angles_count(&self) -> usize[src]

Get the number of angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

pub fn dihedrals_count(&self) -> usize[src]

Get the number of dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

pub fn impropers_count(&self) -> usize[src]

Get the number of improper dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

pub fn bonds(&self) -> Vec<[usize; 2]>[src]

Get the list of bonds in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

pub fn angles(&self) -> Vec<[usize; 3]>[src]

Get the list of angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

pub fn dihedrals(&self) -> Vec<[usize; 4]>[src]

Get the list of dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

pub fn impropers(&self) -> Vec<[usize; 4]>[src]

Get the list of improper dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

pub fn clear_bonds(&mut self)[src]

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+assert_eq!(topology.angles().len(), 1);
+
+topology.clear_bonds();
+assert!(topology.bonds().is_empty());
+assert!(topology.angles().is_empty());
+

pub fn add_bond(&mut self, i: usize, j: usize)[src]

Add a bond between the atoms at indexes i and j in the topology.

+

The bond order is set to BondOrder::Unknown.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+

pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder)[src]

Add a bond between the atoms at indexes i and j in the topology +with the given bond order.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

pub fn bond_order(&self, i: usize, j: usize) -> BondOrder[src]

Get the bond order for the bond between the atoms at indexes i and +j.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

pub fn bond_orders(&self) -> Vec<BondOrder>[src]

Get the bond order for all the bonds in the topology

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

pub fn remove_bond(&mut self, i: usize, j: usize)[src]

Remove any existing bond between the atoms at indexes i and j in +this topology.

+

This function does nothing if there is no bond between i and j.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+topology.remove_bond(0, 1);
+assert_eq!(topology.bonds_count(), 1);
+
+// Removing a bond that does not exists is fine
+topology.remove_bond(0, 2);
+assert_eq!(topology.bonds_count(), 1);
+

pub fn residue(&self, index: u64) -> Option<ResidueRef<'_>>[src]

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+

Example

+
+let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef<'_>>[src]

Get a copy of the residue containing the atom at index index in this +topology, if any.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

pub fn residues_count(&self) -> u64[src]

Get the number of residues in this topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error>[src]

Add a residue to this topology.

+

Errors

+

This function fails is the residue id is not already in the topology, +or if the residue contains atoms that are already in another residue.

+

Example

+
+let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool[src]

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+

Example

+
+let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

impl Clone for Topology[src]

impl Drop for Topology[src]

Auto Trait Implementations

impl RefUnwindSafe for Topology

impl !Send for Topology

impl !Sync for Topology

impl Unpin for Topology

impl UnwindSafe for Topology

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.TopologyRef.html b/0.10.0/chemfiles/struct.TopologyRef.html new file mode 100644 index 000000000..23fd8235b --- /dev/null +++ b/0.10.0/chemfiles/struct.TopologyRef.html @@ -0,0 +1,190 @@ +chemfiles::TopologyRef - Rust + +

[][src]Struct chemfiles::TopologyRef

pub struct TopologyRef<'a> { /* fields omitted */ }

An analog to a reference to a topology (&Topology)

+

Methods from Deref<Target = Topology>

pub fn atom(&self, index: usize) -> AtomRef<'_>[src]

Get a reference of the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

pub fn size(&self) -> usize[src]

Get the current number of atoms in this topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

pub fn bonds_count(&self) -> usize[src]

Get the number of bonds in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

pub fn angles_count(&self) -> usize[src]

Get the number of angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

pub fn dihedrals_count(&self) -> usize[src]

Get the number of dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

pub fn impropers_count(&self) -> usize[src]

Get the number of improper dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

pub fn bonds(&self) -> Vec<[usize; 2]>[src]

Get the list of bonds in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

pub fn angles(&self) -> Vec<[usize; 3]>[src]

Get the list of angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

pub fn dihedrals(&self) -> Vec<[usize; 4]>[src]

Get the list of dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

pub fn impropers(&self) -> Vec<[usize; 4]>[src]

Get the list of improper dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

pub fn bond_order(&self, i: usize, j: usize) -> BondOrder[src]

Get the bond order for the bond between the atoms at indexes i and +j.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

pub fn bond_orders(&self) -> Vec<BondOrder>[src]

Get the bond order for all the bonds in the topology

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

pub fn residue(&self, index: u64) -> Option<ResidueRef<'_>>[src]

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+

Example

+
+let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef<'_>>[src]

Get a copy of the residue containing the atom at index index in this +topology, if any.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

pub fn residues_count(&self) -> u64[src]

Get the number of residues in this topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool[src]

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+

Example

+
+let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

impl<'a> Deref for TopologyRef<'a>[src]

type Target = Topology

The resulting type after dereferencing.

+

Auto Trait Implementations

impl<'a> RefUnwindSafe for TopologyRef<'a>

impl<'a> !Send for TopologyRef<'a>

impl<'a> !Sync for TopologyRef<'a>

impl<'a> Unpin for TopologyRef<'a>

impl<'a> UnwindSafe for TopologyRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.Trajectory.html b/0.10.0/chemfiles/struct.Trajectory.html new file mode 100644 index 000000000..c6a340d68 --- /dev/null +++ b/0.10.0/chemfiles/struct.Trajectory.html @@ -0,0 +1,174 @@ +chemfiles::Trajectory - Rust + +

[][src]Struct chemfiles::Trajectory

pub struct Trajectory { /* fields omitted */ }

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

Implementations

impl Trajectory[src]

pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error> where
    P: AsRef<Path>, 
[src]

Open the file at the given path in the given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Errors

+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+

Example

+
+let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+

pub fn open_with_format<'a, P, S>(
    filename: P,
    mode: char,
    format: S
) -> Result<Trajectory, Error> where
    P: AsRef<Path>,
    S: Into<&'a str>, 
[src]

Open the file at the given path using a specific file format and the +given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Specifying a format is needed when the file format does not match the +extension, or when there is not standard extension for this format. If +format is an empty string, the format will be guessed from the +extension.

+

Errors

+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+

Example

+
+let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+

pub fn memory_reader<'a, S>(data: S, format: S) -> Result<Trajectory, Error> where
    S: Into<&'a str>, 
[src]

Read a memory buffer as though it was a formatted file.

+

The memory buffer used to store the file is given using the data +argument. The format parameter is required and should follow the same +rules as in the main Trajectory constructor.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format, or if the format do not support in-memory readers.

+

Example

+
+let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+let mut frame = Frame::new();
+trajectory.read(&mut frame).unwrap();
+assert_eq!(frame.size(), 6);
+

pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error> where
    S: Into<&'a str>, 
[src]

Write to a memory buffer as though it was a formatted file.

+

The format parameter should follow the same rules as in the main +Trajectory constructor, except that compression specification +is not supported.

+

The memory_buffer function can be used to retrieve the data written +to memory of the Trajectory.

+

Errors

+

This function fails if the format do not support in-memory writers.

+

Example

+
+let trajectory_memory = Trajectory::memory_writer("SMI");
+
+// Binary formats typically do not support this feature
+assert!(Trajectory::memory_writer("XTC").is_err());
+

pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error>[src]

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+

Example

+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+

pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error>[src]

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format.

+

Example

+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+

pub fn write(&mut self, frame: &Frame) -> Result<(), Error>[src]

Write a frame to this trajectory.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format.

+

Example

+
+let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+

pub fn set_topology(&mut self, topology: &Topology)[src]

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+

Example

+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+

pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error> where
    P: AsRef<Path>, 
[src]

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+

Errors

+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+

Example

+
+let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+

pub fn set_topology_with_format<'a, P, S>(
    &mut self,
    path: P,
    format: S
) -> Result<(), Error> where
    P: AsRef<Path>,
    S: Into<&'a str>, 
[src]

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+

Errors

+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+

Example

+
+let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+

pub fn set_cell(&mut self, cell: &UnitCell)[src]

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+

Example

+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+

pub fn nsteps(&mut self) -> usize[src]

Get the number of steps (the number of frames) in a trajectory.

+

Example

+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+

pub fn memory_buffer(&self) -> Result<&str, Error>[src]

Obtain the memory buffer written to by the trajectory.

+

Errors

+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+

Example

+
+let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+

pub fn path(&self) -> String[src]

Get file path for this trajectory.

+

Example

+
+let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations

impl Drop for Trajectory[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.UnitCell.html b/0.10.0/chemfiles/struct.UnitCell.html new file mode 100644 index 000000000..653daf4d3 --- /dev/null +++ b/0.10.0/chemfiles/struct.UnitCell.html @@ -0,0 +1,166 @@ +chemfiles::UnitCell - Rust + +

[][src]Struct chemfiles::UnitCell

pub struct UnitCell { /* fields omitted */ }

An UnitCell represent the box containing the atoms, and its periodicity.

+

An unit cell is fully represented by three lengths (a, b, c); and three +angles (alpha, beta, gamma). The angles are stored in degrees, and the +lengths in Angstroms.

+

A cell also has a matricial representation, by projecting the three base +vector into an orthonormal base. We choose to represent such matrix as an +upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
+

Implementations

impl UnitCell[src]

pub fn new(lengths: [f64; 3]) -> UnitCell[src]

Create an Orthorhombic UnitCell from the three lengths, in Angstroms.

+

Example

+
+let cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn infinite() -> UnitCell[src]

Create an Infinite UnitCell.

+

Example

+
+let cell = UnitCell::infinite();
+
+assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Infinite);
+

pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell[src]

Create an Triclinic UnitCell from the three lengths (in Angstroms) +and three angles (in degree). alpha is the angle between the vectors +b and c; beta is the between the vectors a and c and gamma +is the angle between the vectors a and b.

+

Example

+
+let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+assert_eq!(cell.angles()[0], 98.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

pub fn from_matrix(matrix: [[f64; 3]; 3]) -> UnitCell[src]

Create an UnitCell from a cell matrix. If matrix contains only +zeros, then an Infinite cell is created. If only the diagonal of the +matrix is non-zero, then the cell is Orthorhombic. Else a +Triclinic cell is created. The matrix entries should be in Angstroms.

+

Panics

+

If the matrix has a negative determinant, or more generally is not +representing a unit cell.

+

Example

+
+let cell = UnitCell::from_matrix([
+    [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+]);
+
+assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn lengths(&self) -> [f64; 3][src]

Get the three lengths of the cell, in Angstroms.

+

Example

+
+let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error>[src]

Set the three lengths of the cell, in Angstroms.

+

Errors

+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+

Example

+
+let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

pub fn angles(&self) -> [f64; 3][src]

Get the three angles of the cell, in degrees.

+

Example

+
+let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error>[src]

Set the three angles of the cell, in degrees.

+

Errors

+

This function fails if the unit cell is not Triclinic.

+

Example

+
+let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

pub fn matrix(&self) -> [[f64; 3]; 3][src]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

pub fn shape(&self) -> CellShape[src]

Get the shape of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error>[src]

Set the shape of the unit cell to shape.

+

Errors

+

This can fail if the cell length or angles are incompatible with the +new shape.

+

Example

+
+let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

pub fn volume(&self) -> f64[src]

Get the volume of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

pub fn wrap(&self, vector: &mut [f64; 3])[src]

Wrap a vector in this unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

impl Clone for UnitCell[src]

impl Drop for UnitCell[src]

Auto Trait Implementations

impl RefUnwindSafe for UnitCell

impl !Send for UnitCell

impl !Sync for UnitCell

impl Unpin for UnitCell

impl UnwindSafe for UnitCell

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.UnitCellMut.html b/0.10.0/chemfiles/struct.UnitCellMut.html new file mode 100644 index 000000000..b784ef277 --- /dev/null +++ b/0.10.0/chemfiles/struct.UnitCellMut.html @@ -0,0 +1,106 @@ +chemfiles::UnitCellMut - Rust + +

[][src]Struct chemfiles::UnitCellMut

pub struct UnitCellMut<'a> { /* fields omitted */ }

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

Methods from Deref<Target = UnitCell>

pub fn lengths(&self) -> [f64; 3][src]

Get the three lengths of the cell, in Angstroms.

+

Example

+
+let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error>[src]

Set the three lengths of the cell, in Angstroms.

+

Errors

+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+

Example

+
+let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

pub fn angles(&self) -> [f64; 3][src]

Get the three angles of the cell, in degrees.

+

Example

+
+let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error>[src]

Set the three angles of the cell, in degrees.

+

Errors

+

This function fails if the unit cell is not Triclinic.

+

Example

+
+let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

pub fn matrix(&self) -> [[f64; 3]; 3][src]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

pub fn shape(&self) -> CellShape[src]

Get the shape of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error>[src]

Set the shape of the unit cell to shape.

+

Errors

+

This can fail if the cell length or angles are incompatible with the +new shape.

+

Example

+
+let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

pub fn volume(&self) -> f64[src]

Get the volume of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

pub fn wrap(&self, vector: &mut [f64; 3])[src]

Wrap a vector in this unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

impl<'a> Deref for UnitCellMut<'a>[src]

type Target = UnitCell

The resulting type after dereferencing.

+

impl<'a> DerefMut for UnitCellMut<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for UnitCellMut<'a>

impl<'a> !Send for UnitCellMut<'a>

impl<'a> !Sync for UnitCellMut<'a>

impl<'a> Unpin for UnitCellMut<'a>

impl<'a> !UnwindSafe for UnitCellMut<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/struct.UnitCellRef.html b/0.10.0/chemfiles/struct.UnitCellRef.html new file mode 100644 index 000000000..408e0ffaa --- /dev/null +++ b/0.10.0/chemfiles/struct.UnitCellRef.html @@ -0,0 +1,69 @@ +chemfiles::UnitCellRef - Rust + +

[][src]Struct chemfiles::UnitCellRef

pub struct UnitCellRef<'a> { /* fields omitted */ }

An analog to a reference to an unit cell (&UnitCell)

+

Methods from Deref<Target = UnitCell>

pub fn lengths(&self) -> [f64; 3][src]

Get the three lengths of the cell, in Angstroms.

+

Example

+
+let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

pub fn angles(&self) -> [f64; 3][src]

Get the three angles of the cell, in degrees.

+

Example

+
+let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

pub fn matrix(&self) -> [[f64; 3]; 3][src]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

pub fn shape(&self) -> CellShape[src]

Get the shape of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn volume(&self) -> f64[src]

Get the volume of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

pub fn wrap(&self, vector: &mut [f64; 3])[src]

Wrap a vector in this unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

impl<'a> Deref for UnitCellRef<'a>[src]

type Target = UnitCell

The resulting type after dereferencing.

+

Auto Trait Implementations

impl<'a> RefUnwindSafe for UnitCellRef<'a>

impl<'a> !Send for UnitCellRef<'a>

impl<'a> !Sync for UnitCellRef<'a>

impl<'a> Unpin for UnitCellRef<'a>

impl<'a> UnwindSafe for UnitCellRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
\ No newline at end of file diff --git a/0.10.0/chemfiles/topology/enum.BondOrder.html b/0.10.0/chemfiles/topology/enum.BondOrder.html new file mode 100644 index 000000000..cb0d340ce --- /dev/null +++ b/0.10.0/chemfiles/topology/enum.BondOrder.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.BondOrder.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/topology/struct.Topology.html b/0.10.0/chemfiles/topology/struct.Topology.html new file mode 100644 index 000000000..53c3a8234 --- /dev/null +++ b/0.10.0/chemfiles/topology/struct.Topology.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Topology.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/topology/struct.TopologyRef.html b/0.10.0/chemfiles/topology/struct.TopologyRef.html new file mode 100644 index 000000000..1a31a3219 --- /dev/null +++ b/0.10.0/chemfiles/topology/struct.TopologyRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.TopologyRef.html...

+ + + \ No newline at end of file diff --git a/0.10.0/chemfiles/trajectory/struct.Trajectory.html b/0.10.0/chemfiles/trajectory/struct.Trajectory.html new file mode 100644 index 000000000..8d4845dd3 --- /dev/null +++ b/0.10.0/chemfiles/trajectory/struct.Trajectory.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Trajectory.html...

+ + + \ No newline at end of file diff --git a/0.10.0/dark.css b/0.10.0/dark.css new file mode 100644 index 000000000..b49cae1c1 --- /dev/null +++ b/0.10.0/dark.css @@ -0,0 +1 @@ +body{background-color:#353535;color:#ddd;}h1,h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){color:#ddd;}h1.fqn{border-bottom-color:#d2d2d2;}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){border-bottom-color:#d2d2d2;}.in-band{background-color:#353535;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#2A2A2A;}pre{background-color:#2A2A2A;}.sidebar{background-color:#505050;}.logo-container.rust-logo>img{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}*{scrollbar-color:rgb(64,65,67) #717171;}.sidebar{scrollbar-color:rgba(32,34,37,.6) transparent;}::-webkit-scrollbar-track{background-color:#717171;}::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar::-webkit-scrollbar-track{background-color:#717171;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar .current{background-color:#333;}.source .sidebar{background-color:#353535;}.sidebar .location{border-color:#fff;background:#575757;color:#DDD;}.sidebar .version{border-bottom-color:#DDD;}.sidebar-title{border-top-color:#777;border-bottom-color:#777;}.block a:hover{background:#444;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#DDD;}.docblock table,.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#ddd;}.content .highlighted{color:#eee !important;background-color:#616161;}.content .highlighted a,.content .highlighted span{color:#eee !important;}.content .highlighted.trait{background-color:#013191;}.content .highlighted.traitalias{background-color:#013191;}.content .highlighted.mod,.content .highlighted.externcrate{background-color:#afc6e4;}.content .highlighted.mod{background-color:#803a1b;}.content .highlighted.externcrate{background-color:#396bac;}.content .highlighted.enum{background-color:#5b4e68;}.content .highlighted.struct{background-color:#194e9f;}.content .highlighted.union{background-color:#b7bd49;}.content .highlighted.fn,.content .highlighted.method,.content .highlighted.tymethod{background-color:#4950ed;}.content .highlighted.type{background-color:#38902c;}.content .highlighted.foreigntype{background-color:#b200d6;}.content .highlighted.attr,.content .highlighted.derive,.content .highlighted.macro{background-color:#217d1c;}.content .highlighted.constant,.content .highlighted.static{background-color:#0063cc;}.content .highlighted.primitive{background-color:#00708a;}.content .highlighted.keyword{background-color:#884719;}.content .stability::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#82b089;}.content span.struct,.content a.struct,.block a.current.struct{color:#2dbfb8;}.content span.type,.content a.type,.block a.current.type{color:#ff7f00;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#dd7de8;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#09bd00;}.content span.union,.content a.union,.block a.current.union{color:#a6ae37;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#82a5c9;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#43aec7;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#bda000;}.content span.trait,.content a.trait,.block a.current.trait{color:#b78cf2;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#b397da;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#2BAB63;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#de5249;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}nav:not(.sidebar){border-bottom-color:#4e4e4e;}nav.main .current{border-top-color:#eee;border-bottom-color:#eee;}nav.main .separator{border-color:#eee;}a{color:#ddd;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.stability a,#help a{color:#D2991D;}a.test-arrow{color:#dedede;}.collapse-toggle{color:#999;}#crate-search{color:#111;background-color:#f0f0f0;border-color:#000;box-shadow:0 0 0 1px #000,0 0 0 2px transparent;}.search-input{color:#111;background-color:#f0f0f0;box-shadow:0 0 0 1px #000,0 0 0 2px transparent;}.search-input:focus{border-color:#008dfd;}.search-focus:disabled{background-color:#c5c4c4;}#crate-search+.search-input:focus{box-shadow:0 0 8px 4px #078dd8;}.module-item .stab{color:#ddd;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.deprecated{background:#F3DFFF;border-color:#7F0087;color:#2f2f2f;}.stab.portability{background:#C4ECFF;border-color:#7BA5DB;color:#2f2f2f;}.stab.portability>code{color:#ddd;}#help>div{background:#4d4d4d;border-color:#bfbfbf;}#help>div>span{border-bottom-color:#bfbfbf;}#help dt{border-color:#bfbfbf;background:rgba(0,0,0,0);color:black;}.since{color:grey;}tr.result span.primitive::after,tr.result span.keyword::after{color:#ddd;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label{color:#999;}:target>code,:target>.in-band{background-color:#494a3d;border-right:3px solid #bb7410;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.8);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.8);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.8);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.8);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip .tooltiptext{background-color:#000;color:#fff;border-color:#000;}.tooltip .tooltiptext::after{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;border-color:#777;}#titles>div:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>div:hover,#titles>div.selected{border-top-color:#0089ff;}#titles>div>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#505050;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#505050;border-right-color:#000;}#sidebar-filler{background-color:#505050;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,.help-button{border-color:#e0e0e0;background:#f0f0f0;color:#000;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,.help-button:hover,.help-button:focus{border-color:#ffb900;}#theme-choices{border-color:#e0e0e0;background-color:#353535;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#4e4e4e;}@media (max-width:700px){#theme-picker{background:#f0f0f0;}}#all-types{background-color:#505050;}#all-types:hover{background-color:#606060;}.search-results td span.alias{color:#fff;}.search-results td span.grey{color:#ccc;}#sidebar-toggle{background-color:#565656;}#sidebar-toggle:hover{background-color:#676767;}#source-sidebar{background-color:#565656;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#444;}div.files>.selected{background-color:#333;}.setting-line>.title{border-bottom-color:#ddd;} \ No newline at end of file diff --git a/0.10.0/down-arrow.svg b/0.10.0/down-arrow.svg new file mode 100644 index 000000000..35437e77a --- /dev/null +++ b/0.10.0/down-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.0/favicon-16x16.png b/0.10.0/favicon-16x16.png new file mode 100644 index 000000000..7cfe6c135 Binary files /dev/null and b/0.10.0/favicon-16x16.png differ diff --git a/0.10.0/favicon-32x32.png b/0.10.0/favicon-32x32.png new file mode 100644 index 000000000..5109c1de8 Binary files /dev/null and b/0.10.0/favicon-32x32.png differ diff --git a/0.10.0/favicon.svg b/0.10.0/favicon.svg new file mode 100644 index 000000000..8b34b5119 --- /dev/null +++ b/0.10.0/favicon.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/0.10.0/implementors/core/clone/trait.Clone.js b/0.10.0/implementors/core/clone/trait.Clone.js new file mode 100644 index 000000000..b849ac7c6 --- /dev/null +++ b/0.10.0/implementors/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Clone for Error","synthetic":false,"types":[]},{"text":"impl Clone for Status","synthetic":false,"types":[]},{"text":"impl Clone for Atom","synthetic":false,"types":[]},{"text":"impl Clone for CellShape","synthetic":false,"types":[]},{"text":"impl Clone for UnitCell","synthetic":false,"types":[]},{"text":"impl Clone for Residue","synthetic":false,"types":[]},{"text":"impl Clone for BondOrder","synthetic":false,"types":[]},{"text":"impl Clone for Topology","synthetic":false,"types":[]},{"text":"impl Clone for Frame","synthetic":false,"types":[]},{"text":"impl Clone for Match","synthetic":false,"types":[]},{"text":"impl Clone for Selection","synthetic":false,"types":[]},{"text":"impl Clone for Property","synthetic":false,"types":[]},{"text":"impl Clone for FormatMetadata","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/cmp/trait.Eq.js b/0.10.0/implementors/core/cmp/trait.Eq.js new file mode 100644 index 000000000..3cdec155e --- /dev/null +++ b/0.10.0/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Eq for CellShape","synthetic":false,"types":[]},{"text":"impl Eq for BondOrder","synthetic":false,"types":[]},{"text":"impl Eq for Match","synthetic":false,"types":[]},{"text":"impl Eq for FormatMetadata","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/cmp/trait.Ord.js b/0.10.0/implementors/core/cmp/trait.Ord.js new file mode 100644 index 000000000..001aa85dd --- /dev/null +++ b/0.10.0/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Ord for BondOrder","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/cmp/trait.PartialEq.js b/0.10.0/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..5cbf507d3 --- /dev/null +++ b/0.10.0/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialEq<Error> for Error","synthetic":false,"types":[]},{"text":"impl PartialEq<Status> for Status","synthetic":false,"types":[]},{"text":"impl PartialEq<CellShape> for CellShape","synthetic":false,"types":[]},{"text":"impl PartialEq<BondOrder> for BondOrder","synthetic":false,"types":[]},{"text":"impl PartialEq<Match> for Match","synthetic":false,"types":[]},{"text":"impl PartialEq<Property> for Property","synthetic":false,"types":[]},{"text":"impl PartialEq<FormatMetadata> for FormatMetadata","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/cmp/trait.PartialOrd.js b/0.10.0/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..0162431e1 --- /dev/null +++ b/0.10.0/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialOrd<BondOrder> for BondOrder","synthetic":false,"types":[]},{"text":"impl PartialOrd<Property> for Property","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/convert/trait.From.js b/0.10.0/implementors/core/convert/trait.From.js new file mode 100644 index 000000000..5a5be08a1 --- /dev/null +++ b/0.10.0/implementors/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl From<chfl_status> for Error","synthetic":false,"types":[]},{"text":"impl From<chfl_cellshape> for CellShape","synthetic":false,"types":[]},{"text":"impl From<CellShape> for chfl_cellshape","synthetic":false,"types":[]},{"text":"impl From<chfl_bond_order> for BondOrder","synthetic":false,"types":[]},{"text":"impl From<bool> for Property","synthetic":false,"types":[]},{"text":"impl From<f64> for Property","synthetic":false,"types":[]},{"text":"impl From<String> for Property","synthetic":false,"types":[]},{"text":"impl<'a> From<&'a str> for Property","synthetic":false,"types":[]},{"text":"impl From<[f64; 3]> for Property","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/fmt/trait.Debug.js b/0.10.0/implementors/core/fmt/trait.Debug.js new file mode 100644 index 000000000..23f647843 --- /dev/null +++ b/0.10.0/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Debug for Error","synthetic":false,"types":[]},{"text":"impl Debug for Status","synthetic":false,"types":[]},{"text":"impl Debug for CellShape","synthetic":false,"types":[]},{"text":"impl Debug for BondOrder","synthetic":false,"types":[]},{"text":"impl Debug for Match","synthetic":false,"types":[]},{"text":"impl Debug for Property","synthetic":false,"types":[]},{"text":"impl Debug for FormatMetadata","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/fmt/trait.Display.js b/0.10.0/implementors/core/fmt/trait.Display.js new file mode 100644 index 000000000..a6cc0e7e2 --- /dev/null +++ b/0.10.0/implementors/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Display for Error","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/iter/traits/collect/trait.IntoIterator.js b/0.10.0/implementors/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 000000000..6ac05f02d --- /dev/null +++ b/0.10.0/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> IntoIterator for &'a Match","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/iter/traits/iterator/trait.Iterator.js b/0.10.0/implementors/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 000000000..651919888 --- /dev/null +++ b/0.10.0/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Iterator for PropertiesIter<'a>","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/marker/trait.Copy.js b/0.10.0/implementors/core/marker/trait.Copy.js new file mode 100644 index 000000000..5d6ec7218 --- /dev/null +++ b/0.10.0/implementors/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Copy for BondOrder","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/marker/trait.Freeze.js b/0.10.0/implementors/core/marker/trait.Freeze.js new file mode 100644 index 000000000..ac053b07f --- /dev/null +++ b/0.10.0/implementors/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Freeze for Error","synthetic":true,"types":[]},{"text":"impl Freeze for Atom","synthetic":true,"types":[]},{"text":"impl<'a> Freeze for AtomRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> Freeze for AtomMut<'a>","synthetic":true,"types":[]},{"text":"impl Freeze for UnitCell","synthetic":true,"types":[]},{"text":"impl<'a> Freeze for UnitCellRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> Freeze for UnitCellMut<'a>","synthetic":true,"types":[]},{"text":"impl Freeze for Residue","synthetic":true,"types":[]},{"text":"impl<'a> Freeze for ResidueRef<'a>","synthetic":true,"types":[]},{"text":"impl Freeze for Topology","synthetic":true,"types":[]},{"text":"impl<'a> Freeze for TopologyRef<'a>","synthetic":true,"types":[]},{"text":"impl Freeze for Frame","synthetic":true,"types":[]},{"text":"impl Freeze for Trajectory","synthetic":true,"types":[]},{"text":"impl Freeze for Match","synthetic":true,"types":[]},{"text":"impl Freeze for Selection","synthetic":true,"types":[]},{"text":"impl<'a> Freeze for PropertiesIter<'a>","synthetic":true,"types":[]},{"text":"impl Freeze for FormatMetadata","synthetic":true,"types":[]},{"text":"impl Freeze for Status","synthetic":true,"types":[]},{"text":"impl Freeze for CellShape","synthetic":true,"types":[]},{"text":"impl Freeze for BondOrder","synthetic":true,"types":[]},{"text":"impl Freeze for Property","synthetic":true,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/marker/trait.Send.js b/0.10.0/implementors/core/marker/trait.Send.js new file mode 100644 index 000000000..9f93616bb --- /dev/null +++ b/0.10.0/implementors/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Send for Error","synthetic":true,"types":[]},{"text":"impl !Send for Atom","synthetic":true,"types":[]},{"text":"impl<'a> !Send for AtomRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> !Send for AtomMut<'a>","synthetic":true,"types":[]},{"text":"impl !Send for UnitCell","synthetic":true,"types":[]},{"text":"impl<'a> !Send for UnitCellRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> !Send for UnitCellMut<'a>","synthetic":true,"types":[]},{"text":"impl !Send for Residue","synthetic":true,"types":[]},{"text":"impl<'a> !Send for ResidueRef<'a>","synthetic":true,"types":[]},{"text":"impl !Send for Topology","synthetic":true,"types":[]},{"text":"impl<'a> !Send for TopologyRef<'a>","synthetic":true,"types":[]},{"text":"impl !Send for Frame","synthetic":true,"types":[]},{"text":"impl !Send for Trajectory","synthetic":true,"types":[]},{"text":"impl Send for Match","synthetic":true,"types":[]},{"text":"impl !Send for Selection","synthetic":true,"types":[]},{"text":"impl<'a> !Send for PropertiesIter<'a>","synthetic":true,"types":[]},{"text":"impl Send for FormatMetadata","synthetic":true,"types":[]},{"text":"impl Send for Status","synthetic":true,"types":[]},{"text":"impl Send for CellShape","synthetic":true,"types":[]},{"text":"impl Send for BondOrder","synthetic":true,"types":[]},{"text":"impl Send for Property","synthetic":true,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/marker/trait.StructuralEq.js b/0.10.0/implementors/core/marker/trait.StructuralEq.js new file mode 100644 index 000000000..09f9179b4 --- /dev/null +++ b/0.10.0/implementors/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralEq for CellShape","synthetic":false,"types":[]},{"text":"impl StructuralEq for BondOrder","synthetic":false,"types":[]},{"text":"impl StructuralEq for Match","synthetic":false,"types":[]},{"text":"impl StructuralEq for FormatMetadata","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/marker/trait.StructuralPartialEq.js b/0.10.0/implementors/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 000000000..6beecb325 --- /dev/null +++ b/0.10.0/implementors/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralPartialEq for Error","synthetic":false,"types":[]},{"text":"impl StructuralPartialEq for Status","synthetic":false,"types":[]},{"text":"impl StructuralPartialEq for CellShape","synthetic":false,"types":[]},{"text":"impl StructuralPartialEq for BondOrder","synthetic":false,"types":[]},{"text":"impl StructuralPartialEq for Match","synthetic":false,"types":[]},{"text":"impl StructuralPartialEq for Property","synthetic":false,"types":[]},{"text":"impl StructuralPartialEq for FormatMetadata","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/marker/trait.Sync.js b/0.10.0/implementors/core/marker/trait.Sync.js new file mode 100644 index 000000000..cdb1108cd --- /dev/null +++ b/0.10.0/implementors/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Sync for Error","synthetic":true,"types":[]},{"text":"impl !Sync for Atom","synthetic":true,"types":[]},{"text":"impl<'a> !Sync for AtomRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> !Sync for AtomMut<'a>","synthetic":true,"types":[]},{"text":"impl !Sync for UnitCell","synthetic":true,"types":[]},{"text":"impl<'a> !Sync for UnitCellRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> !Sync for UnitCellMut<'a>","synthetic":true,"types":[]},{"text":"impl !Sync for Residue","synthetic":true,"types":[]},{"text":"impl<'a> !Sync for ResidueRef<'a>","synthetic":true,"types":[]},{"text":"impl !Sync for Topology","synthetic":true,"types":[]},{"text":"impl<'a> !Sync for TopologyRef<'a>","synthetic":true,"types":[]},{"text":"impl !Sync for Frame","synthetic":true,"types":[]},{"text":"impl !Sync for Trajectory","synthetic":true,"types":[]},{"text":"impl Sync for Match","synthetic":true,"types":[]},{"text":"impl !Sync for Selection","synthetic":true,"types":[]},{"text":"impl<'a> !Sync for PropertiesIter<'a>","synthetic":true,"types":[]},{"text":"impl Sync for FormatMetadata","synthetic":true,"types":[]},{"text":"impl Sync for Status","synthetic":true,"types":[]},{"text":"impl Sync for CellShape","synthetic":true,"types":[]},{"text":"impl Sync for BondOrder","synthetic":true,"types":[]},{"text":"impl Sync for Property","synthetic":true,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/marker/trait.Unpin.js b/0.10.0/implementors/core/marker/trait.Unpin.js new file mode 100644 index 000000000..e29f42985 --- /dev/null +++ b/0.10.0/implementors/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Unpin for Error","synthetic":true,"types":[]},{"text":"impl Unpin for Atom","synthetic":true,"types":[]},{"text":"impl<'a> Unpin for AtomRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> Unpin for AtomMut<'a>","synthetic":true,"types":[]},{"text":"impl Unpin for UnitCell","synthetic":true,"types":[]},{"text":"impl<'a> Unpin for UnitCellRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> Unpin for UnitCellMut<'a>","synthetic":true,"types":[]},{"text":"impl Unpin for Residue","synthetic":true,"types":[]},{"text":"impl<'a> Unpin for ResidueRef<'a>","synthetic":true,"types":[]},{"text":"impl Unpin for Topology","synthetic":true,"types":[]},{"text":"impl<'a> Unpin for TopologyRef<'a>","synthetic":true,"types":[]},{"text":"impl Unpin for Frame","synthetic":true,"types":[]},{"text":"impl Unpin for Trajectory","synthetic":true,"types":[]},{"text":"impl Unpin for Match","synthetic":true,"types":[]},{"text":"impl Unpin for Selection","synthetic":true,"types":[]},{"text":"impl<'a> Unpin for PropertiesIter<'a>","synthetic":true,"types":[]},{"text":"impl Unpin for FormatMetadata","synthetic":true,"types":[]},{"text":"impl Unpin for Status","synthetic":true,"types":[]},{"text":"impl Unpin for CellShape","synthetic":true,"types":[]},{"text":"impl Unpin for BondOrder","synthetic":true,"types":[]},{"text":"impl Unpin for Property","synthetic":true,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/ops/deref/trait.Deref.js b/0.10.0/implementors/core/ops/deref/trait.Deref.js new file mode 100644 index 000000000..90859c88d --- /dev/null +++ b/0.10.0/implementors/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Deref for AtomRef<'a>","synthetic":false,"types":[]},{"text":"impl<'a> Deref for AtomMut<'a>","synthetic":false,"types":[]},{"text":"impl<'a> Deref for UnitCellRef<'a>","synthetic":false,"types":[]},{"text":"impl<'a> Deref for UnitCellMut<'a>","synthetic":false,"types":[]},{"text":"impl<'a> Deref for ResidueRef<'a>","synthetic":false,"types":[]},{"text":"impl<'a> Deref for TopologyRef<'a>","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/ops/deref/trait.DerefMut.js b/0.10.0/implementors/core/ops/deref/trait.DerefMut.js new file mode 100644 index 000000000..e410cbf42 --- /dev/null +++ b/0.10.0/implementors/core/ops/deref/trait.DerefMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> DerefMut for AtomMut<'a>","synthetic":false,"types":[]},{"text":"impl<'a> DerefMut for UnitCellMut<'a>","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/ops/drop/trait.Drop.js b/0.10.0/implementors/core/ops/drop/trait.Drop.js new file mode 100644 index 000000000..8514fd8c0 --- /dev/null +++ b/0.10.0/implementors/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Drop for Atom","synthetic":false,"types":[]},{"text":"impl Drop for UnitCell","synthetic":false,"types":[]},{"text":"impl Drop for Residue","synthetic":false,"types":[]},{"text":"impl Drop for Topology","synthetic":false,"types":[]},{"text":"impl Drop for Frame","synthetic":false,"types":[]},{"text":"impl Drop for Trajectory","synthetic":false,"types":[]},{"text":"impl Drop for Selection","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/core/ops/index/trait.Index.js b/0.10.0/implementors/core/ops/index/trait.Index.js new file mode 100644 index 000000000..44943a284 --- /dev/null +++ b/0.10.0/implementors/core/ops/index/trait.Index.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Index<usize> for Match","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/std/error/trait.Error.js b/0.10.0/implementors/std/error/trait.Error.js new file mode 100644 index 000000000..e1498690c --- /dev/null +++ b/0.10.0/implementors/std/error/trait.Error.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Error for Error","synthetic":false,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/std/panic/trait.RefUnwindSafe.js b/0.10.0/implementors/std/panic/trait.RefUnwindSafe.js new file mode 100644 index 000000000..b8e387f58 --- /dev/null +++ b/0.10.0/implementors/std/panic/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl RefUnwindSafe for Error","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Atom","synthetic":true,"types":[]},{"text":"impl<'a> RefUnwindSafe for AtomRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> RefUnwindSafe for AtomMut<'a>","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for UnitCell","synthetic":true,"types":[]},{"text":"impl<'a> RefUnwindSafe for UnitCellRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> RefUnwindSafe for UnitCellMut<'a>","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Residue","synthetic":true,"types":[]},{"text":"impl<'a> RefUnwindSafe for ResidueRef<'a>","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Topology","synthetic":true,"types":[]},{"text":"impl<'a> RefUnwindSafe for TopologyRef<'a>","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Frame","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Trajectory","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Match","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Selection","synthetic":true,"types":[]},{"text":"impl<'a> !RefUnwindSafe for PropertiesIter<'a>","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for FormatMetadata","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Status","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for CellShape","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for BondOrder","synthetic":true,"types":[]},{"text":"impl RefUnwindSafe for Property","synthetic":true,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/implementors/std/panic/trait.UnwindSafe.js b/0.10.0/implementors/std/panic/trait.UnwindSafe.js new file mode 100644 index 000000000..7a9e90911 --- /dev/null +++ b/0.10.0/implementors/std/panic/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl UnwindSafe for Error","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Atom","synthetic":true,"types":[]},{"text":"impl<'a> UnwindSafe for AtomRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> !UnwindSafe for AtomMut<'a>","synthetic":true,"types":[]},{"text":"impl UnwindSafe for UnitCell","synthetic":true,"types":[]},{"text":"impl<'a> UnwindSafe for UnitCellRef<'a>","synthetic":true,"types":[]},{"text":"impl<'a> !UnwindSafe for UnitCellMut<'a>","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Residue","synthetic":true,"types":[]},{"text":"impl<'a> UnwindSafe for ResidueRef<'a>","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Topology","synthetic":true,"types":[]},{"text":"impl<'a> UnwindSafe for TopologyRef<'a>","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Frame","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Trajectory","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Match","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Selection","synthetic":true,"types":[]},{"text":"impl<'a> !UnwindSafe for PropertiesIter<'a>","synthetic":true,"types":[]},{"text":"impl UnwindSafe for FormatMetadata","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Status","synthetic":true,"types":[]},{"text":"impl UnwindSafe for CellShape","synthetic":true,"types":[]},{"text":"impl UnwindSafe for BondOrder","synthetic":true,"types":[]},{"text":"impl UnwindSafe for Property","synthetic":true,"types":[]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.0/index.html b/0.10.0/index.html new file mode 100644 index 000000000..8b8b920bb --- /dev/null +++ b/0.10.0/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/0.10.0/light.css b/0.10.0/light.css new file mode 100644 index 000000000..6ec01d671 --- /dev/null +++ b/0.10.0/light.css @@ -0,0 +1 @@ + body{background-color:white;color:black;}h1,h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){color:black;}h1.fqn{border-bottom-color:#D5D5D5;}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){border-bottom-color:#DDDDDD;}.in-band{background-color:white;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#F5F5F5;}pre{background-color:#F5F5F5;}.sidebar{background-color:#F1F1F1;}*{scrollbar-color:rgba(36,37,39,0.6) #e6e6e6;}.sidebar{scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;}.logo-container.rust-logo>img{}::-webkit-scrollbar-track{background-color:#ecebeb;}::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar::-webkit-scrollbar-track{background-color:#dcdcdc;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar .current{background-color:#fff;}.source .sidebar{background-color:#fff;}.sidebar .location{border-color:#000;background-color:#fff;color:#333;}.sidebar .version{border-bottom-color:#DDD;}.sidebar-title{border-top-color:#777;border-bottom-color:#777;}.block a:hover{background:#F5F5F5;}.line-numbers span{color:#c67e2d;}.line-numbers .line-highlighted{background-color:#f6fdb0 !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#ddd;}.docblock table,.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#4E4C4C;}.content .highlighted{color:#000 !important;background-color:#ccc;}.content .highlighted a,.content .highlighted span{color:#000 !important;}.content .highlighted.trait{background-color:#c7b6ff;}.content .highlighted.traitalias{background-color:#c7b6ff;}.content .highlighted.mod,.content .highlighted.externcrate{background-color:#afc6e4;}.content .highlighted.enum{background-color:#b4d1b9;}.content .highlighted.struct{background-color:#e7b1a0;}.content .highlighted.union{background-color:#b7bd49;}.content .highlighted.fn,.content .highlighted.method,.content .highlighted.tymethod{background-color:#c6afb3;}.content .highlighted.type{background-color:#ffc891;}.content .highlighted.foreigntype{background-color:#f5c4ff;}.content .highlighted.attr,.content .highlighted.derive,.content .highlighted.macro{background-color:#8ce488;}.content .highlighted.constant,.content .highlighted.static{background-color:#c3e0ff;}.content .highlighted.primitive{background-color:#9aecff;}.content .highlighted.keyword{background-color:#f99650;}.content .stability::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#508157;}.content span.struct,.content a.struct,.block a.current.struct{color:#ad448e;}.content span.type,.content a.type,.block a.current.type{color:#ba5d00;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#cd00e2;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#068000;}.content span.union,.content a.union,.block a.current.union{color:#767b27;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#546e8a;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#2c8093;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#4d76ae;}.content span.trait,.content a.trait,.block a.current.trait{color:#7c5af3;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#6841f1;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#9a6e31;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#de5249;}pre.rust .comment{color:#8E908C;}pre.rust .doccomment{color:#4D4D4C;}nav:not(.sidebar){border-bottom-color:#e0e0e0;}nav.main .current{border-top-color:#000;border-bottom-color:#000;}nav.main .separator{border:1px solid #000;}a{color:#000;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.stability a,#help a{color:#3873AD;}a.test-arrow{color:#f5f5f5;}.collapse-toggle{color:#999;}#crate-search{color:#555;background-color:white;border-color:#e0e0e0;box-shadow:0 0 0 1px #e0e0e0,0 0 0 2px transparent;}.search-input{color:#555;background-color:white;box-shadow:0 0 0 1px #e0e0e0,0 0 0 2px transparent;}.search-input:focus{border-color:#66afe9;}.search-focus:disabled{background-color:#e6e6e6;}#crate-search+.search-input:focus{box-shadow:0 0 8px #078dd8;}.module-item .stab{color:#000;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;}.stab.deprecated{background:#F3DFFF;border-color:#7F0087;}.stab.portability{background:#C4ECFF;border-color:#7BA5DB;}.stab.portability>code{color:#000;}#help>div{background:#e9e9e9;border-color:#bfbfbf;}#help>div>span{border-bottom-color:#bfbfbf;}.since{color:grey;}tr.result span.primitive::after,tr.result span.keyword::after{color:black;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#8959A8;}pre.rust .kw-2,pre.rust .prelude-ty{color:#4271AE;}pre.rust .number,pre.rust .string{color:#718C00;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#C82829;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#B76514;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#c7c7c7;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label{color:#999;}:target>code,:target>.in-band{background:#FDFFD3;border-right:3px solid #ffb44c;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.5);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.5);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip .tooltiptext{background-color:#000;color:#fff;}.tooltip .tooltiptext::after{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#eee;border-color:#999;}#titles>div:not(.selected){background-color:#e6e6e6;border-top-color:#e6e6e6;}#titles>div:hover,#titles>div.selected{border-top-color:#0089ff;}#titles>div>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#F1F1F1;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#F1F1F1;border-right-color:#000;}#sidebar-filler{background-color:#F1F1F1;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,.help-button{border-color:#e0e0e0;background-color:#fff;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,.help-button:hover,.help-button:focus{border-color:#717171;}#theme-choices{border-color:#ccc;background-color:#fff;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#eee;}@media (max-width:700px){#theme-picker{background:#fff;}}#all-types{background-color:#fff;}#all-types:hover{background-color:#f9f9f9;}.search-results td span.alias{color:#000;}.search-results td span.grey{color:#999;}#sidebar-toggle{background-color:#F1F1F1;}#sidebar-toggle:hover{background-color:#E0E0E0;}#source-sidebar{background-color:#F1F1F1;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#E0E0E0;}div.files>.selected{background-color:#fff;}.setting-line>.title{border-bottom-color:#D5D5D5;} \ No newline at end of file diff --git a/0.10.0/main.js b/0.10.0/main.js new file mode 100644 index 000000000..2f8b881b8 --- /dev/null +++ b/0.10.0/main.js @@ -0,0 +1,8 @@ +if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.indexOf(searchString,position)===position}}if(!String.prototype.endsWith){String.prototype.endsWith=function(suffix,length){var l=length||this.length;return this.indexOf(suffix,l-suffix.length)!==-1}}if(!DOMTokenList.prototype.add){DOMTokenList.prototype.add=function(className){if(className&&!hasClass(this,className)){if(this.className&&this.className.length>0){this.className+=" "+className}else{this.className=className}}}}if(!DOMTokenList.prototype.remove){DOMTokenList.prototype.remove=function(className){if(className&&this.className){this.className=(" "+this.className+" ").replace(" "+className+" "," ").trim()}}}function getSearchInput(){return document.getElementsByClassName("search-input")[0]}function getSearchElement(){return document.getElementById("search")}function getThemesElement(){return document.getElementById("theme-choices")}function getThemePickerElement(){return document.getElementById("theme-picker")}function focusSearchBar(){getSearchInput().focus()}function defocusSearchBar(){getSearchInput().blur()}(function(){"use strict";var itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias"];var disableShortcuts=getSettingValue("disable-shortcuts")==="true";var search_input=getSearchInput();var searchTimeout=null;var toggleAllDocsId="toggle-all-docs";var currentTab=0;var mouseMovedAfterSearch=true;var titleBeforeSearch=document.title;var searchTitle=null;function clearInputTimeout(){if(searchTimeout!==null){clearTimeout(searchTimeout);searchTimeout=null}}function getPageId(){if(window.location.hash){var tmp=window.location.hash.replace(/^#/,"");if(tmp.length>0){return tmp}}return null}function showSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){addClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];if(sidebar){addClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(!filler){var div=document.createElement("div");div.id="sidebar-filler";sidebar.appendChild(div)}}}function hideSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){removeClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(filler){filler.remove()}document.getElementsByTagName("body")[0].style.marginTop=""}function showSearchResults(search){if(search===null||typeof search==='undefined'){search=getSearchElement()}addClass(main,"hidden");removeClass(search,"hidden");mouseMovedAfterSearch=false;document.title=searchTitle}function hideSearchResults(search){if(search===null||typeof search==='undefined'){search=getSearchElement()}addClass(search,"hidden");removeClass(main,"hidden");document.title=titleBeforeSearch}var TY_PRIMITIVE=itemTypes.indexOf("primitive");var TY_KEYWORD=itemTypes.indexOf("keyword");function getQueryStringParams(){var params={};window.location.search.substring(1).split("&").map(function(s){var pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function isHidden(elem){return elem.offsetHeight===0}var main=document.getElementById("main");var savedHash="";function handleHashes(ev){var elem;var search=getSearchElement();if(ev!==null&&search&&!hasClass(search,"hidden")&&ev.newURL){hideSearchResults(search);var hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(hash,"","?search=#"+hash)}elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}elem=document.getElementById(savedHash.slice(1));if(!elem||!isHidden(elem)){return}var parent=elem.parentNode;if(parent&&hasClass(parent,"impl-items")){onEachLazy(parent.getElementsByClassName("collapsed"),function(e){if(e.parentNode===parent){e.click();return true}});if(isHidden(elem)){if(hasClass(parent.lastElementChild,"collapse-toggle")){parent.lastElementChild.click()}}}}}function highlightSourceLines(match,ev){if(typeof match==="undefined"){hideSidebar();match=window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/)}if(!match){return}var from=parseInt(match[1],10);var to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to0){collapseDocs(collapses[0],"show")}}}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!="undefined"){return ev.key}var c=ev.charCode||ev.keyCode;if(c==27){return"Escape"}return String.fromCharCode(c)}function getHelpElement(){buildHelperPopup();return document.getElementById("help")}function displayHelp(display,ev,help){help=help?help:getHelpElement();if(display===true){if(hasClass(help,"hidden")){ev.preventDefault();removeClass(help,"hidden");addClass(document.body,"blur")}}else if(hasClass(help,"hidden")===false){ev.preventDefault();addClass(help,"hidden");removeClass(document.body,"blur")}}function handleEscape(ev){var help=getHelpElement();var search=getSearchElement();if(hasClass(help,"hidden")===false){displayHelp(false,ev,help)}else if(hasClass(search,"hidden")===false){clearInputTimeout();ev.preventDefault();hideSearchResults(search)}defocusSearchBar();hideThemeButtonState()}function handleShortcut(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts===true){return}if(document.activeElement.tagName==="INPUT"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":displayHelp(false,ev);ev.preventDefault();focusSearchBar();break;case"+":case"-":ev.preventDefault();toggleAllDocs();break;case"?":displayHelp(true,ev);break;case"t":case"T":displayHelp(false,ev);ev.preventDefault();var themePicker=getThemePickerElement();themePicker.click();themePicker.focus();break;default:var themePicker=getThemePickerElement();if(themePicker.parentNode.contains(ev.target)){handleThemeKeyDown(ev)}}}}function handleThemeKeyDown(ev){var active=document.activeElement;var themes=getThemesElement();switch(getVirtualKey(ev)){case"ArrowUp":ev.preventDefault();if(active.previousElementSibling&&ev.target.id!=="theme-picker"){active.previousElementSibling.focus()}else{showThemeButtonState();themes.lastElementChild.focus()}break;case"ArrowDown":ev.preventDefault();if(active.nextElementSibling&&ev.target.id!=="theme-picker"){active.nextElementSibling.focus()}else{showThemeButtonState();themes.firstElementChild.focus()}break;case"Enter":case"Return":case"Space":if(ev.target.id==="theme-picker"&&themes.style.display==="none"){ev.preventDefault();showThemeButtonState();themes.firstElementChild.focus()}break;case"Home":ev.preventDefault();themes.firstElementChild.focus();break;case"End":ev.preventDefault();themes.lastElementChild.focus();break}}function findParentElement(elem,tagName){do{if(elem&&elem.tagName===tagName){return elem}elem=elem.parentNode}while(elem);return null}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function resetMouseMoved(ev){mouseMovedAfterSearch=true}document.addEventListener("mousemove",resetMouseMoved);var handleSourceHighlight=(function(){var prev_line_id=0;var set_fragment=function(name){var x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSourceLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return function(ev){var cur_line_id=parseInt(ev.target.id,10);ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){var tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());document.addEventListener("click",function(ev){if(hasClass(ev.target,"help-button")){displayHelp(true,ev)}else if(hasClass(ev.target,"collapse-toggle")){collapseDocs(ev.target,"toggle")}else if(hasClass(ev.target.parentNode,"collapse-toggle")){collapseDocs(ev.target.parentNode,"toggle")}else if(ev.target.tagName==="SPAN"&&hasClass(ev.target.parentNode,"line-numbers")){handleSourceHighlight(ev)}else if(hasClass(getHelpElement(),"hidden")===false){var help=getHelpElement();var is_inside_help_popup=ev.target!==help&&help.contains(ev.target);if(is_inside_help_popup===false){addClass(help,"hidden");removeClass(document.body,"blur")}}else{var a=findParentElement(ev.target,"A");if(a&&a.hash){expandSection(a.hash.replace(/^#/,""))}}});(function(){var x=document.getElementsByClassName("version-selector");if(x.length>0){x[0].onchange=function(){var i,match,url=document.location.href,stripped="",len=rootPath.match(/\.\.\//g).length+1;for(i=0;i-1){var obj=searchIndex[results[i].id];obj.lev=results[i].lev;if(isType!==true||obj.type){var res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}}return out}function sortResults(results,isType){var ar=[];for(var entry in results){if(hasOwnProperty(results,entry)){ar.push(results[entry])}}results=ar;var i;var nresults=results.length;for(i=0;ib?+1:-1)}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});var length=results.length;for(i=0;i"));return{name:val.substring(0,val.indexOf("<")),generics:values.split(/\s*,\s*/),}}return{name:val,generics:[],}}function getObjectFromId(id){if(typeof id==="number"){return searchIndex[id]}return{'name':id}}function checkGenerics(obj,val){var lev_distance=MAX_LEV_DISTANCE+1;if(val.generics.length>0){if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>=val.generics.length){var elems=obj[GENERICS_DATA].slice(0);var total=0;var done=0;var vlength=val.generics.length;for(var y=0;yGENERICS_DATA&&obj[GENERICS_DATA].length>=val.generics.length){var elems=obj[GENERICS_DATA].slice(0);var allFound=true;for(var y=0;allFound===true&&yGENERICS_DATA&&obj[GENERICS_DATA].length!==0){var tmp_lev=checkGenerics(obj,val);if(tmp_lev<=MAX_LEV_DISTANCE){return tmp_lev}}else{return 0}}if(literalSearch===true){if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){var length=obj[GENERICS_DATA].length;for(x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length>0){var olength=obj[GENERICS_DATA].length;for(x=0;x0){var length=obj.type[INPUTS_DATA].length;for(var i=0;iOUTPUT_DATA){var ret=obj.type[OUTPUT_DATA];if(typeof ret[0]==="string"){ret=[ret]}for(var x=0;xlength){return MAX_LEV_DISTANCE+1}for(var i=0;ilength){break}var lev_total=0;var aborted=false;for(var x=0;xMAX_LEV_DISTANCE){aborted=true;break}lev_total+=lev}if(aborted===false){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER)return true;if(filter===type)return true;var name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function generateId(ty){if(ty.parent&&ty.parent.name){return itemTypes[ty.ty]+ty.path+ty.parent.name+ty.name}return itemTypes[ty.ty]+ty.path+ty.name}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates){var aliases=[];var crateAliases=[];var i;if(filterCrates!==undefined){if(ALIASES[filterCrates]&&ALIASES[filterCrates][query.search]){for(i=0;iMAX_RESULTS){ret.others.pop()}};onEach(aliases,pushFunc);onEach(crateAliases,pushFunc)}var nSearchWords=searchWords.length;var i;var ty;var fullId;var returned;var in_args;if((val.charAt(0)==="\""||val.charAt(0)==="'")&&val.charAt(val.length-1)===val.charAt(0)){val=extractGenerics(val.substr(1,val.length-2));for(i=0;i")>-1){var trimmer=function(s){return s.trim()};var parts=val.split("->").map(trimmer);var input=parts[0];var inputs=input.split(",").map(trimmer).sort();for(i=0;i1?paths.length-1:1);var lev;for(j=0;j1){lev=checkPath(contains,paths[paths.length-1],ty);if(lev>MAX_LEV_DISTANCE){continue}else if(lev>0){lev_add=lev/10}}returned=MAX_LEV_DISTANCE+1;in_args=MAX_LEV_DISTANCE+1;var index=-1;lev=MAX_LEV_DISTANCE+1;fullId=generateId(ty);if(searchWords[j].indexOf(split[i])>-1||searchWords[j].indexOf(val)>-1||searchWords[j].replace(/_/g,"").indexOf(val)>-1){if(typePassesFilter(typeFilter,ty.ty)&&results[fullId]===undefined){index=searchWords[j].replace(/_/g,"").indexOf(val)}}if((lev=levenshtein(searchWords[j],val))<=MAX_LEV_DISTANCE){if(typePassesFilter(typeFilter,ty.ty)===false){lev=MAX_LEV_DISTANCE+1}else{lev+=1}}in_args=findArg(ty,valGenerics,false,typeFilter);returned=checkReturned(ty,valGenerics,false,typeFilter);lev+=lev_add;if(lev>0&&val.length>3&&searchWords[j].indexOf(val)>-1){if(val.length<6){lev-=1}else{lev=0}}if(in_args<=MAX_LEV_DISTANCE){if(results_in_args[fullId]===undefined){results_in_args[fullId]={id:j,index:index,lev:in_args,}}results_in_args[fullId].lev=Math.min(results_in_args[fullId].lev,in_args)}if(returned<=MAX_LEV_DISTANCE){if(results_returned[fullId]===undefined){results_returned[fullId]={id:j,index:index,lev:returned,}}results_returned[fullId].lev=Math.min(results_returned[fullId].lev,returned)}if(index!==-1||lev<=MAX_LEV_DISTANCE){if(index!==-1&&paths.length<2){lev=0}if(results[fullId]===undefined){results[fullId]={id:j,index:index,lev:lev,}}results[fullId].lev=Math.min(results[fullId].lev,lev)}}}var ret={"in_args":sortResults(results_in_args,true),"returned":sortResults(results_returned,true),"others":sortResults(results),};handleAliases(ret,query,filterCrates);return ret}function validateResult(name,path,keys,parent){for(var i=0;i-1||path.indexOf(keys[i])>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(keys[i])>-1)||levenshtein(name,keys[i])<=MAX_LEV_DISTANCE)){return false}}return true}function getQuery(raw){var matches,type,query;query=raw;matches=query.match(/^(fn|mod|struct|enum|trait|type|const|macro)\s*:\s*/i);if(matches){type=matches[1].replace(/^const$/,"constant");query=query.substring(matches[0].length)}return{raw:raw,query:query,type:type,id:query+type}}function initSearchNav(){var hoverTimeout;var click_func=function(e){var el=e.target;while(el.tagName!=="TR"){el=el.parentNode}var dst=e.target.getElementsByTagName("a");if(dst.length<1){return}dst=dst[0];if(window.location.pathname===dst.pathname){hideSearchResults();document.location.href=dst.href}};var mouseover_func=function(e){if(mouseMovedAfterSearch){var el=e.target;while(el.tagName!=="TR"){el=el.parentNode}clearTimeout(hoverTimeout);hoverTimeout=setTimeout(function(){onEachLazy(document.getElementsByClassName("search-results"),function(e){onEachLazy(e.getElementsByClassName("result"),function(i_e){removeClass(i_e,"highlighted")})});addClass(el,"highlighted")},20)}};onEachLazy(document.getElementsByClassName("search-results"),function(e){onEachLazy(e.getElementsByClassName("result"),function(i_e){i_e.onclick=click_func;i_e.onmouseover=mouseover_func})});search_input.onkeydown=function(e){var actives=[[],[],[]];var current=0;onEachLazy(document.getElementById("results").childNodes,function(e){onEachLazy(e.getElementsByClassName("highlighted"),function(h_e){actives[current].push(h_e)});current+=1});if(e.which===38){if(!actives[currentTab].length||!actives[currentTab][0].previousElementSibling){return}addClass(actives[currentTab][0].previousElementSibling,"highlighted");removeClass(actives[currentTab][0],"highlighted");e.preventDefault()}else if(e.which===40){if(!actives[currentTab].length){var results=document.getElementById("results").childNodes;if(results.length>0){var res=results[currentTab].getElementsByClassName("result");if(res.length>0){addClass(res[0],"highlighted")}}}else if(actives[currentTab][0].nextElementSibling){addClass(actives[currentTab][0].nextElementSibling,"highlighted");removeClass(actives[currentTab][0],"highlighted")}e.preventDefault()}else if(e.which===13){if(actives[currentTab].length){document.location.href=actives[currentTab][0].getElementsByTagName("a")[0].href}}else if(e.which===9){if(e.shiftKey){printTab(currentTab>0?currentTab-1:2)}else{printTab(currentTab>1?0:currentTab+1)}e.preventDefault()}else if(e.which===16){}else if(actives[currentTab].length>0){removeClass(actives[currentTab][0],"highlighted")}}}function buildHrefAndPath(item){var displayPath;var href;var type=itemTypes[item.ty];var name=item.name;var path=item.path;if(type==="mod"){displayPath=path+"::";href=rootPath+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="primitive"||type==="keyword"){displayPath="";href=rootPath+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=rootPath+name+"/index.html"}else if(item.parent!==undefined){var myparent=item.parent;var anchor="#"+type+"."+name;var parentType=itemTypes[myparent.ty];var pageType=parentType;var pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){var splitPath=item.path.split("::");var enumName=splitPath.pop();path=splitPath.join("::");displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=rootPath+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=rootPath+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function escape(content){var h1=document.createElement("h1");h1.textContent=content;return h1.innerHTML}function pathSplitter(path){var tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){var extraStyle="";if(display===false){extraStyle=" style=\"display: none;\""}var output="";var duplicates={};var length=0;if(array.length>0){output="";array.forEach(function(item){var name,type;name=item.name;type=itemTypes[item.ty];if(item.is_alias!==true){if(duplicates[item.fullPath]){return}duplicates[item.fullPath]=true}length+=1;output+=""});output+="
"+""+(item.is_alias===true?(""+item.alias+"  - see "):"")+item.displayPath+""+name+""+""+""+escape(item.desc)+" 
"}else{output="
No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:
"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(currentTab===tabNb){return"
"+text+"
("+nbElems+")
"}return"
"+text+"
("+nbElems+")
"}function showResults(results){var search=getSearchElement();if(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==getSearchLoadingText())){var elem=document.createElement("a");elem.href=results.others[0].href;elem.style.display="none";document.body.appendChild(elem);elem.click();return}var query=getQuery(search_input.value);currentResults=query.id;var ret_others=addTab(results.others,query);var ret_in_args=addTab(results.in_args,query,false);var ret_returned=addTab(results.returned,query,false);var output="

Results for "+escape(query.query)+(query.type?" (type: "+escape(query.type)+")":"")+"

"+"
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"+ret_others[0]+ret_in_args[0]+ret_returned[0]+"
";search.innerHTML=output;showSearchResults(search);var tds=search.getElementsByTagName("td");var td_width=0;if(tds.length>0){td_width=tds[0].offsetWidth}var width=search.offsetWidth-40-td_width;onEachLazy(search.getElementsByClassName("desc"),function(e){e.style.width=width+"px"});initSearchNav();var elems=document.getElementById("titles").childNodes;elems[0].onclick=function(){printTab(0)};elems[1].onclick=function(){printTab(1)};elems[2].onclick=function(){printTab(2)};printTab(currentTab)}function execSearch(query,searchWords,filterCrates){function getSmallest(arrays,positions,notDuplicates){var start=null;for(var it=0;itpositions[it]&&(start===null||start>arrays[it][positions[it]].lev)&&!notDuplicates[arrays[it][positions[it]].fullPath]){start=arrays[it][positions[it]].lev}}return start}function mergeArrays(arrays){var ret=[];var positions=[];var notDuplicates={};for(var x=0;xpositions[x]&&arrays[x][positions[x]].lev===smallest&&!notDuplicates[arrays[x][positions[x]].fullPath]){ret.push(arrays[x][positions[x]]);notDuplicates[arrays[x][positions[x]].fullPath]=true;positions[x]+=1}}}return ret}var queries=query.raw.split(",");var results={"in_args":[],"returned":[],"others":[],};for(var i=0;i1){return{"in_args":mergeArrays(results.in_args),"returned":mergeArrays(results.returned),"others":mergeArrays(results.others),}}return{"in_args":results.in_args[0],"returned":results.returned[0],"others":results.others[0],}}function getFilterCrates(){var elem=document.getElementById("crate-search");if(elem&&elem.value!=="All crates"&&hasOwnProperty(rawSearchIndex,elem.value)){return elem.value}return undefined}function search(e,forced){var params=getQueryStringParams();var query=getQuery(search_input.value.trim());if(e){e.preventDefault()}if(query.query.length===0){return}if(forced!==true&&query.id===currentResults){if(query.query.length>0){putBackSearch(search_input)}return}searchTitle="Results for "+query.query+" - Rust";if(browserSupportsHistoryApi()){if(!history.state&&!params.search){history.pushState(query,"","?search="+encodeURIComponent(query.raw))}else{history.replaceState(query,"","?search="+encodeURIComponent(query.raw))}}var filterCrates=getFilterCrates();showResults(execSearch(query,index,filterCrates))}function buildIndex(rawSearchIndex){searchIndex=[];var searchWords=[];var i;var currentIndex=0;for(var crate in rawSearchIndex){if(!hasOwnProperty(rawSearchIndex,crate)){continue}var crateSize=0;searchWords.push(crate);searchIndex.push({crate:crate,ty:1,name:crate,path:"",desc:rawSearchIndex[crate].doc,type:null,});currentIndex+=1;var items=rawSearchIndex[crate].i;var paths=rawSearchIndex[crate].p;var aliases=rawSearchIndex[crate].a;var len=paths.length;for(i=0;i0){search_input.value=params.search;search(e)}else{search_input.value="";hideSearchResults()}})}search()}index=buildIndex(rawSearchIndex);startSearch();if(rootPath==="../"||rootPath==="./"){var sidebar=document.getElementsByClassName("sidebar-elems")[0];if(sidebar){var div=document.createElement("div");div.className="block crate";div.innerHTML="

Crates

";var ul=document.createElement("ul");div.appendChild(ul);var crates=[];for(var crate in rawSearchIndex){if(!hasOwnProperty(rawSearchIndex,crate)){continue}crates.push(crate)}crates.sort();for(var i=0;i"+""+"
"+code.outerHTML+"
";list.appendChild(display)}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}function labelForToggleButton(sectionIsCollapsed){if(sectionIsCollapsed){return"+"}return"\u2212"}function onEveryMatchingChild(elem,className,func){if(elem&&className&&func){var length=elem.childNodes.length;var nodes=elem.childNodes;for(var i=0;i"+labelForToggleButton(sectionIsCollapsed)+"
]";return toggle}function createToggle(toggle,otherMessage,fontSize,extraClass,show){var span=document.createElement("span");span.className="toggle-label";if(show){span.style.display="none"}if(!otherMessage){span.innerHTML=" Expand description"}else{span.innerHTML=otherMessage}if(fontSize){span.style.fontSize=fontSize}var mainToggle=toggle.cloneNode(true);mainToggle.appendChild(span);var wrapper=document.createElement("div");wrapper.className="toggle-wrapper";if(!show){addClass(wrapper,"collapsed");var inner=mainToggle.getElementsByClassName("inner");if(inner&&inner.length>0){inner[0].innerHTML="+"}}if(extraClass){addClass(wrapper,extraClass)}wrapper.appendChild(mainToggle);return wrapper}(function(){var toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}var toggle=createSimpleToggle(false);var hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";var hideImplementors=getSettingValue("auto-collapse-implementors")!=="false";var pageId=getPageId();var func=function(e){var next=e.nextElementSibling;if(!next){return}if(hasClass(next,"docblock")===true||(hasClass(next,"stability")===true&&hasClass(next.nextElementSibling,"docblock")===true)){var newToggle=toggle.cloneNode(true);insertAfter(newToggle,e.childNodes[e.childNodes.length-1]);if(hideMethodDocs===true&&hasClass(e,"method")===true){collapseDocs(newToggle,"hide",pageId)}}};var funcImpl=function(e){var next=e.nextElementSibling;if(next&&hasClass(next,"docblock")){next=next.nextElementSibling}if(!next){return}if(hasClass(e,"impl")&&(next.getElementsByClassName("method").length>0||next.getElementsByClassName("associatedconstant").length>0)){var newToggle=toggle.cloneNode(true);insertAfter(newToggle,e.childNodes[e.childNodes.length-1]);if(hideImplementors===true&&e.parentNode.id==="implementors-list"){collapseDocs(newToggle,"hide",pageId)}}};onEachLazy(document.getElementsByClassName("method"),func);onEachLazy(document.getElementsByClassName("associatedconstant"),func);onEachLazy(document.getElementsByClassName("impl"),funcImpl);var impl_call=function(){};if(hideMethodDocs===true){impl_call=function(e,newToggle){if(e.id.match(/^impl(?:-\d+)?$/)===null){if(hasClass(e,"impl")===true){collapseDocs(newToggle,"hide",pageId)}}}}var newToggle=document.createElement("a");newToggle.href="javascript:void(0)";newToggle.className="collapse-toggle hidden-default collapsed";newToggle.innerHTML="["+labelForToggleButton(true)+"] Show hidden undocumented items";function toggleClicked(){if(hasClass(this,"collapsed")){removeClass(this,"collapsed");onEachLazy(this.parentNode.getElementsByClassName("hidden"),function(x){if(hasClass(x,"content")===false){removeClass(x,"hidden");addClass(x,"x")}},true);this.innerHTML="["+labelForToggleButton(false)+"] Hide undocumented items"}else{addClass(this,"collapsed");onEachLazy(this.parentNode.getElementsByClassName("x"),function(x){if(hasClass(x,"content")===false){addClass(x,"hidden");removeClass(x,"x")}},true);this.innerHTML="["+labelForToggleButton(true)+"] Show hidden undocumented items"}}onEachLazy(document.getElementsByClassName("impl-items"),function(e){onEachLazy(e.getElementsByClassName("associatedconstant"),func);var hiddenElems=e.getElementsByClassName("hidden");var needToggle=false;var hlength=hiddenElems.length;for(var i=0;i"+getSearchLoadingText()+"";showSearchResults(search)}var sidebar_menu=document.getElementsByClassName("sidebar-menu")[0];if(sidebar_menu){sidebar_menu.onclick=function(){var sidebar=document.getElementsByClassName("sidebar")[0];if(hasClass(sidebar,"mobile")===true){hideSidebar()}else{showSidebar()}}}if(main){onEachLazy(main.getElementsByClassName("loading-content"),function(e){e.remove()});onEachLazy(main.childNodes,function(e){if(e.tagName==="H2"||e.tagName==="H3"){var nextTagName=e.nextElementSibling.tagName;if(nextTagName=="H2"||nextTagName=="H3"){e.nextElementSibling.style.display="flex"}else{e.nextElementSibling.style.display="block"}}})}function enableSearchInput(){if(search_input){search_input.removeAttribute('disabled')}}window.addSearchOptions=function(crates){var elem=document.getElementById("crate-search");if(!elem){enableSearchInput();return}var crates_text=[];if(Object.keys(crates).length>1){for(var crate in crates){if(hasOwnProperty(crates,crate)){crates_text.push(crate)}}}crates_text.sort(function(a,b){var lower_a=a.toLowerCase();var lower_b=b.toLowerCase();if(lower_alower_b){return 1}return 0});var savedCrate=getSettingValue("saved-filter-crate");for(var i=0;ithe rustdoc book.";var container=document.createElement("div");var shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["T","Focus the theme picker menu"],["↑","Move up in search results"],["↓","Move down in search results"],["↹","Switch tab"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0]+"
"+x[1]+"
").join("");var div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";var infos=["Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + * -> vec)","Search multiple things at once by splitting your query with comma (e.g., \ + str,u8 or String,struct:Vec,test)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");var div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;container.appendChild(book_info);container.appendChild(div_shortcuts);container.appendChild(div_infos);popup.appendChild(container);insertAfter(popup,getSearchElement());buildHelperPopup=function(){}}onHashChange(null);window.onhashchange=onHashChange}());window.onunload=function(){} \ No newline at end of file diff --git a/0.10.0/normalize.css b/0.10.0/normalize.css new file mode 100644 index 000000000..6d692b50c --- /dev/null +++ b/0.10.0/normalize.css @@ -0,0 +1,2 @@ + /*! normalize.css v3.0.0 | MIT License | git.io/normalize */ +html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0} \ No newline at end of file diff --git a/0.10.0/noscript.css b/0.10.0/noscript.css new file mode 100644 index 000000000..351b41cf8 --- /dev/null +++ b/0.10.0/noscript.css @@ -0,0 +1 @@ +#main>h2+div,#main>h2+h3,#main>h3+div{display:block;}.loading-content{display:none;}#main>h2+div,#main>h3+div{display:block;}#main>h2+h3{display:flex;} \ No newline at end of file diff --git a/0.10.0/rust-logo.png b/0.10.0/rust-logo.png new file mode 100644 index 000000000..74b4bd695 Binary files /dev/null and b/0.10.0/rust-logo.png differ diff --git a/0.10.0/rustdoc.css b/0.10.0/rustdoc.css new file mode 100644 index 000000000..f9242a832 --- /dev/null +++ b/0.10.0/rustdoc.css @@ -0,0 +1 @@ + @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular.woff") format('woff');}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium.woff") format('woff');}@font-face {font-family:'Source Serif Pro';font-style:normal;font-weight:400;src:local('Source Serif Pro'),url("SourceSerifPro-Regular.ttf.woff") format('woff');}@font-face {font-family:'Source Serif Pro';font-style:italic;font-weight:400;src:local('Source Serif Pro Italic'),url("SourceSerifPro-It.ttf.woff") format('woff');}@font-face {font-family:'Source Serif Pro';font-style:normal;font-weight:700;src:local('Source Serif Pro Bold'),url("SourceSerifPro-Bold.ttf.woff") format('woff');}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular.woff") format('woff');}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold.woff") format('woff');}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:16px/1.4 "Source Serif Pro",serif;margin:0;position:relative;padding:10px 15px 20px 15px;-webkit-font-feature-settings:"kern","liga";-moz-font-feature-settings:"kern","liga";font-feature-settings:"kern","liga";}h1{font-size:1.5em;}h2{font-size:1.4em;}h3{font-size:1.3em;}h1,h2,h3:not(.impl):not(.method):not(.type):not(.tymethod):not(.notable),h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant){font-weight:500;margin:20px 0 15px 0;padding-bottom:6px;}h1.fqn{border-bottom:1px dashed;margin-top:0;}h1.fqn>.in-band>a:hover{text-decoration:underline;}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant){border-bottom:1px solid;}h3.impl,h3.method,h4.method,h3.type,h4.type,h4.associatedconstant{flex-basis:100%;font-weight:600;margin-top:16px;margin-bottom:10px;position:relative;}h3.impl,h3.method,h3.type{padding-left:15px;}h1,h2,h3,h4,.sidebar,a.source,.search-input,.content table td:first-child>a,.collapse-toggle,div.item-list .out-of-band,#source-sidebar,#sidebar-toggle{font-family:"Fira Sans",sans-serif;}.content ul.crate a.crate{font:16px/1.6 "Fira Sans";}ol,ul{padding-left:25px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.6em;}p{margin:0 0 .6em 0;}summary{outline:none;}code,pre,a.test-arrow{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.1em;}.docblock pre code,.docblock-short pre code,.docblock code.spotlight{padding:0;}.docblock code.spotlight :last-child{padding-bottom:0.6em;}pre{padding:14px;}.source .content pre{padding:20px;}img{max-width:100%;}li{position:relative;}.source .content{margin-top:50px;max-width:none;overflow:visible;margin-left:0px;min-width:70em;}nav.sub{font-size:16px;text-transform:uppercase;}.sidebar{width:200px;position:fixed;left:0;top:0;bottom:0;overflow:auto;}*{scrollbar-width:initial;}.sidebar{scrollbar-width:thin;}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;}.sidebar .block>ul>li{margin-right:-10px;}.content,nav{max-width:960px;}.hidden{display:none !important;}.logo-container{height:100px;width:100px;position:relative;margin:20px auto;display:block;margin-top:10px;}.logo-container>img{max-width:100px;max-height:100px;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;}.sidebar .location{border:1px solid;font-size:17px;margin:30px 10px 20px 10px;text-align:center;word-wrap:break-word;}.sidebar .version{font-size:15px;text-align:center;border-bottom:1px solid;overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;}.location:empty{border:none;}.location a:first-child{font-weight:500;}.block{padding:0;margin-bottom:14px;}.block h2,.block h3{margin-top:0;margin-bottom:8px;text-align:center;}.block ul,.block li{margin:0 10px;padding:0;list-style:none;}.block a{display:block;text-overflow:ellipsis;overflow:hidden;line-height:15px;padding:7px 5px;font-size:14px;font-weight:300;transition:border 500ms ease-out;}.sidebar-title{border-top:1px solid;border-bottom:1px solid;text-align:center;font-size:17px;margin-bottom:5px;}.sidebar-links{margin-bottom:15px;}.sidebar-links>a{padding-left:10px;width:100%;}.sidebar-menu{display:none;}.content{padding:15px 0;}.source .content pre.rust{white-space:pre;overflow:auto;padding-left:0;}.rustdoc:not(.source) .example-wrap{display:inline-flex;margin-bottom:10px;position:relative;}.example-wrap{width:100%;}.example-wrap>pre.line-number{overflow:initial;border:1px solid;border-top-left-radius:5px;border-bottom-left-radius:5px;padding:13px 8px;text-align:right;}.rustdoc:not(.source) .example-wrap>pre.rust{width:100%;overflow-x:auto;}.rustdoc:not(.source) .example-wrap>pre{margin:0;}#search{margin-left:230px;position:relative;}#results{position:absolute;right:0;left:0;overflow:auto;}#results>table{width:100%;table-layout:fixed;margin-bottom:40px;}.content pre.line-numbers{float:left;border:none;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.line-numbers span{cursor:pointer;}.docblock-short{overflow-wrap:anywhere;}.docblock-short p{display:inline;}.docblock-short p{overflow:hidden;text-overflow:ellipsis;margin:0;}.docblock code,.docblock-short code{white-space:pre-wrap;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom:1px solid;}#main>.docblock h1{font-size:1.3em;}#main>.docblock h2{font-size:1.15em;}#main>.docblock h3,#main>.docblock h4,#main>.docblock h5{font-size:1em;}#main>h2+div,#main>h2+h3,#main>h3+div{display:none;flex-wrap:wrap;}.docblock h1{font-size:1em;}.docblock h2{font-size:0.95em;}.docblock h3,.docblock h4,.docblock h5{font-size:0.9em;}.docblock{margin-left:24px;position:relative;}.content .out-of-band{float:right;font-size:23px;margin:0px;padding:0px;font-weight:normal;}h3.impl>.out-of-band{font-size:21px;}h4.method>.out-of-band{font-size:19px;}h4>code,h3>code,.invisible>code{max-width:calc(100% - 41px);display:block;}.invisible{width:100%;display:inline-block;}.content .in-band{margin:0px;padding:0px;}.in-band>code{display:inline-block;}#main{position:relative;}#main>.since{top:inherit;font-family:"Fira Sans",sans-serif;}.content table:not(.table-display){border-spacing:0 5px;}.content td{vertical-align:top;}.content td:first-child{padding-right:20px;}.content td p:first-child{margin-top:0;}.content td h1,.content td h2{margin-left:0;font-size:1.1em;}.content tr:first-child td{border-top:0;}.docblock table{margin:.5em 0;width:calc(100% - 2px);border:1px dashed;}.docblock table td{padding:.5em;border:1px dashed;}.docblock table th{padding:.5em;text-align:left;border:1px solid;}.fields+table{margin-bottom:1em;}.content .item-list{list-style-type:none;padding:0;}.content .multi-column{-moz-column-count:5;-moz-column-gap:2.5em;-webkit-column-count:5;-webkit-column-gap:2.5em;column-count:5;column-gap:2.5em;}.content .multi-column li{width:100%;display:inline-block;}.content .method{font-size:1em;position:relative;}.content .method .where,.content .fn .where,.content .where.fmt-newline{display:block;font-size:0.8em;}.content .methods>div:not(.notable-traits){margin-left:40px;margin-bottom:15px;}.content .docblock>.impl-items{margin-left:20px;margin-top:-34px;}.content .docblock>.impl-items>h4{border-bottom:0;}.content .docblock>.impl-items .table-display{margin:0;}.content .docblock>.impl-items table td{padding:0;}.toggle-wrapper.marg-left>.collapse-toggle{left:-24px;}.content .docblock>.impl-items .table-display,.impl-items table td{border:none;}.content .stability code{font-size:90%;}.content .stability{position:relative;margin-left:33px;margin-top:-13px;}.sub-variant>div>.stability{margin-top:initial;}.content .stability::before{content:'⬑';font-size:25px;position:absolute;top:-6px;left:-19px;}.content .impl-items .method,.content .impl-items>.type,.impl-items>.associatedconstant{margin-left:20px;}.content .impl-items .docblock,.content .impl-items .stability{margin-bottom:.6em;}.content .impl-items>.stability{margin-left:40px;}.methods>.stability,.content .impl-items>.stability{margin-top:-8px;}.impl-items{flex-basis:100%;}#main>.stability{margin-top:0;}nav:not(.sidebar){border-bottom:1px solid;padding-bottom:10px;margin-bottom:10px;}nav.main{padding:20px 0;text-align:center;}nav.main .current{border-top:1px solid;border-bottom:1px solid;}nav.main .separator{border:1px solid;display:inline-block;height:23px;margin:0 20px;}nav.sum{text-align:right;}nav.sub form{display:inline;}nav.sub,.content{margin-left:230px;}a{text-decoration:none;background:transparent;}.small-section-header:hover>.anchor{display:initial;}.in-band:hover>.anchor,.impl:hover>.anchor{display:inline-block;position:absolute;}.anchor{display:none;position:absolute;left:-7px;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-28px;padding-right:10px;}.anchor:before{content:'\2002\00a7\2002';}.docblock a:not(.srclink):not(.test-arrow):hover,.docblock-short a:not(.srclink):not(.test-arrow):hover,.stability a{text-decoration:underline;}.invisible>.srclink,h4>code+.srclink{position:absolute;top:0;right:0;font-size:17px;font-weight:normal;}.block a.current.crate{font-weight:500;}.search-container{position:relative;}.search-container>div{display:inline-flex;width:calc(100% - 63px);}#crate-search{margin-top:5px;padding:6px;padding-right:19px;flex:none;border:0;border-right:0;border-radius:4px 0 0 4px;outline:none;cursor:pointer;border-right:1px solid;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;text-overflow:"";background-repeat:no-repeat;background-color:transparent;background-size:20px;background-position:calc(100% - 1px) 56%;}.search-container>.top-button{position:absolute;right:0;top:10px;}.search-input{-moz-box-sizing:border-box !important;box-sizing:border-box !important;outline:none;border:none;border-radius:1px;margin-top:5px;padding:10px 16px;font-size:17px;transition:border-color 300ms ease;transition:border-radius 300ms ease-in-out;transition:box-shadow 300ms ease-in-out;width:100%;}#crate-search+.search-input{border-radius:0 1px 1px 0;width:calc(100% - 32px);}.search-input:focus{border-radius:2px;border:0;outline:0;}.search-results .desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:block;}.search-results a{display:block;}.content .search-results td:first-child{padding-right:0;width:50%;}.content .search-results td:first-child a{padding-right:10px;}.content .search-results td:first-child a:after{clear:both;content:"";display:block;}.content .search-results td:first-child a span{float:left;}tr.result span.primitive::after{content:' (primitive type)';font-style:italic;}tr.result span.keyword::after{content:' (keyword)';font-style:italic;}body.blur>:not(#help){filter:blur(8px);-webkit-filter:blur(8px);opacity:.7;}#help{width:100%;height:100vh;position:fixed;top:0;left:0;display:flex;justify-content:center;align-items:center;}#help>div{flex:0 0 auto;box-shadow:0 0 6px rgba(0,0,0,.2);width:550px;height:auto;border:1px solid;}#help dt{float:left;clear:left;display:block;}#help>div>span{text-align:center;display:block;margin:10px 0;font-size:18px;border-bottom:1px solid #ccc;padding-bottom:4px;margin-bottom:6px;}#help dd{margin:5px 35px;}#help .infos{padding-left:0;}#help h1,#help h2{margin-top:0;}#help>div div{width:50%;float:left;padding:0 20px 20px 17px;;}.stab{display:table;border-width:1px;border-style:solid;padding:3px;margin-bottom:5px;font-size:90%;}.stab p{display:inline;}.stab summary{display:list-item;}.stab .emoji{font-size:1.5em;}.module-item .stab{border-radius:3px;display:inline-block;font-size:80%;line-height:1.2;margin-bottom:0;margin-right:.3em;padding:2px;vertical-align:text-bottom;}.module-item.unstable{opacity:0.65;}.since{font-weight:normal;font-size:initial;position:absolute;right:0;top:0;}.impl-items .since,.impl .since{flex-grow:0;padding-left:12px;padding-right:2px;position:initial;}.impl-items .srclink,.impl .srclink{flex-grow:0;font-size:17px;font-weight:normal;}.impl-items code,.impl code{flex-grow:1;}.impl-items h4,h4.impl,h3.impl{display:flex;flex-basis:100%;font-size:16px;margin-bottom:12px;justify-content:space-between;}.variants_table{width:100%;}.variants_table tbody tr td:first-child{width:1%;}td.summary-column{width:100%;}.summary{padding-right:0px;}pre.rust .question-mark{font-weight:bold;}a.test-arrow{display:inline-block;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:130%;top:5px;right:5px;z-index:1;}a.test-arrow:hover{text-decoration:none;}.section-header:hover a:before{position:absolute;left:-25px;padding-right:10px;content:'\2002\00a7\2002';}.section-header:hover a{text-decoration:none;}.section-header a{color:inherit;}.collapse-toggle{font-weight:300;position:absolute;left:-23px;top:0;}h3>.collapse-toggle,h4>.collapse-toggle{font-size:0.8em;top:5px;}.toggle-wrapper>.collapse-toggle{left:-24px;margin-top:0px;}.toggle-wrapper{position:relative;margin-top:0;}.toggle-wrapper.collapsed{height:25px;transition:height .2s;margin-bottom:.6em;}.collapse-toggle>.inner{display:inline-block;width:1.2ch;text-align:center;}.collapse-toggle.hidden-default{position:relative;margin-left:20px;}.since+.srclink{display:table-cell;padding-left:10px;}.item-spacer{width:100%;height:12px;}.out-of-band>span.since{position:initial;font-size:20px;margin-right:5px;}.toggle-wrapper>.collapse-toggle{left:0;}.variant+.toggle-wrapper+.docblock>p{margin-top:5px;}.sub-variant,.sub-variant>h3{margin-top:1px !important;}#main>.sub-variant>h3{font-size:15px;margin-left:25px;margin-bottom:5px;}.sub-variant>div{margin-left:20px;margin-bottom:10px;}.sub-variant>div>span{display:block;position:relative;}.toggle-label{display:inline-block;margin-left:4px;margin-top:3px;}.enum>.toggle-wrapper+.docblock,.struct>.toggle-wrapper+.docblock{margin-left:30px;margin-bottom:20px;margin-top:5px;}.docblock>.section-header:first-child{margin-left:15px;margin-top:0;}.docblock>.section-header:first-child:hover>a:before{left:-10px;}.enum>.collapsed,.struct>.collapsed{margin-bottom:25px;}#main>.variant,#main>.structfield{display:block;}.attributes{display:block;margin-top:0px !important;margin-right:0px;margin-bottom:0px !important;margin-left:30px;}.toggle-attributes.collapsed{margin-bottom:0;}.impl-items>.toggle-attributes{margin-left:20px;}.impl-items .attributes{font-weight:500;}:target>code{opacity:1;}.information{position:absolute;left:-25px;margin-top:7px;z-index:1;}.tooltip{position:relative;display:inline-block;cursor:pointer;}.tooltip .tooltiptext{width:120px;display:none;text-align:center;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;top:-5px;left:105%;z-index:10;font-size:16px;}.tooltip .tooltiptext::after{content:" ";position:absolute;top:50%;left:16px;margin-top:-5px;border-width:5px;border-style:solid;}.tooltip:hover .tooltiptext{display:inline;}.tooltip.compile_fail,.tooltip.should_panic,.tooltip.ignore{font-weight:bold;font-size:20px;}.notable-traits-tooltip{display:inline-block;cursor:pointer;}.notable-traits:hover .notable-traits-tooltiptext,.notable-traits .notable-traits-tooltiptext.force-tooltip{display:inline-block;}.notable-traits .notable-traits-tooltiptext{display:none;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;z-index:10;font-size:16px;cursor:default;position:absolute;border:1px solid;}.notable-traits-tooltip::after{content:"\00a0\00a0\00a0";}.notable-traits .notable,.notable-traits .docblock{margin:0;}.notable-traits .docblock code.content{margin:0;padding:0;font-size:20px;}pre.rust.rust-example-rendered{position:relative;}pre.rust{tab-size:4;-moz-tab-size:4;}.search-failed{text-align:center;margin-top:20px;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#titles{height:35px;}#titles>div{float:left;width:33.3%;text-align:center;font-size:18px;cursor:pointer;border-top:2px solid;}#titles>div:not(:last-child){margin-right:1px;width:calc(33.3% - 1px);}#titles>div>div.count{display:inline-block;font-size:16px;}.notable-traits{cursor:pointer;z-index:2;margin-left:5px;}h4>.notable-traits{position:absolute;left:-44px;top:2px;}#all-types{text-align:center;border:1px solid;margin:0 10px;margin-bottom:10px;display:block;border-radius:7px;}#all-types>p{margin:5px 0;}#sidebar-toggle{position:fixed;top:30px;left:300px;z-index:10;padding:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;cursor:pointer;font-weight:bold;transition:left .5s;font-size:1.2em;border:1px solid;border-left:0;}#source-sidebar{position:fixed;top:0;bottom:0;left:0;width:300px;z-index:1;overflow:auto;transition:left .5s;border-right:1px solid;}#source-sidebar>.title{font-size:1.5em;text-align:center;border-bottom:1px solid;margin-bottom:6px;}.theme-picker{position:absolute;left:211px;top:19px;}.theme-picker button{outline:none;}#settings-menu,.help-button{position:absolute;top:10px;}#settings-menu{right:0;outline:none;}.help-button{right:30px;font-family:"Fira Sans",sans-serif;text-align:center;font-size:17px;}#theme-picker,#settings-menu,.help-button{padding:4px;width:27px;height:29px;border:1px solid;border-radius:3px;cursor:pointer;}#theme-choices{display:none;position:absolute;left:0;top:28px;border:1px solid;border-radius:3px;z-index:1;cursor:pointer;}#theme-choices>button{border:none;width:100%;padding:4px 8px;text-align:center;background:rgba(0,0,0,0);}#theme-choices>button:not(:first-child){border-top:1px solid;}@media (min-width:701px){.information:first-child>.tooltip{margin-top:16px;}}@media (max-width:700px){body{padding-top:0px;}.rustdoc>.sidebar{height:45px;min-height:40px;margin:0;margin-left:-15px;padding:0 15px;position:static;z-index:11;}.sidebar>.location{float:right;margin:0px;margin-top:2px;padding:3px 10px 1px 10px;min-height:39px;background:inherit;text-align:left;font-size:24px;}.sidebar .location:empty{padding:0;}.sidebar .logo-container{width:35px;height:35px;margin-top:5px;margin-bottom:5px;float:left;margin-left:50px;}.sidebar .logo-container>img{max-width:35px;max-height:35px;}.sidebar-menu{position:fixed;z-index:10;font-size:2rem;cursor:pointer;width:45px;left:0;text-align:center;display:block;border-bottom:1px solid;border-right:1px solid;height:45px;}.rustdoc.source>.sidebar>.sidebar-menu{display:none;}.sidebar-elems{position:fixed;z-index:1;left:0;top:45px;bottom:0;overflow-y:auto;border-right:1px solid;display:none;}.sidebar>.block.version{border-bottom:none;margin-top:12px;}nav.sub{width:calc(100% - 32px);float:right;}.content{margin-left:0px;}#main{margin-top:45px;padding:0;}.content .in-band{width:100%;}.content h4>.out-of-band{position:inherit;}.toggle-wrapper>.collapse-toggle{left:0px;}.toggle-wrapper{height:1.5em;}#search{margin-left:0;}.content .impl-items .method,.content .impl-items>.type,.impl-items>.associatedconstant{display:flex;}.anchor{display:none !important;}h1.fqn{overflow:initial;}.theme-picker{left:10px;top:54px;z-index:1;}h4>.notable-traits{position:absolute;left:-22px;top:24px;}#titles>div>div.count{float:left;width:100%;}#titles{height:50px;}.sidebar.mobile{position:fixed;width:100%;margin-left:0;background-color:rgba(0,0,0,0);height:100%;}.sidebar{width:calc(100% + 30px);}.show-it{display:block;width:246px;}.show-it>.block.items{margin:8px 0;}.show-it>.block.items>ul{margin:0;}.show-it>.block.items>ul>li{text-align:center;margin:2px 0;}.show-it>.block.items>ul>li>a{font-size:21px;}#sidebar-filler{position:fixed;left:45px;width:calc(100% - 45px);top:0;height:45px;z-index:-1;border-bottom:1px solid;}.collapse-toggle{left:-20px;}.impl>.collapse-toggle{left:-10px;}#all-types{margin:10px;}#sidebar-toggle{top:100px;width:30px;font-size:1.5rem;text-align:center;padding:0;}#source-sidebar{z-index:11;}#main>.line-numbers{margin-top:0;}.notable-traits .notable-traits-tooltiptext{left:0;top:100%;}.help-button{display:none;}.search-container>div{width:calc(100% - 32px);}}@media print{nav.sub,.content .out-of-band,.collapse-toggle{display:none;}}@media (max-width:416px){#titles,#titles>div{height:73px;}#main>table:not(.table-display) td{word-break:break-word;min-width:10%;}.search-container>div{display:block;width:calc(100% - 37px);}#crate-search{width:100%;border-radius:4px;border:0;}#crate-search+.search-input{width:calc(100% + 71px);margin-left:-36px;}#theme-picker,#settings-menu{padding:5px;width:31px;height:31px;}#theme-picker{margin-top:-2px;}#settings-menu{top:7px;}}h3.notable{margin:0;margin-bottom:13px;font-size:19px;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px;border-radius:3px;box-shadow:inset 0 -1px 0;cursor:default;}.hidden-by-impl-hider,.hidden-by-usual-hider{display:none !important;}#implementations-list>h3>span.in-band{width:100%;}.table-display{width:100%;border:0;border-collapse:collapse;border-spacing:0;font-size:16px;}.table-display tr td:first-child{padding-right:0;}.table-display tr td:last-child{float:right;}.table-display .out-of-band{position:relative;font-size:19px;display:block;}#implementors-list>.impl-items .table-display .out-of-band{font-size:17px;}.table-display td:hover .anchor{display:block;top:2px;left:-5px;}#main>ul{padding-left:10px;}#main>ul>li{list-style:none;}.non-exhaustive{margin-bottom:1em;}div.children{padding-left:27px;display:none;}div.name{cursor:pointer;position:relative;margin-left:16px;}div.files>a{display:block;padding:0 3px;}div.files>a:hover,div.name:hover{background-color:#a14b4b;}div.name.expand+.children{display:block;}div.name::before{content:"\25B6";padding-left:4px;font-size:0.7em;position:absolute;left:-16px;top:4px;}div.name.expand::before{transform:rotate(90deg);left:-15px;top:2px;}.type-decl>pre>.toggle-wrapper.toggle-attributes.top-attr{margin-left:0 !important;}.type-decl>pre>.docblock.attributes.top-attr{margin-left:1.8em !important;}.type-decl>pre>.toggle-attributes{margin-left:2.2em;}.type-decl>pre>.docblock.attributes{margin-left:4em;} \ No newline at end of file diff --git a/0.10.0/search-index.js b/0.10.0/search-index.js new file mode 100644 index 000000000..47d804ac1 --- /dev/null +++ b/0.10.0/search-index.js @@ -0,0 +1,4 @@ +var searchIndex = JSON.parse('{\ +"chemfiles":{"doc":"Chemfiles is a multi-language library written in modern…","i":[[3,"Error","chemfiles","Error type for Chemfiles.",null,null],[12,"status","","The error status code",0,null],[12,"message","","A message describing the error cause",0,null],[3,"Atom","","An `Atom` is a particle in the current `Frame`. It stores…",null,null],[3,"AtomRef","","An analog to a reference to an atom (`&Atom`)",null,null],[3,"AtomMut","","An analog to a mutable reference to an atom (`&mut Atom`)",null,null],[3,"UnitCell","","An `UnitCell` represent the box containing the atoms, and…",null,null],[3,"UnitCellRef","","An analog to a reference to an unit cell (`&UnitCell`)",null,null],[3,"UnitCellMut","","An analog to a mutable reference to an unit cell (`&mut…",null,null],[3,"Residue","","A `Residue` is a group of atoms belonging to the same…",null,null],[3,"ResidueRef","","An analog to a reference to a residue (`&Residue`)",null,null],[3,"Topology","","A `Topology` contains the definition of all the atoms in…",null,null],[3,"TopologyRef","","An analog to a reference to a topology (`&Topology`)",null,null],[3,"Frame","","A `Frame` contains data from one simulation step: the…",null,null],[3,"Trajectory","","The `Trajectory` type is the main entry point when using…",null,null],[3,"Match","","A `Match` is a set of atomic indexes matching a given…",null,null],[3,"Selection","","A `Selection` allow to select atoms in a `Frame`, from a…",null,null],[3,"PropertiesIter","","An iterator over the properties in an atom/frame/residue",null,null],[3,"FormatMetadata","","`FormatMetadata` contains metdata associated with one…",null,null],[12,"name","","Name of the format.",1,null],[12,"extension","","Extension associated with the format.",1,null],[12,"description","","Extended, user-facing description of the format.",1,null],[12,"reference","","URL pointing to the format definition/reference.",1,null],[12,"read","","Is reading files in this format implemented?",1,null],[12,"write","","Is writing files in this format implemented?",1,null],[12,"memory","","Does this format support in-memory IO?",1,null],[12,"positions","","Does this format support storing atomic positions?",1,null],[12,"velocities","","Does this format support storing atomic velocities?",1,null],[12,"unit_cell","","Does this format support storing unit cell information?",1,null],[12,"atoms","","Does this format support storing atom names or types?",1,null],[12,"bonds","","Does this format support storing bonds between atoms?",1,null],[12,"residues","","Does this format support storing residues?",1,null],[4,"Status","","Possible causes of error in chemfiles",null,null],[13,"Success","","No error",2,null],[13,"MemoryError","","Error in memory allocations",2,null],[13,"FileError","","Error while reading or writing a file",2,null],[13,"FormatError","","Error in file formatting, i.e. the file is invalid",2,null],[13,"SelectionError","","Error in selection string syntax",2,null],[13,"ConfigurationError","","Error in configuration files syntax",2,null],[13,"OutOfBounds","","Error for out of bounds indexing",2,null],[13,"PropertyError","","Error related to properties",2,null],[13,"ChemfilesError","","Exception in the C++ chemfiles library",2,null],[13,"StdCppError","","Exception in the C++ standard library",2,null],[13,"UTF8PathError","","The given path is not valid UTF8",2,null],[4,"CellShape","","Available unit cell shapes.",null,null],[13,"Orthorhombic","","Orthorhombic cell, with the three angles equals to 90°.",3,null],[13,"Triclinic","","Triclinic cell, with any values for the angles.",3,null],[13,"Infinite","","Infinite cell, to use when there is no cell.",3,null],[4,"BondOrder","","Possible bond order associated with bonds",null,null],[13,"Unknown","","Unknown or unspecified bond order",4,null],[13,"Single","","Single bond",4,null],[13,"Double","","Double bond",4,null],[13,"Triple","","Triple bond",4,null],[13,"Quadruple","","Quadruple bond (present in some metals)",4,null],[13,"Quintuplet","","Quintuplet bond (present in some metals)",4,null],[13,"Amide","","Amide bond (required by some file formats)",4,null],[13,"Aromatic","","Aromatic bond (required by some file formats)",4,null],[4,"Property","","A `Property` is a piece of data that can be associated…",null,null],[13,"Bool","","Boolean property",5,null],[13,"Double","","Floating point property",5,null],[13,"String","","String property",5,null],[13,"Vector3D","","3-dimensional vector property",5,null],[5,"set_warning_callback","","Use `callback` for every chemfiles warning. The callback…",null,[[]]],[5,"formats_list","","Get the list of formats known by chemfiles, as well as all…",null,[[],[["vec",3],["formatmetadata",3]]]],[5,"version","","Get the version of the chemfiles library.",null,[[],["string",3]]],[5,"add_configuration","","Read configuration data from the file at `path`.",null,[[],[["result",4],["error",3]]]],[11,"last_error","","Get the last error message from the C++ library.",0,[[],["string",3]]],[11,"cleanup","","Clear any error from the C++ library",0,[[]]],[11,"new","","Create an atom with the given `name`, and set the atom…",6,[[],["atom",3]]],[11,"mass","","Get the atom mass, in atomic mass units.",6,[[]]],[11,"set_mass","","Set the atom mass to `mass`, in atomic mass units.",6,[[]]],[11,"charge","","Get the atom charge, in number of the electron charge e.",6,[[]]],[11,"set_charge","","Set the atom charge to `charge`, in number of the electron…",6,[[]]],[11,"name","","Get the atom name.",6,[[],["string",3]]],[11,"atomic_type","","Get the atom type.",6,[[],["string",3]]],[11,"set_name","","Set the atom name to `name`.",6,[[]]],[11,"set_atomic_type","","Set the atom type to `atomic_type`.",6,[[]]],[11,"full_name","","Try to get the full name of the atom from the atomic type.…",6,[[],["string",3]]],[11,"vdw_radius","","Try to get the Van der Waals radius of the atom from the…",6,[[]]],[11,"covalent_radius","","Try to get the covalent radius of the atom from the atomic…",6,[[]]],[11,"atomic_number","","Try to get the atomic number of the atom from the atomic…",6,[[]]],[11,"set","","Add a new `property` with the given `name` to this atom.",6,[[]]],[11,"get","","Get a property with the given `name` in this atom, if it…",6,[[],[["option",4],["property",4]]]],[11,"properties","","Get an iterator over all (name, property) pairs for this…",6,[[],["propertiesiter",3]]],[11,"new","","Create an `Orthorhombic` `UnitCell` from the three…",7,[[],["unitcell",3]]],[11,"infinite","","Create an `Infinite` `UnitCell`.",7,[[],["unitcell",3]]],[11,"triclinic","","Create an `Triclinic` `UnitCell` from the three lengths…",7,[[],["unitcell",3]]],[11,"from_matrix","","Create an `UnitCell` from a cell matrix. If `matrix`…",7,[[],["unitcell",3]]],[11,"lengths","","Get the three lengths of the cell, in Angstroms.",7,[[]]],[11,"set_lengths","","Set the three lengths of the cell, in Angstroms.",7,[[],[["result",4],["error",3]]]],[11,"angles","","Get the three angles of the cell, in degrees.",7,[[]]],[11,"set_angles","","Set the three angles of the cell, in degrees.",7,[[],[["result",4],["error",3]]]],[11,"matrix","","Get the unit cell matricial representation.",7,[[]]],[11,"shape","","Get the shape of the unit cell.",7,[[],["cellshape",4]]],[11,"set_shape","","Set the shape of the unit cell to `shape`.",7,[[["cellshape",4]],[["result",4],["error",3]]]],[11,"volume","","Get the volume of the unit cell.",7,[[]]],[11,"wrap","","Wrap a `vector` in this unit cell.",7,[[]]],[11,"new","","Create a new residue with the given `name`",8,[[],["residue",3]]],[11,"with_id","","Create a new residue with the given `name` and `id` as…",8,[[],["residue",3]]],[11,"size","","Get the number of atoms in this residue.",8,[[]]],[11,"id","","Get the identifier of this residue in the initial topology…",8,[[],["option",4]]],[11,"name","","Get the name of this residue.",8,[[],["string",3]]],[11,"add_atom","","Add the atom at index `atom` in this residue.",8,[[]]],[11,"contains","","Check if the atom at index `i` is in this residue",8,[[]]],[11,"atoms","","Get the list of atoms of this residue.",8,[[],["vec",3]]],[11,"set","","Add a new `property` with the given `name` to this residue.",8,[[]]],[11,"get","","Get a property with the given `name` in this frame, if it…",8,[[],[["option",4],["property",4]]]],[11,"properties","","Get an iterator over all (name, property) pairs for this…",8,[[],["propertiesiter",3]]],[11,"new","","Create a new empty topology.",9,[[],["topology",3]]],[11,"atom","","Get a reference of the atom at the given `index` in this…",9,[[],["atomref",3]]],[11,"atom_mut","","Get a mutable reference to the atom at the given `index`…",9,[[],["atommut",3]]],[11,"size","","Get the current number of atoms in this topology.",9,[[]]],[11,"resize","","Resize this topology to hold `natoms` atoms, inserting…",9,[[]]],[11,"add_atom","","Add an `Atom` at the end of this topology",9,[[["atom",3]]]],[11,"remove","","Remove an `Atom` from this topology by `index`. This…",9,[[]]],[11,"bonds_count","","Get the number of bonds in the topology.",9,[[]]],[11,"angles_count","","Get the number of angles in the topology.",9,[[]]],[11,"dihedrals_count","","Get the number of dihedral angles in the topology.",9,[[]]],[11,"impropers_count","","Get the number of improper dihedral angles in the topology.",9,[[]]],[11,"bonds","","Get the list of bonds in the topology.",9,[[],["vec",3]]],[11,"angles","","Get the list of angles in the topology.",9,[[],["vec",3]]],[11,"dihedrals","","Get the list of dihedral angles in the topology.",9,[[],["vec",3]]],[11,"impropers","","Get the list of improper dihedral angles in the topology.",9,[[],["vec",3]]],[11,"clear_bonds","","Remove all existing bonds, angles, dihedral angles and…",9,[[]]],[11,"add_bond","","Add a bond between the atoms at indexes `i` and `j` in the…",9,[[]]],[11,"add_bond_with_order","","Add a bond between the atoms at indexes `i` and `j` in the…",9,[[["bondorder",4]]]],[11,"bond_order","","Get the bond order for the bond between the atoms at…",9,[[],["bondorder",4]]],[11,"bond_orders","","Get the bond order for all the bonds in the topology",9,[[],[["vec",3],["bondorder",4]]]],[11,"remove_bond","","Remove any existing bond between the atoms at indexes `i`…",9,[[]]],[11,"residue","","Get a reference to the residue at index `index` from this…",9,[[],[["option",4],["residueref",3]]]],[11,"residue_for_atom","","Get a copy of the residue containing the atom at index…",9,[[],[["option",4],["residueref",3]]]],[11,"residues_count","","Get the number of residues in this topology.",9,[[]]],[11,"add_residue","","Add a residue to this topology.",9,[[["residue",3]],[["result",4],["error",3]]]],[11,"are_linked","","Check if the two residues `first` and `second` from the…",9,[[["residue",3]]]],[11,"new","","Create an empty frame. It will be resized by the library…",10,[[],["frame",3]]],[11,"atom","","Get a reference to the atom at the given `index` in this…",10,[[],["atomref",3]]],[11,"atom_mut","","Get a mutable reference to the atom at the given `index`…",10,[[],["atommut",3]]],[11,"size","","Get the current number of atoms in this frame.",10,[[]]],[11,"resize","","Resize the positions and the velocities in this frame, to…",10,[[]]],[11,"add_atom","","Add an `Atom` and the corresponding position and…",10,[[["atom",3]]]],[11,"remove","","Remove the atom at index `i` in this frame.",10,[[]]],[11,"add_bond","","Add a bond between the atoms at indexes `i` and `j` in the…",10,[[]]],[11,"add_bond_with_order","","Add a bond between the atoms at indexes `i` and `j` in the…",10,[[["bondorder",4]]]],[11,"remove_bond","","Remove any existing bond between the atoms at indexes `i`…",10,[[]]],[11,"add_residue","","Add a copy of `residue` to this frame.",10,[[["residue",3]],[["result",4],["error",3]]]],[11,"distance","","Get the distance between the atoms at indexes `i` and `j`…",10,[[]]],[11,"angle","","Get the angle formed by the atoms at indexes `i`, `j` and…",10,[[]]],[11,"dihedral","","Get the dihedral angle formed by the atoms at indexes `i`,…",10,[[]]],[11,"out_of_plane","","Get the out of plane distance formed by the atoms at…",10,[[]]],[11,"positions","","Get a view into the positions of this frame.",10,[[]]],[11,"positions_mut","","Get a mutable view into the positions of this frame.",10,[[]]],[11,"velocities","","Get a view into the velocities of this frame.",10,[[]]],[11,"velocities_mut","","Get a mutable view into the velocities of this frame.",10,[[]]],[11,"has_velocities","","Check if this frame contains velocity data.",10,[[]]],[11,"add_velocities","","Add velocity data to this frame. If the frame already have…",10,[[]]],[11,"cell","","Get a reference to the `UnitCell` from this frame.",10,[[],["unitcellref",3]]],[11,"cell_mut","","Get a mutable reference to the `UnitCell` from this frame.",10,[[],["unitcellmut",3]]],[11,"set_cell","","Set the `UnitCell` of this frame to `cell`.",10,[[["unitcell",3]]]],[11,"topology","","Get a reference to the `Topology` of this frame.",10,[[],["topologyref",3]]],[11,"set_topology","","Set the `Topology` of this frame to `topology`.",10,[[["topology",3]],[["result",4],["error",3]]]],[11,"step","","Get this frame step, i.e. the frame number in the trajectory",10,[[]]],[11,"set_step","","Set this frame step to `step`.",10,[[]]],[11,"guess_bonds","","Guess the bonds, angles and dihedrals in this `frame`.",10,[[],[["result",4],["error",3]]]],[11,"clear_bonds","","Remove all existing bonds, angles, dihedral angles and…",10,[[]]],[11,"set","","Add a new `property` with the given `name` to this frame.",10,[[]]],[11,"get","","Get a property with the given `name` in this frame, if it…",10,[[],[["option",4],["property",4]]]],[11,"properties","","Get an iterator over all (name, property) pairs for this…",10,[[],["propertiesiter",3]]],[11,"open","","Open the file at the given `path` in the given `mode`.",11,[[],[["trajectory",3],["error",3],["result",4]]]],[11,"open_with_format","","Open the file at the given `path` using a specific file…",11,[[],[["trajectory",3],["error",3],["result",4]]]],[11,"memory_reader","","Read a memory buffer as though it was a formatted file.",11,[[],[["trajectory",3],["error",3],["result",4]]]],[11,"memory_writer","","Write to a memory buffer as though it was a formatted file.",11,[[],[["trajectory",3],["error",3],["result",4]]]],[11,"read","","Read the next step of this trajectory into a `frame`.",11,[[["frame",3]],[["result",4],["error",3]]]],[11,"read_step","","Read a specific `step` of this trajectory into a `frame`.",11,[[["frame",3]],[["result",4],["error",3]]]],[11,"write","","Write a `frame` to this trajectory.",11,[[["frame",3]],[["result",4],["error",3]]]],[11,"set_topology","","Set the `topology` associated with this trajectory. This…",11,[[["topology",3]]]],[11,"set_topology_file","","Set the topology associated with this trajectory by…",11,[[],[["result",4],["error",3]]]],[11,"set_topology_with_format","","Set the topology associated with this trajectory by…",11,[[],[["result",4],["error",3]]]],[11,"set_cell","","Set the unit `cell` associated with a trajectory. This…",11,[[["unitcell",3]]]],[11,"nsteps","","Get the number of steps (the number of frames) in a…",11,[[]]],[11,"memory_buffer","","Obtain the memory buffer written to by the trajectory.",11,[[],[["error",3],["result",4]]]],[11,"path","","Get file path for this trajectory.",11,[[],["string",3]]],[11,"len","","Get the length of the Match.",12,[[]]],[11,"new","","Create a new match containing the atoms in the `atoms`…",12,[[],["match",3]]],[11,"iter","","Iterate over the atomic indexes in the match.",12,[[],["iter",3]]],[11,"new","","Create a new selection from the given selection string.",13,[[["into",8]],[["result",4],["selection",3],["error",3]]]],[11,"size","","Get the size of the selection, i.e. the number of atoms we…",13,[[]]],[11,"string","","Get the selection string used to create this selection.",13,[[],["string",3]]],[11,"evaluate","","Evaluate a selection for a given frame, and return the…",13,[[["frame",3]],[["match",3],["vec",3]]]],[11,"list","","Evaluates a selection of size 1 on a given `frame`. This…",13,[[["frame",3]],["vec",3]]],[11,"from","","",0,[[]]],[11,"into","","",0,[[]]],[11,"to_owned","","",0,[[]]],[11,"clone_into","","",0,[[]]],[11,"to_string","","",0,[[],["string",3]]],[11,"borrow","","",0,[[]]],[11,"borrow_mut","","",0,[[]]],[11,"try_from","","",0,[[],["result",4]]],[11,"try_into","","",0,[[],["result",4]]],[11,"type_id","","",0,[[],["typeid",3]]],[11,"from","","",6,[[]]],[11,"into","","",6,[[]]],[11,"to_owned","","",6,[[]]],[11,"clone_into","","",6,[[]]],[11,"borrow","","",6,[[]]],[11,"borrow_mut","","",6,[[]]],[11,"try_from","","",6,[[],["result",4]]],[11,"try_into","","",6,[[],["result",4]]],[11,"type_id","","",6,[[],["typeid",3]]],[11,"from","","",14,[[]]],[11,"into","","",14,[[]]],[11,"borrow","","",14,[[]]],[11,"borrow_mut","","",14,[[]]],[11,"try_from","","",14,[[],["result",4]]],[11,"try_into","","",14,[[],["result",4]]],[11,"type_id","","",14,[[],["typeid",3]]],[11,"from","","",15,[[]]],[11,"into","","",15,[[]]],[11,"borrow","","",15,[[]]],[11,"borrow_mut","","",15,[[]]],[11,"try_from","","",15,[[],["result",4]]],[11,"try_into","","",15,[[],["result",4]]],[11,"type_id","","",15,[[],["typeid",3]]],[11,"from","","",7,[[]]],[11,"into","","",7,[[]]],[11,"to_owned","","",7,[[]]],[11,"clone_into","","",7,[[]]],[11,"borrow","","",7,[[]]],[11,"borrow_mut","","",7,[[]]],[11,"try_from","","",7,[[],["result",4]]],[11,"try_into","","",7,[[],["result",4]]],[11,"type_id","","",7,[[],["typeid",3]]],[11,"from","","",16,[[]]],[11,"into","","",16,[[]]],[11,"borrow","","",16,[[]]],[11,"borrow_mut","","",16,[[]]],[11,"try_from","","",16,[[],["result",4]]],[11,"try_into","","",16,[[],["result",4]]],[11,"type_id","","",16,[[],["typeid",3]]],[11,"from","","",17,[[]]],[11,"into","","",17,[[]]],[11,"borrow","","",17,[[]]],[11,"borrow_mut","","",17,[[]]],[11,"try_from","","",17,[[],["result",4]]],[11,"try_into","","",17,[[],["result",4]]],[11,"type_id","","",17,[[],["typeid",3]]],[11,"from","","",8,[[]]],[11,"into","","",8,[[]]],[11,"to_owned","","",8,[[]]],[11,"clone_into","","",8,[[]]],[11,"borrow","","",8,[[]]],[11,"borrow_mut","","",8,[[]]],[11,"try_from","","",8,[[],["result",4]]],[11,"try_into","","",8,[[],["result",4]]],[11,"type_id","","",8,[[],["typeid",3]]],[11,"from","","",18,[[]]],[11,"into","","",18,[[]]],[11,"borrow","","",18,[[]]],[11,"borrow_mut","","",18,[[]]],[11,"try_from","","",18,[[],["result",4]]],[11,"try_into","","",18,[[],["result",4]]],[11,"type_id","","",18,[[],["typeid",3]]],[11,"from","","",9,[[]]],[11,"into","","",9,[[]]],[11,"to_owned","","",9,[[]]],[11,"clone_into","","",9,[[]]],[11,"borrow","","",9,[[]]],[11,"borrow_mut","","",9,[[]]],[11,"try_from","","",9,[[],["result",4]]],[11,"try_into","","",9,[[],["result",4]]],[11,"type_id","","",9,[[],["typeid",3]]],[11,"from","","",19,[[]]],[11,"into","","",19,[[]]],[11,"borrow","","",19,[[]]],[11,"borrow_mut","","",19,[[]]],[11,"try_from","","",19,[[],["result",4]]],[11,"try_into","","",19,[[],["result",4]]],[11,"type_id","","",19,[[],["typeid",3]]],[11,"from","","",10,[[]]],[11,"into","","",10,[[]]],[11,"to_owned","","",10,[[]]],[11,"clone_into","","",10,[[]]],[11,"borrow","","",10,[[]]],[11,"borrow_mut","","",10,[[]]],[11,"try_from","","",10,[[],["result",4]]],[11,"try_into","","",10,[[],["result",4]]],[11,"type_id","","",10,[[],["typeid",3]]],[11,"from","","",11,[[]]],[11,"into","","",11,[[]]],[11,"borrow","","",11,[[]]],[11,"borrow_mut","","",11,[[]]],[11,"try_from","","",11,[[],["result",4]]],[11,"try_into","","",11,[[],["result",4]]],[11,"type_id","","",11,[[],["typeid",3]]],[11,"from","","",12,[[]]],[11,"into","","",12,[[]]],[11,"to_owned","","",12,[[]]],[11,"clone_into","","",12,[[]]],[11,"borrow","","",12,[[]]],[11,"borrow_mut","","",12,[[]]],[11,"try_from","","",12,[[],["result",4]]],[11,"try_into","","",12,[[],["result",4]]],[11,"type_id","","",12,[[],["typeid",3]]],[11,"from","","",13,[[]]],[11,"into","","",13,[[]]],[11,"to_owned","","",13,[[]]],[11,"clone_into","","",13,[[]]],[11,"borrow","","",13,[[]]],[11,"borrow_mut","","",13,[[]]],[11,"try_from","","",13,[[],["result",4]]],[11,"try_into","","",13,[[],["result",4]]],[11,"type_id","","",13,[[],["typeid",3]]],[11,"from","","",20,[[]]],[11,"into","","",20,[[]]],[11,"into_iter","","",20,[[]]],[11,"borrow","","",20,[[]]],[11,"borrow_mut","","",20,[[]]],[11,"try_from","","",20,[[],["result",4]]],[11,"try_into","","",20,[[],["result",4]]],[11,"type_id","","",20,[[],["typeid",3]]],[11,"from","","",1,[[]]],[11,"into","","",1,[[]]],[11,"to_owned","","",1,[[]]],[11,"clone_into","","",1,[[]]],[11,"borrow","","",1,[[]]],[11,"borrow_mut","","",1,[[]]],[11,"try_from","","",1,[[],["result",4]]],[11,"try_into","","",1,[[],["result",4]]],[11,"type_id","","",1,[[],["typeid",3]]],[11,"from","","",2,[[]]],[11,"into","","",2,[[]]],[11,"to_owned","","",2,[[]]],[11,"clone_into","","",2,[[]]],[11,"borrow","","",2,[[]]],[11,"borrow_mut","","",2,[[]]],[11,"try_from","","",2,[[],["result",4]]],[11,"try_into","","",2,[[],["result",4]]],[11,"type_id","","",2,[[],["typeid",3]]],[11,"from","","",3,[[]]],[11,"into","","",3,[[]]],[11,"to_owned","","",3,[[]]],[11,"clone_into","","",3,[[]]],[11,"borrow","","",3,[[]]],[11,"borrow_mut","","",3,[[]]],[11,"try_from","","",3,[[],["result",4]]],[11,"try_into","","",3,[[],["result",4]]],[11,"type_id","","",3,[[],["typeid",3]]],[11,"from","","",4,[[]]],[11,"into","","",4,[[]]],[11,"to_owned","","",4,[[]]],[11,"clone_into","","",4,[[]]],[11,"borrow","","",4,[[]]],[11,"borrow_mut","","",4,[[]]],[11,"try_from","","",4,[[],["result",4]]],[11,"try_into","","",4,[[],["result",4]]],[11,"type_id","","",4,[[],["typeid",3]]],[11,"from","","",5,[[]]],[11,"into","","",5,[[]]],[11,"to_owned","","",5,[[]]],[11,"clone_into","","",5,[[]]],[11,"borrow","","",5,[[]]],[11,"borrow_mut","","",5,[[]]],[11,"try_from","","",5,[[],["result",4]]],[11,"try_into","","",5,[[],["result",4]]],[11,"type_id","","",5,[[],["typeid",3]]],[11,"drop","","",6,[[]]],[11,"drop","","",7,[[]]],[11,"drop","","",8,[[]]],[11,"drop","","",9,[[]]],[11,"drop","","",10,[[]]],[11,"drop","","",11,[[]]],[11,"drop","","",13,[[]]],[11,"from","","",0,[[["chfl_status",4]],["error",3]]],[11,"from","","",3,[[["chfl_cellshape",4]],["cellshape",4]]],[11,"from","","",4,[[["chfl_bond_order",4]],["bondorder",4]]],[11,"from","","",5,[[]]],[11,"from","","",5,[[]]],[11,"from","","",5,[[["string",3]]]],[11,"from","","",5,[[]]],[11,"from","","",5,[[]]],[11,"next","","",20,[[],["option",4]]],[11,"size_hint","","",20,[[]]],[11,"count","","",20,[[]]],[11,"clone","","",0,[[],["error",3]]],[11,"clone","","",2,[[],["status",4]]],[11,"clone","","",6,[[],["atom",3]]],[11,"clone","","",3,[[],["cellshape",4]]],[11,"clone","","",7,[[],["unitcell",3]]],[11,"clone","","",8,[[],["residue",3]]],[11,"clone","","",4,[[],["bondorder",4]]],[11,"clone","","",9,[[],["topology",3]]],[11,"clone","","",10,[[],["frame",3]]],[11,"clone","","",12,[[],["match",3]]],[11,"clone","","",13,[[],["selection",3]]],[11,"clone","","",5,[[],["property",4]]],[11,"clone","","",1,[[],["formatmetadata",3]]],[11,"cmp","","",4,[[["bondorder",4]],["ordering",4]]],[11,"eq","","",0,[[["error",3]]]],[11,"ne","","",0,[[["error",3]]]],[11,"eq","","",2,[[["status",4]]]],[11,"eq","","",3,[[["cellshape",4]]]],[11,"eq","","",4,[[["bondorder",4]]]],[11,"eq","","",12,[[["match",3]]]],[11,"ne","","",12,[[["match",3]]]],[11,"eq","","",5,[[["property",4]]]],[11,"ne","","",5,[[["property",4]]]],[11,"eq","","",1,[[["formatmetadata",3]]]],[11,"ne","","",1,[[["formatmetadata",3]]]],[11,"partial_cmp","","",4,[[["bondorder",4]],[["ordering",4],["option",4]]]],[11,"partial_cmp","","",5,[[["property",4]],[["ordering",4],["option",4]]]],[11,"lt","","",5,[[["property",4]]]],[11,"le","","",5,[[["property",4]]]],[11,"gt","","",5,[[["property",4]]]],[11,"ge","","",5,[[["property",4]]]],[11,"deref","","",14,[[],["atom",3]]],[11,"deref","","",15,[[],["atom",3]]],[11,"deref","","",16,[[],["unitcell",3]]],[11,"deref","","",17,[[],["unitcell",3]]],[11,"deref","","",18,[[],["residue",3]]],[11,"deref","","",19,[[],["topology",3]]],[11,"deref_mut","","",15,[[],["atom",3]]],[11,"deref_mut","","",17,[[],["unitcell",3]]],[11,"fmt","","",0,[[["formatter",3]],["result",6]]],[11,"fmt","","",2,[[["formatter",3]],["result",6]]],[11,"fmt","","",3,[[["formatter",3]],["result",6]]],[11,"fmt","","",4,[[["formatter",3]],["result",6]]],[11,"fmt","","",12,[[["formatter",3]],["result",6]]],[11,"fmt","","",5,[[["formatter",3]],["result",6]]],[11,"fmt","","",1,[[["formatter",3]],["result",6]]],[11,"fmt","","",0,[[["formatter",3]],[["error",3],["result",4]]]],[11,"index","","",12,[[]]],[11,"description","","",0,[[]]]],"p":[[3,"Error"],[3,"FormatMetadata"],[4,"Status"],[4,"CellShape"],[4,"BondOrder"],[4,"Property"],[3,"Atom"],[3,"UnitCell"],[3,"Residue"],[3,"Topology"],[3,"Frame"],[3,"Trajectory"],[3,"Match"],[3,"Selection"],[3,"AtomRef"],[3,"AtomMut"],[3,"UnitCellRef"],[3,"UnitCellMut"],[3,"ResidueRef"],[3,"TopologyRef"],[3,"PropertiesIter"]]}\ +}'); +addSearchOptions(searchIndex);initSearch(searchIndex); \ No newline at end of file diff --git a/0.10.0/settings.css b/0.10.0/settings.css new file mode 100644 index 000000000..670986588 --- /dev/null +++ b/0.10.0/settings.css @@ -0,0 +1 @@ +.setting-line{padding:5px;position:relative;}.setting-line>div{display:inline-block;vertical-align:top;font-size:17px;padding-top:2px;}.setting-line>.title{font-size:19px;width:100%;max-width:none;border-bottom:1px solid;}.toggle{position:relative;display:inline-block;width:45px;height:27px;margin-right:20px;}.toggle input{opacity:0;position:absolute;}.select-wrapper{float:right;position:relative;height:27px;min-width:25%;}.select-wrapper select{appearance:none;-moz-appearance:none;-webkit-appearance:none;background:none;border:2px solid #ccc;padding-right:28px;width:100%;}.select-wrapper img{pointer-events:none;position:absolute;right:0;bottom:0;background:#ccc;height:100%;width:28px;padding:0px 4px;}.select-wrapper select option{color:initial;}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.3s;transition:.3s;}.slider:before{position:absolute;content:"";height:19px;width:19px;left:4px;bottom:4px;background-color:white;-webkit-transition:.3s;transition:.3s;}input:checked+.slider{background-color:#2196F3;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}input:checked+.slider:before{-webkit-transform:translateX(19px);-ms-transform:translateX(19px);transform:translateX(19px);}.setting-line>.sub-settings{padding-left:42px;width:100%;display:block;} \ No newline at end of file diff --git a/0.10.0/settings.html b/0.10.0/settings.html new file mode 100644 index 000000000..7a1c08a2d --- /dev/null +++ b/0.10.0/settings.html @@ -0,0 +1,6 @@ +Rustdoc settings + +

Rustdoc settings

Theme preferences
Use system theme
Preferred dark theme
Preferred light theme
+
Auto-hide item declarations
Auto-hide structs declaration
Auto-hide enums declaration
Auto-hide unions declaration
Auto-hide traits declaration
Auto-hide macros declaration
+
Auto-hide item attributes.
Auto-hide item methods' documentation
Auto-hide trait implementation documentation
Auto-hide implementors of a trait
Directly go to item in search if there is only one result
Show line numbers on code examples
Disable keyboard shortcuts
\ No newline at end of file diff --git a/0.10.0/settings.js b/0.10.0/settings.js new file mode 100644 index 000000000..50ffabf28 --- /dev/null +++ b/0.10.0/settings.js @@ -0,0 +1 @@ +(function(){function changeSetting(settingName,value){updateLocalStorage("rustdoc-"+settingName,value);switch(settingName){case"preferred-dark-theme":case"preferred-light-theme":case"use-system-theme":updateSystemTheme();break}}function setEvents(){var elems={toggles:document.getElementsByClassName("slider"),selects:document.getElementsByClassName("select-wrapper")};var i;if(elems.toggles&&elems.toggles.length>0){for(i=0;i0){for(i=0;i"){sidebar.style.left="";this.style.left="";child.innerText="<";updateLocalStorage("rustdoc-source-sidebar-show","true")}else{sidebar.style.left="-300px";this.style.left="0";child.innerText=">";updateLocalStorage("rustdoc-source-sidebar-show","false")}}function createSidebarToggle(){var sidebarToggle=document.createElement("div");sidebarToggle.id="sidebar-toggle";sidebarToggle.onclick=toggleSidebar;var inner1=document.createElement("div");inner1.style.position="relative";var inner2=document.createElement("div");inner2.style.paddingTop="3px";if(getCurrentValue("rustdoc-source-sidebar-show")==="true"){inner2.innerText="<"}else{inner2.innerText=">";sidebarToggle.style.left="0"}inner1.appendChild(inner2);sidebarToggle.appendChild(inner1);return sidebarToggle}function createSourceSidebar(){if(window.rootPath.endsWith("/")===false){window.rootPath+="/"}var main=document.getElementById("main");var sidebarToggle=createSidebarToggle();main.insertBefore(sidebarToggle,main.firstChild);var sidebar=document.createElement("div");sidebar.id="source-sidebar";if(getCurrentValue("rustdoc-source-sidebar-show")!=="true"){sidebar.style.left="-300px"}var currentFile=getCurrentFilePath();var hasFoundFile=false;var title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(function(key){sourcesIndex[key].name=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",currentFile,hasFoundFile)});main.insertBefore(sidebar,main.firstChild);var selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}} \ No newline at end of file diff --git a/0.10.0/src/chemfiles/atom.rs.html b/0.10.0/src/chemfiles/atom.rs.html new file mode 100644 index 000000000..5f1739bd8 --- /dev/null +++ b/0.10.0/src/chemfiles/atom.rs.html @@ -0,0 +1,1058 @@ +atom.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null};
+use strings;
+
+use property::{Property, RawProperty, PropertiesIter};
+
+/// An `Atom` is a particle in the current `Frame`. It stores the following
+/// atomic properties:
+///
+/// - atom name;
+/// - atom type;
+/// - atom mass;
+/// - atom charge.
+///
+/// The atom name is usually an unique identifier (`H1`, `C_a`) while the
+/// atom type will be shared between all particles of the same type: `H`,
+/// `Ow`, `CH3`.
+pub struct Atom {
+    handle: *mut CHFL_ATOM,
+}
+
+/// An analog to a reference to an atom (`&Atom`)
+pub struct AtomRef<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a Atom>
+}
+
+impl<'a> Deref for AtomRef<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an atom (`&mut Atom`)
+pub struct AtomMut<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a mut Atom>
+}
+
+impl<'a> Deref for AtomMut<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for AtomMut<'a> {
+    fn deref_mut(&mut self) -> &mut Atom {
+        &mut self.inner
+    }
+}
+
+impl Clone for Atom {
+    fn clone(&self) -> Atom {
+        unsafe {
+            let new_handle = chfl_atom_copy(self.as_ptr());
+            Atom::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Atom {
+    /// Create an owned `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_ATOM) -> Atom {
+        check_not_null(ptr);
+        Atom {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_ATOM) -> AtomRef<'a> {
+        AtomRef {
+            inner: Atom::from_ptr(ptr as *mut CHFL_ATOM),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a mutably borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_ATOM) -> AtomMut<'a> {
+        AtomMut {
+            inner: Atom::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_ATOM {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_ATOM {
+        self.handle
+    }
+
+    /// Create an atom with the given `name`, and set the atom type to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Atom {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_atom(buffer.as_ptr());
+            Atom::from_ptr(handle)
+        }
+    }
+
+    /// Get the atom mass, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.mass(), 4.002602);
+    /// ```
+    pub fn mass(&self) -> f64 {
+        let mut mass = 0.0;
+        unsafe {
+            check_success(chfl_atom_mass(self.as_ptr(), &mut mass));
+        }
+        return mass;
+    }
+
+    /// Set the atom mass to `mass`, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_mass(34.9);
+    /// assert_eq!(atom.mass(), 34.9);
+    /// ```
+    pub fn set_mass(&mut self, mass: f64) {
+        unsafe {
+            check_success(chfl_atom_set_mass(self.as_mut_ptr(), mass));
+        }
+    }
+
+    /// Get the atom charge, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.charge(), 0.0);
+    /// ```
+    pub fn charge(&self) -> f64 {
+        let mut charge = 0.0;
+        unsafe {
+            check_success(chfl_atom_charge(self.as_ptr(), &mut charge));
+        }
+        return charge;
+    }
+
+    /// Set the atom charge to `charge`, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_charge(-2.0);
+    /// assert_eq!(atom.charge(), -2.0);
+    /// ```
+    pub fn set_charge(&mut self, charge: f64) {
+        unsafe {
+            check_success(chfl_atom_set_charge(self.as_mut_ptr(), charge));
+        }
+    }
+
+    /// Get the atom name.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_atom_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_name).expect("getting name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Get the atom type.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.atomic_type(), "He");
+    /// ```
+    pub fn atomic_type(&self) -> String {
+        let get_type = |ptr, len| unsafe { chfl_atom_type(self.as_ptr(), ptr, len) };
+        let buffer = strings::call_autogrow_buffer(10, get_type).expect("getting type failed");
+        return strings::from_c(buffer.as_ptr());
+    }
+
+    /// Set the atom name to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_name("Zn3");
+    /// assert_eq!(atom.name(), "Zn3");
+    /// ```
+    pub fn set_name<'a>(&mut self, name: impl Into<&'a str>) {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            check_success(chfl_atom_set_name(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Set the atom type to `atomic_type`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_atomic_type("F");
+    /// assert_eq!(atom.atomic_type(), "F");
+    /// ```
+    pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>) {
+        let buffer = strings::to_c(atomic_type.into());
+        unsafe {
+            check_success(chfl_atom_set_type(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Try to get the full name of the atom from the atomic type. For example,
+    /// the full name of "He" is "Helium", and so on. If the name can not be
+    /// found, this function returns the empty string.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("Zn");
+    /// assert_eq!(atom.full_name(), "Zinc");
+    /// ```
+    pub fn full_name(&self) -> String {
+        let get_full_name = |ptr, len| unsafe { chfl_atom_full_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_full_name).expect("getting full name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Try to get the Van der Waals radius of the atom from the atomic type.
+    /// If the radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+    /// assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+    /// ```
+    pub fn vdw_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_vdw_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the covalent radius of the atom from the atomic type. If the
+    /// radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+    /// assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+    /// ```
+    pub fn covalent_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_covalent_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the atomic number of the atom from the atomic type. If the
+    /// number can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").atomic_number(), 2);
+    /// assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+    /// ```
+    pub fn atomic_number(&self) -> u64 {
+        let mut number = 0;
+        unsafe {
+            check_success(chfl_atom_atomic_number(self.as_ptr(), &mut number));
+        }
+        return number;
+    }
+
+    /// Add a new `property` with the given `name` to this atom.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("a bool", true);
+    /// atom.set("a string", "test");
+    ///
+    /// assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+    /// assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_atom_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+
+    /// Get a property with the given `name` in this atom, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(atom.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_atom_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                let property = Property::from_raw(raw);
+                Some(property)
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this atom
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    /// atom.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in atom.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_atom_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_atom_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Atom {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr() as *const _);
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+
+        let copy = atom.clone();
+        assert_eq!(copy.name(), "He");
+
+        atom.set_name("Na");
+        assert_eq!(atom.name(), "Na");
+        assert_eq!(copy.name(), "He");
+    }
+
+    #[test]
+    fn mass() {
+        let mut atom = Atom::new("He");
+        assert_ulps_eq!(atom.mass(), 4.002602);
+        atom.set_mass(15.0);
+        assert_eq!(atom.mass(), 15.0);
+    }
+
+    #[test]
+    fn charge() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.charge(), 0.0);
+        atom.set_charge(-1.5);
+        assert_eq!(atom.charge(), -1.5);
+    }
+
+    #[test]
+    fn name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+        atom.set_name("Zn-12");
+        assert_eq!(atom.name(), "Zn-12");
+    }
+
+    #[test]
+    fn atomic_type() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.atomic_type(), "He");
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.atomic_type(), "Zn");
+    }
+
+    #[test]
+    fn full_name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.full_name(), "Helium");
+
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.full_name(), "Zinc");
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.full_name(), "");
+    }
+
+    #[test]
+    fn radii() {
+        let atom = Atom::new("He");
+        assert_ulps_eq!(atom.vdw_radius(), 1.4);
+        assert_ulps_eq!(atom.covalent_radius(), 0.32);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.vdw_radius(), 0.0);
+        assert_eq!(atom.covalent_radius(), 0.0);
+    }
+
+    #[test]
+    fn atomic_number() {
+        let atom = Atom::new("He");
+        assert_eq!(atom.atomic_number(), 2);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.atomic_number(), 0);
+    }
+
+    #[test]
+    fn property() {
+        let mut atom = Atom::new("F");
+
+        atom.set("foo", -22.0);
+        assert_eq!(atom.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(atom.get("bar"), None);
+
+        atom.set("bar", Property::String("here".into()));
+        for (name, property) in atom.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/cell.rs.html b/0.10.0/src/chemfiles/cell.rs.html new file mode 100644 index 000000000..d57a009ac --- /dev/null +++ b/0.10.0/src/chemfiles/cell.rs.html @@ -0,0 +1,1106 @@ +cell.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null, check, Error};
+
+/// Available unit cell shapes.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum CellShape {
+    /// Orthorhombic cell, with the three angles equals to 90°.
+    Orthorhombic,
+    /// Triclinic cell, with any values for the angles.
+    Triclinic,
+    /// Infinite cell, to use when there is no cell.
+    Infinite,
+}
+
+impl From<chfl_cellshape> for CellShape {
+    fn from(celltype: chfl_cellshape) -> CellShape {
+        match celltype {
+            chfl_cellshape::CHFL_CELL_ORTHORHOMBIC => CellShape::Orthorhombic,
+            chfl_cellshape::CHFL_CELL_TRICLINIC => CellShape::Triclinic,
+            chfl_cellshape::CHFL_CELL_INFINITE => CellShape::Infinite,
+        }
+    }
+}
+
+impl From<CellShape> for chfl_cellshape {
+    fn from(celltype: CellShape) -> chfl_cellshape {
+        match celltype {
+            CellShape::Orthorhombic => chfl_cellshape::CHFL_CELL_ORTHORHOMBIC,
+            CellShape::Triclinic => chfl_cellshape::CHFL_CELL_TRICLINIC,
+            CellShape::Infinite => chfl_cellshape::CHFL_CELL_INFINITE,
+        }
+    }
+}
+
+/// An `UnitCell` represent the box containing the atoms, and its periodicity.
+///
+/// An unit cell is fully represented by three lengths (a, b, c); and three
+/// angles (alpha, beta, gamma). The angles are stored in degrees, and the
+/// lengths in Angstroms.
+///
+/// A cell also has a matricial representation, by projecting the three base
+/// vector into an orthonormal base. We choose to represent such matrix as an
+/// upper triangular matrix:
+///
+/// ```text
+/// | a_x   b_x   c_x |
+/// |  0    b_y   c_y |
+/// |  0     0    c_z |
+/// ```
+pub struct UnitCell {
+    handle: *mut CHFL_CELL,
+}
+
+/// An analog to a reference to an unit cell (`&UnitCell`)
+pub struct UnitCellRef<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a UnitCell>
+}
+
+impl<'a> Deref for UnitCellRef<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an unit cell (`&mut UnitCell`)
+pub struct UnitCellMut<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a mut UnitCell>
+}
+
+impl<'a> Deref for UnitCellMut<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for UnitCellMut<'a> {
+    fn deref_mut(&mut self) -> &mut UnitCell {
+        &mut self.inner
+    }
+}
+
+impl Clone for UnitCell {
+    fn clone(&self) -> UnitCell {
+        unsafe {
+            let new_handle = chfl_cell_copy(self.as_ptr());
+            UnitCell::from_ptr(new_handle)
+        }
+    }
+}
+
+impl UnitCell {
+    /// Create an owned `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_CELL) -> UnitCell {
+        check_not_null(ptr);
+        UnitCell {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime.
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_CELL) -> UnitCellRef<'a> {
+        UnitCellRef {
+            inner: UnitCell::from_ptr(ptr as *mut CHFL_CELL),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible for
+    /// setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_CELL) -> UnitCellMut<'a> {
+        UnitCellMut {
+            inner: UnitCell::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_CELL {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_CELL {
+        self.handle
+    }
+
+    /// Create an `Orthorhombic` `UnitCell` from the three lengths, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn new(lengths: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), ptr::null());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `Infinite` `UnitCell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::infinite();
+    ///
+    /// assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn infinite() -> UnitCell {
+        let mut cell = UnitCell::new([0.0, 0.0, 0.0]);
+        cell.set_shape(CellShape::Infinite).expect("could not set cell shape");
+        return cell;
+    }
+
+    /// Create an `Triclinic` `UnitCell` from the three lengths (in Angstroms)
+    /// and three angles (in degree). `alpha` is the angle between the vectors
+    /// `b` and `c`; `beta` is the between the vectors `a` and `c` and `gamma`
+    /// is the angle between the vectors `a` and `b`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// assert_eq!(cell.angles()[0], 98.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), angles.as_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `UnitCell` from a cell matrix. If `matrix` contains only
+    /// zeros, then an `Infinite` cell is created. If only the diagonal of the
+    /// matrix is non-zero, then the cell is `Orthorhombic`. Else a
+    /// `Triclinic` cell is created. The matrix entries should be in Angstroms.
+    ///
+    /// # Panics
+    ///
+    /// If the matrix has a negative determinant, or more generally is not
+    /// representing a unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::from_matrix([
+    ///     [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+    /// ]);
+    ///
+    /// assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn from_matrix(mut matrix: [[f64; 3]; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell_from_matrix(matrix.as_mut_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Get the three lengths of the cell, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// ```
+    pub fn lengths(&self) -> [f64; 3] {
+        let mut lengths = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_lengths(self.as_ptr(), lengths.as_mut_ptr()));
+        }
+        return lengths;
+    }
+
+    /// Set the three lengths of the cell, in Angstroms.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is infinite, or if one of the
+    /// lengths is negative.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+    /// assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+    ///
+    /// assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+    /// ```
+    pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_lengths(self.as_mut_ptr(), lengths.as_ptr()))
+        }
+    }
+
+    /// Get the three angles of the cell, in degrees.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([20.0, 20.0, 20.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    ///
+    /// let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// ```
+    pub fn angles(&self) -> [f64; 3] {
+        let mut angles = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_angles(self.as_ptr(), angles.as_mut_ptr()));
+        }
+        return angles;
+    }
+
+    /// Set the three angles of the cell, in degrees.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is not `Triclinic`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    ///
+    /// cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// ```
+    pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_angles(self.as_mut_ptr(), angles.as_ptr()))
+        }
+    }
+
+    /// Get the unit cell matricial representation.
+    ///
+    /// The unit cell representation is obtained by aligning the a vector along
+    /// the *x* axis and putting the b vector in the *xy* plane. This make the
+    /// matrix an upper triangular matrix:
+    ///
+    /// ```text
+    /// | a_x   b_x   c_x |
+    /// |  0    b_y   c_y |
+    /// |  0     0    c_z |
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let matrix = cell.matrix();
+    ///
+    /// assert_eq!(matrix[0][0], 10.0);
+    /// assert_eq!(matrix[1][1], 20.0);
+    /// assert_eq!(matrix[2][2], 30.0);
+    ///
+    /// assert!(matrix[1][2].abs() < 1e-9);
+    /// ```
+    pub fn matrix(&self) -> [[f64; 3]; 3] {
+        let mut matrix = [[0.0; 3]; 3];
+        unsafe {
+            check_success(chfl_cell_matrix(self.as_ptr(), matrix.as_mut_ptr()));
+        }
+        return matrix;
+    }
+
+    /// Get the shape of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn shape(&self) -> CellShape {
+        let mut shape = chfl_cellshape::CHFL_CELL_INFINITE;
+        unsafe {
+            check_success(chfl_cell_shape(self.as_ptr(), &mut shape));
+        }
+        return CellShape::from(shape);
+    }
+
+    /// Set the shape of the unit cell to `shape`.
+    ///
+    /// # Errors
+    ///
+    /// This can fail if the cell length or angles are incompatible with the
+    /// new shape.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    ///
+    /// cell.set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_shape(self.as_mut_ptr(), shape.into()))
+        }
+    }
+
+    /// Get the volume of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+    /// ```
+    pub fn volume(&self) -> f64 {
+        let mut volume = 0.0;
+        unsafe {
+            check_success(chfl_cell_volume(self.as_ptr(), &mut volume));
+        }
+        return volume;
+    }
+
+    /// Wrap a `vector` in this unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let mut vector = [12.0, 5.2, -45.3];
+    /// cell.wrap(&mut vector);
+    /// assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+    /// ```
+    pub fn wrap(&self, vector: &mut [f64; 3]) {
+        unsafe {
+            check_success(chfl_cell_wrap(self.as_ptr(), vector.as_mut_ptr()))
+        }
+    }
+}
+
+impl Drop for UnitCell {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr() as *const _);
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+
+        let copy = cell.clone();
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+    }
+
+    #[test]
+    fn lengths() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+    }
+
+    #[test]
+    fn angles() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        crate::assert_vector3d_eq(&cell.angles(), &[90.0, 90.0, 90.0], 1e-6);
+
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        cell.set_angles([80.0, 89.0, 100.0]).unwrap();
+
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 89.0, 100.0], 1e-6);
+
+        let cell = UnitCell::triclinic([1., 2., 3.], [80., 90., 100.]);
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 90.0, 100.0], 1e-6);
+    }
+
+    #[test]
+    fn volume() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.volume(), 2.0 * 3.0 * 4.0);
+    }
+
+    #[test]
+    fn wrap() {
+        let cell = UnitCell::new([10.0, 20.0, 30.0]);
+        let mut vector = [12.0, 5.2, -45.3];
+        cell.wrap(&mut vector);
+        crate::assert_vector3d_eq(&vector, &[2.0, 5.2, 14.7], 1e-6);
+    }
+
+    #[test]
+    fn matrix() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+
+        let matrix = cell.matrix();
+        let result = [[2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 4.0]];
+
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn from_matrix() {
+        let cell = UnitCell::from_matrix([[10.0, 0.0, 0.0], [0.0, 21.0, 0.0], [0.0, 0.0, 32.0]]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        assert_eq!(cell.lengths(), [10.0, 21.0, 32.0]);
+
+        let result_matrix = [
+            [123.0, 4.08386, 71.7295],
+            [0.0, 233.964, 133.571],
+            [0.0, 0.0, 309.901],
+        ];
+        let cell = UnitCell::from_matrix(result_matrix);
+
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+        for i in 0..3 {
+            assert_ulps_eq!(
+                cell.lengths()[i],
+                [123.0, 234.0, 345.0][i],
+                epsilon = 1e-3
+            );
+            assert_ulps_eq!(cell.angles()[i], [67.0, 78.0, 89.0][i], epsilon = 1e-3);
+        }
+
+        let matrix = cell.matrix();
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result_matrix[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn shape() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+        let cell = UnitCell::infinite();
+        assert_eq!(cell.shape(), CellShape::Infinite);
+
+        let cell = UnitCell::triclinic([1.0, 2.0, 3.0], [80.0, 90.0, 100.0]);
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+
+        let mut cell = UnitCell::new([10.0, 10.0, 10.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/errors.rs.html b/0.10.0/src/chemfiles/errors.rs.html new file mode 100644 index 000000000..13c474aec --- /dev/null +++ b/0.10.0/src/chemfiles/errors.rs.html @@ -0,0 +1,438 @@ +errors.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+extern crate libc;
+
+use std::error;
+use std::fmt;
+use std::panic::{self, RefUnwindSafe};
+use std::path::Path;
+
+use self::libc::c_char;
+
+use chemfiles_sys::*;
+use strings;
+
+#[derive(Clone, Debug, PartialEq)]
+/// Error type for Chemfiles.
+pub struct Error {
+    /// The error status code
+    pub status: Status,
+    /// A message describing the error cause
+    pub message: String,
+}
+
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Clone, Debug, PartialEq)]
+/// Possible causes of error in chemfiles
+pub enum Status {
+    /// No error
+    Success = chfl_status::CHFL_SUCCESS as isize,
+    /// Error in memory allocations
+    MemoryError = chfl_status::CHFL_MEMORY_ERROR as isize,
+    /// Error while reading or writing a file
+    FileError = chfl_status::CHFL_FILE_ERROR as isize,
+    /// Error in file formatting, *i.e.* the file is invalid
+    FormatError = chfl_status::CHFL_FORMAT_ERROR as isize,
+    /// Error in selection string syntax
+    SelectionError = chfl_status::CHFL_SELECTION_ERROR as isize,
+    /// Error in configuration files syntax
+    ConfigurationError = chfl_status::CHFL_CONFIGURATION_ERROR as isize,
+    /// Error for out of bounds indexing
+    OutOfBounds = chfl_status::CHFL_OUT_OF_BOUNDS as isize,
+    /// Error related to properties
+    PropertyError = chfl_status::CHFL_PROPERTY_ERROR as isize,
+    /// Exception in the C++ chemfiles library
+    ChemfilesError = chfl_status::CHFL_GENERIC_ERROR as isize,
+    /// Exception in the C++ standard library
+    StdCppError = chfl_status::CHFL_CXX_ERROR as isize,
+    /// The given path is not valid UTF8
+    UTF8PathError,
+}
+
+impl From<chfl_status> for Error {
+    fn from(status: chfl_status) -> Error {
+        let status = match status {
+            chfl_status::CHFL_SUCCESS => Status::Success,
+            chfl_status::CHFL_CXX_ERROR => Status::StdCppError,
+            chfl_status::CHFL_GENERIC_ERROR => Status::ChemfilesError,
+            chfl_status::CHFL_MEMORY_ERROR => Status::MemoryError,
+            chfl_status::CHFL_FILE_ERROR => Status::FileError,
+            chfl_status::CHFL_FORMAT_ERROR => Status::FormatError,
+            chfl_status::CHFL_SELECTION_ERROR => Status::SelectionError,
+            chfl_status::CHFL_CONFIGURATION_ERROR => Status::ConfigurationError,
+            chfl_status::CHFL_OUT_OF_BOUNDS => Status::OutOfBounds,
+            chfl_status::CHFL_PROPERTY_ERROR => Status::PropertyError,
+        };
+
+        let message = Error::last_error();
+        Error {
+            status,
+            message,
+        }
+    }
+}
+
+impl Error {
+    /// Create a new error because the given `path` is invalid UTF-8 data
+    pub(crate) fn utf8_path_error(path: &Path) -> Error {
+        Error {
+            status: Status::UTF8PathError,
+            message: format!("Could not convert '{}' to UTF8", path.display()),
+        }
+    }
+
+    /// Get the last error message from the C++ library.
+    pub fn last_error() -> String {
+        unsafe { strings::from_c(chfl_last_error()) }
+    }
+
+    /// Clear any error from the C++ library
+    pub fn cleanup() {
+        unsafe {
+            check(chfl_clear_errors()).expect("error in chfl_clear_errors. Things went very bad");
+        }
+    }
+}
+
+/// Check return value of a C function, and get the error if needed.
+pub(crate) fn check(status: chfl_status) -> Result<(), Error> {
+    if status == chfl_status::CHFL_SUCCESS {
+        Ok(())
+    } else {
+        Err(Error::from(status))
+    }
+}
+
+/// Check return value of a C function, panic if it failed.
+pub(crate) fn check_success(status: chfl_status) {
+    if status != chfl_status::CHFL_SUCCESS {
+        panic!("unexpected failure: {}", Error::last_error());
+    }
+}
+
+/// Check a pointer for null.
+pub(crate) fn check_not_null<T>(ptr: *const T) {
+    if ptr.is_null() {
+        panic!("unexpected null pointer: {}", Error::last_error());
+    }
+}
+
+pub trait WarningCallback: RefUnwindSafe + Fn(&str) {}
+impl<T> WarningCallback for T
+where
+    T: RefUnwindSafe + Fn(&str),
+{
+}
+
+static mut LOGGING_CALLBACK: Option<*mut dyn WarningCallback<Output = ()>> = None;
+
+extern "C" fn warning_callback(message: *const c_char) {
+    unsafe {
+        let callback = &*LOGGING_CALLBACK.expect("No callback provided, this is an internal bug");
+        // ignore result. If a panic happened, everything is going badly anyway
+        let _ = panic::catch_unwind(|| {
+            callback(&strings::from_c(message));
+        });
+    }
+}
+
+/// Use `callback` for every chemfiles warning. The callback will be passed
+/// the warning message. This will drop any previous warning callback.
+pub fn set_warning_callback<F>(callback: F) where F: WarningCallback + 'static {
+    // box callback to ensure it stays accessible
+    let callback = Box::into_raw(Box::new(callback));
+    unsafe {
+        if let Some(previous) = LOGGING_CALLBACK {
+            // set the LOGGING_CALLBACK to the new one
+            LOGGING_CALLBACK = Some(callback);
+            // drop the previous callback
+            let _ = Box::from_raw(previous);
+        } else {
+            // set the LOGGING_CALLBACK
+            LOGGING_CALLBACK = Some(callback);
+            // Tell C code to use Rust-provided callback
+            check_success(chfl_set_warning_callback(warning_callback));
+        }
+    }
+}
+
+
+impl fmt::Display for Error {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        write!(fmt, "{}", self.message)
+    }
+}
+
+impl error::Error for Error {
+    fn description(&self) -> &str {
+        match self.status {
+            Status::Success => "Success",
+            Status::StdCppError => "Exception from the C++ standard library",
+            Status::ChemfilesError => "Exception from the chemfiles library",
+            Status::MemoryError => "Error in memory allocations",
+            Status::FileError => "Error while reading or writing a file",
+            Status::FormatError => "Error in file formatting, i.e. the file is invalid",
+            Status::SelectionError => "Error in selection string syntax",
+            Status::UTF8PathError => "The given path is not valid UTF8",
+            Status::ConfigurationError => "Error in configuration files",
+            Status::OutOfBounds => "Out of bounds indexing",
+            Status::PropertyError => "Error in property",
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use Trajectory;
+
+    #[test]
+    fn errors() {
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+        assert!(Trajectory::open("nope", 'r').is_err());
+        assert_eq!(
+            Error::last_error(),
+            "file at \'nope\' does not have an extension, provide a format name to read it"
+        );
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+    }
+
+    #[test]
+    fn codes() {
+        assert_eq!(Error::from(chfl_status::CHFL_SUCCESS).status, Status::Success);
+        assert_eq!(Error::from(chfl_status::CHFL_CXX_ERROR).status, Status::StdCppError);
+        assert_eq!(Error::from(chfl_status::CHFL_GENERIC_ERROR).status, Status::ChemfilesError);
+        assert_eq!(Error::from(chfl_status::CHFL_MEMORY_ERROR).status, Status::MemoryError);
+        assert_eq!(Error::from(chfl_status::CHFL_FILE_ERROR).status, Status::FileError);
+        assert_eq!(Error::from(chfl_status::CHFL_FORMAT_ERROR).status, Status::FormatError);
+        assert_eq!(Error::from(chfl_status::CHFL_SELECTION_ERROR).status, Status::SelectionError);
+        assert_eq!(Error::from(chfl_status::CHFL_OUT_OF_BOUNDS).status, Status::OutOfBounds);
+        assert_eq!(Error::from(chfl_status::CHFL_PROPERTY_ERROR).status, Status::PropertyError);
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/frame.rs.html b/0.10.0/src/chemfiles/frame.rs.html new file mode 100644 index 000000000..59f4c76ca --- /dev/null +++ b/0.10.0/src/chemfiles/frame.rs.html @@ -0,0 +1,2300 @@ +frame.rs - source + +
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::ptr;
+use std::slice;
+
+use chemfiles_sys::*;
+use strings;
+use errors::{check_not_null, check_success, check, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Topology, TopologyRef, Residue, BondOrder};
+use super::{UnitCell, UnitCellRef, UnitCellMut};
+use property::{Property, RawProperty, PropertiesIter};
+
+/// A `Frame` contains data from one simulation step: the current unit
+/// cell, the topology, the positions, and the velocities of the particles in
+/// the system. If some information is missing (topology or velocity or unit
+/// cell), the corresponding data is filled with a default value.
+pub struct Frame {
+    handle: *mut CHFL_FRAME,
+}
+
+impl Clone for Frame {
+    fn clone(&self) -> Frame {
+        unsafe {
+            let new_handle = chfl_frame_copy(self.as_ptr());
+            Frame::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Frame {
+    /// Create a `Frame` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_FRAME) -> Frame {
+        check_not_null(ptr);
+        Frame {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Create an empty frame. It will be resized by the library as needed.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    ///
+    /// assert_eq!(frame.size(), 0);
+    /// ```
+    pub fn new() -> Frame {
+        unsafe {
+            Frame::from_ptr(chfl_frame())
+        }
+    }
+
+    /// Get a reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// let atom = frame.atom(0);
+    /// assert_eq!(atom.name(), "Zn");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_frame(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// assert_eq!(frame.atom(0).name(), "Zn");
+    ///
+    /// frame.atom_mut(0).set_name("Fe");
+    /// assert_eq!(frame.atom(0).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_frame(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.size(), 0);
+    ///
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_frame_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize the positions and the velocities in this frame, to make space for
+    /// `natoms` atoms. Previous data is conserved, as well as the presence of
+    /// absence of velocities.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_frame_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` and the corresponding position and optionally velocity
+    /// data to this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+    ///
+    /// frame.add_velocities();
+    /// frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+    /// ```
+    pub fn add_atom(
+        &mut self,
+        atom: &Atom,
+        position: [f64; 3],
+        velocity: impl Into<Option<[f64; 3]>>,
+    )
+    {
+        let velocity = velocity.into();
+        let velocity_ptr = match velocity {
+            Some(ref data) => data.as_ptr(),
+            None => ptr::null(),
+        };
+
+        unsafe {
+            check_success(chfl_frame_add_atom(
+                self.as_mut_ptr(),
+                atom.as_ptr(),
+                position.as_ptr(),
+                velocity_ptr
+            ));
+        }
+
+    }
+
+    /// Remove the atom at index `i` in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+    /// assert_eq!(frame.size(), 3);
+    ///
+    /// frame.remove(1);
+    /// assert_eq!(frame.size(), 2);
+    /// assert_eq!(frame.atom(1).name(), "Sn");
+    /// ```
+    pub fn remove(&mut self, i: usize) {
+        unsafe {
+            check_success(chfl_frame_remove(self.as_mut_ptr(), i as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    /// assert_eq!(frame.topology().bonds_count(), 3);
+    ///
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+    /// assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(2);
+    ///
+    /// frame.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_frame_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// the frame.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    ///
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+    ///
+    /// frame.remove_bond(2, 4);
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_remove_bond(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+            ));
+        }
+    }
+
+    /// Add a copy of `residue` to this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue id is already in this frame's
+    /// topology, or if the residue contain atoms that are already in another
+    /// residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Residue};
+    /// let mut frame = Frame::new();
+    ///
+    /// let residue = Residue::new("foo");
+    /// frame.add_residue(&residue).unwrap();
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.residues_count(), 1);
+    /// assert_eq!(topology.residue(0).unwrap().name(), "foo");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Get the distance between the atoms at indexes `i` and `j` in this frame,
+    /// accounting for periodic boundary conditions. The result is expressed in
+    /// Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+    ///
+    /// assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+    /// ```
+    pub fn distance(&self, i: usize, j: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_distance(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get the angle formed by the atoms at indexes `i`, `j` and `k` in this
+    /// frame, accounting for periodic boundary conditions. The result is
+    /// expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+    /// ```
+    pub fn angle(&self, i: usize, j: usize, k: usize) -> f64 {
+        let mut angle = 0.0;
+        unsafe {
+            check_success(chfl_frame_angle(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                &mut angle,
+            ));
+        }
+        return angle;
+    }
+
+    /// Get the dihedral angle formed by the atoms at indexes `i`, `j`, `k` and
+    /// `m` in this frame, accounting for periodic boundary conditions. The
+    /// result is expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+    ///
+    /// assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+    /// ```
+    pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut dihedral = 0.0;
+        unsafe {
+            check_success(chfl_frame_dihedral(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut dihedral,
+            ));
+        }
+        return dihedral;
+    }
+
+    /// Get the out of plane distance formed by the atoms at indexes `i`, `j`,
+    /// `k` and `m` in this frame, accounting for periodic boundary conditions.
+    /// The result is expressed in angstroms.
+    ///
+    /// This is the distance between the atom j and the ikm plane. The j atom
+    /// is the center of the improper dihedral angle formed by i, j, k and m.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+    /// frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+    /// ```
+    pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_out_of_plane(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get a view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions.len(), 67);
+    /// assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn positions(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms
+            ));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// {
+    ///     let positions = frame.positions_mut();
+    ///     assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    ///     positions[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn positions_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Get a view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    ///
+    /// let velocities = frame.velocities();
+    /// assert_eq!(velocities.len(), 67);
+    /// assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn velocities(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    /// {
+    ///     let velocities = frame.velocities_mut();
+    ///     assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    ///     velocities[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let velocities = frame.velocities();
+    /// assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn velocities_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Check if this frame contains velocity data.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn has_velocities(&self) -> bool {
+        let mut res = 0;
+        unsafe {
+            check_success(chfl_frame_has_velocities(self.as_ptr(), &mut res));
+        }
+        return res != 0;
+    }
+
+    /// Add velocity data to this frame. If the frame already have velocities,
+    /// this does nothing.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn add_velocities(&mut self) {
+        unsafe {
+            check_success(chfl_frame_add_velocities(self.as_mut_ptr()));
+        }
+    }
+
+    /// Get a reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let frame = Frame::new();
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn cell(&self) -> UnitCellRef {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW());
+            UnitCell::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// assert_eq!(frame.cell().shape(), CellShape::Infinite);
+    ///
+    /// frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+    /// ```
+    pub fn cell_mut(&mut self) -> UnitCellMut {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr());
+            UnitCell::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Set the `UnitCell` of this frame to `cell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, UnitCell, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_frame_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get a reference to the `Topology` of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(42);
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.size(), 42);
+    /// ```
+    pub fn topology(&self) -> TopologyRef {
+        unsafe {
+            let handle = chfl_topology_from_frame(self.as_ptr());
+            Topology::ref_from_ptr(handle)
+        }
+    }
+
+    /// Set the `Topology` of this frame to `topology`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology contains a different number of atoms
+    /// than this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Topology, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.resize(2);
+    ///
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_bond(0, 1);
+    ///
+    /// frame.set_topology(&topology).unwrap();
+    /// assert_eq!(frame.atom(0).name(), "Cl");
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_set_topology(self.as_mut_ptr(), topology.as_ptr()))
+        }
+    }
+
+    /// Get this frame step, i.e. the frame number in the trajectory
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    /// ```
+    pub fn step(&self) -> usize {
+        let mut step = 0;
+        unsafe {
+            check_success(chfl_frame_step(self.as_ptr(), &mut step));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return step as usize;
+    }
+
+    /// Set this frame step to `step`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    ///
+    /// frame.set_step(10);
+    /// assert_eq!(frame.step(), 10);
+    /// ```
+    pub fn set_step(&mut self, step: usize) {
+        unsafe {
+            check_success(chfl_frame_set_step(self.as_mut_ptr(), step as u64));
+        }
+    }
+
+    /// Guess the bonds, angles and dihedrals in this `frame`.
+    ///
+    /// The bonds are guessed using a distance-based algorithm, and then angles
+    /// and dihedrals are guessed from the bonds.
+    ///
+    /// # Errors
+    ////
+    /// This function can fail if the covalent radius is unknown for some atoms
+    /// in the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    ///
+    /// frame.guess_bonds().unwrap();
+    /// assert_eq!(frame.topology().bonds_count(), 1);
+    /// ```
+    pub fn guess_bonds(&mut self) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_guess_bonds(self.as_mut_ptr()))
+        }
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology of the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, Frame};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(1, 2);
+    ///
+    /// assert_eq!(frame.topology().bonds().len(), 2);
+    /// assert_eq!(frame.topology().angles().len(), 1);
+    ///
+    /// frame.clear_bonds();
+    /// assert!(frame.topology().bonds().is_empty());
+    /// assert!(frame.topology().angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_frame_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a new `property` with the given `name` to this frame.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("a string", "hello");
+    /// frame.set("a double", 4.3);
+    ///
+    /// assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_frame_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(frame.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_frame_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    /// frame.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in frame.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_frame_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_frame_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Frame {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr() as *const _);
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Topology, UnitCell};
+
+    #[test]
+    fn clone() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+        let copy = frame.clone();
+        assert_eq!(copy.size(), 0);
+
+        frame.resize(42);
+        assert_eq!(frame.size(), 42);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+
+        frame.resize(12);
+        assert_eq!(frame.size(), 12);
+    }
+
+    #[test]
+    fn add_atom() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        let positions = &[[1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        frame.add_velocities();
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], [4.0, 3.0, 2.0]);
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+        assert_eq!(frame.atom(1).name(), "F");
+
+        let positions = &[[1.0, 1.0, 2.0], [1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        let velocities = &[[0.0, 0.0, 0.0], [4.0, 3.0, 2.0]];
+        assert_eq!(frame.velocities(), velocities);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_atom() {
+        let mut frame = Frame::new();
+        frame.resize(22);
+        let _ = frame.atom(23);
+    }
+
+    #[test]
+    fn remove_atom() {
+        let mut frame = Frame::new();
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], None);
+
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        frame.remove(0);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "F");
+    }
+
+    #[test]
+    #[should_panic]
+    fn remove_out_of_bounds() {
+        let mut frame = Frame::new();
+        frame.resize(32);
+
+        frame.remove(100);
+    }
+
+    #[test]
+    fn positions() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.positions_mut().clone_from_slice(expected);
+        assert_eq!(frame.positions(), expected);
+    }
+
+    #[test]
+    fn velocities() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        assert_eq!(frame.has_velocities(), false);
+        frame.add_velocities();
+        assert_eq!(frame.has_velocities(), true);
+
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.velocities_mut().clone_from_slice(expected);
+        assert_eq!(frame.velocities(), expected);
+    }
+
+    #[test]
+    fn cell() {
+        let mut frame = Frame::new();
+        frame.set_cell(&UnitCell::new([3.0, 4.0, 5.0]));
+        let cell = frame.cell();
+        assert_eq!(cell.lengths(), [3.0, 4.0, 5.0]);
+    }
+
+    #[test]
+    fn topology() {
+        let mut frame = Frame::new();
+        frame.resize(2);
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Zn"));
+        topology.add_atom(&Atom::new("Ar"));
+
+        assert!(frame.set_topology(&topology).is_ok());
+
+        let topology = frame.topology();
+
+        assert_eq!(topology.atom(0).name(), "Zn");
+        assert_eq!(topology.atom(1).name(), "Ar");
+
+        assert_eq!(frame.atom(0).name(), "Zn");
+        assert_eq!(frame.atom(1).name(), "Ar");
+    }
+
+    #[test]
+    fn bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        assert_eq!(frame.topology().bonds_count(), 0);
+
+        frame.add_bond(0, 1);
+        frame.add_bond(9, 2);
+        frame.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(frame.topology().bonds_count(), 3);
+
+        assert_eq!(frame.topology().bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(frame.topology().bond_orders(), expected);
+
+        assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(frame.topology().bond_order(3, 7), BondOrder::Aromatic);
+
+        frame.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        frame.remove_bond(8, 7);
+        assert_eq!(frame.topology().bonds_count(), 2);
+
+        frame.clear_bonds();
+        assert_eq!(frame.topology().bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn residues() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.topology().residues_count(), 0);
+
+        let residue = &Residue::new("foobar");
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+
+        assert_eq!(frame.topology().residues_count(), 3);
+        assert_eq!(frame.topology().residue(0).unwrap().name(), "foobar");
+    }
+
+    #[test]
+    fn step() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.step(), 0);
+        frame.set_step(42);
+        assert_eq!(frame.step(), 42);
+    }
+
+    #[test]
+    fn property() {
+        let mut frame = Frame::new();
+        frame.set("foo", -22.0);
+        assert_eq!(frame.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(frame.get("bar"), None);
+
+        frame.set("bar", Property::String("here".into()));
+        for (name, property) in frame.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+
+    #[test]
+    fn pbc_geometry() {
+        use std::f64::consts::PI;
+
+        let mut frame = Frame::new();
+        let atom = &Atom::new("");
+
+        frame.add_atom(atom, [1.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 1.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 2.0], None);
+
+        assert_eq!(frame.distance(0, 2), f64::sqrt(2.0));
+        assert_eq!(frame.angle(0, 1, 2), PI / 2.0);
+        assert_eq!(frame.dihedral(0, 1, 2, 3), PI / 2.0);
+        assert_eq!(frame.out_of_plane(1, 4, 0, 2), 2.0);
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/lib.rs.html b/0.10.0/src/chemfiles/lib.rs.html new file mode 100644 index 000000000..c55f4ae11 --- /dev/null +++ b/0.10.0/src/chemfiles/lib.rs.html @@ -0,0 +1,286 @@ +lib.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! Chemfiles is a multi-language library written in modern C++ for reading and
+//! writing from and to molecular trajectory files. These files are created by
+//! your favorite theoretical chemistry program, and contains information about
+//! atomic or residues names and positions. Some format also have additional
+//! information, such as velocities, forces, energy, …
+//!
+//! This crate expose the C API of chemfiles to Rust, and make all the
+//! functionalities accessible. For more information on the C++ library,
+//! please see its [documentation][cxx_doc]. Specifically, the following pages
+//! are worth reading:
+//!
+//! - The [overview][overview] of the classes organization;
+//! - The list of [supported formats][formats];
+//! - The documentation for the [selection language][selections];
+//!
+//! [cxx_doc]: https://chemfiles.org/chemfiles
+//! [overview]: https://chemfiles.org/chemfiles/latest/overview.html
+//! [formats]: https://chemfiles.org/chemfiles/latest/formats.html
+//! [selections]: https://chemfiles.org/chemfiles/latest/selections.html
+
+#![deny(missing_docs)]
+#![warn(trivial_casts, unused_import_braces, variant_size_differences)]
+#![warn(unused_qualifications, unused_results)]
+// Configuration for clippy lints
+#![warn(clippy::all, clippy::pedantic)]
+#![allow(clippy::needless_return, clippy::module_name_repetitions)]
+#![allow(clippy::must_use_candidate, clippy::wildcard_imports)]
+
+// Allow a few more clippy lints in test mode
+#![cfg_attr(test, allow(clippy::float_cmp, clippy::unreadable_literal, clippy::shadow_unrelated))]
+
+// deny(warnings) in doc tests
+#![doc(test(attr(deny(warnings))))]
+#![doc(test(attr(allow(unused_variables))))]
+
+#[cfg(test)]
+#[macro_use]
+extern crate approx;
+
+extern crate chemfiles_sys;
+use chemfiles_sys::{chfl_add_configuration, chfl_version};
+
+mod strings;
+
+mod errors;
+pub use errors::{Error, Status};
+pub use errors::set_warning_callback;
+
+mod atom;
+pub use atom::Atom;
+pub use atom::AtomRef;
+pub use atom::AtomMut;
+
+mod cell;
+pub use cell::UnitCell;
+pub use cell::UnitCellRef;
+pub use cell::UnitCellMut;
+pub use cell::CellShape;
+
+mod residue;
+pub use residue::Residue;
+pub use residue::ResidueRef;
+
+mod topology;
+pub use topology::Topology;
+pub use topology::TopologyRef;
+pub use topology::BondOrder;
+
+mod frame;
+pub use frame::Frame;
+
+mod trajectory;
+pub use trajectory::Trajectory;
+
+mod selection;
+pub use selection::{Match, Selection};
+
+mod property;
+pub use property::Property;
+pub use property::PropertiesIter;
+
+mod metadata;
+pub use metadata::{FormatMetadata, formats_list};
+
+/// Get the version of the chemfiles library.
+///
+/// # Example
+/// ```
+/// let version = chemfiles::version();
+/// assert!(version.starts_with("0.10"));
+/// ```
+pub fn version() -> String {
+    unsafe { strings::from_c(chfl_version()) }
+}
+
+/// Read configuration data from the file at `path`.
+///
+/// By default, chemfiles reads configuration from any file named
+/// `.chemfiles.toml` in the current directory or any parent directory. This
+/// function can be used to add data from another configuration file. Data from
+/// the new configuration file will overwrite any existing data.
+///
+/// # Errors
+///
+/// This function will fail if there is no file at `path`, or if the file is
+/// incorrectly formatted.
+///
+/// # Example
+/// ```no_run
+/// chemfiles::add_configuration("local-config.toml").unwrap();
+/// // from now on, the data from "local-config.toml" will be used
+/// ```
+pub fn add_configuration<S>(path: S) -> Result<(), Error>
+where
+    S: AsRef<str>,
+{
+    let buffer = strings::to_c(path.as_ref());
+    unsafe {
+        errors::check(chfl_add_configuration(buffer.as_ptr()))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    fn version() {
+        assert!(!crate::version().is_empty());
+        assert!(crate::version().starts_with("0.10"));
+    }
+}
+
+#[cfg(test)]
+fn assert_vector3d_eq(lhs: &[f64; 3], rhs: &[f64; 3], eps: f64) {
+    lhs.iter()
+        .zip(rhs)
+        .for_each(|(l, r)| assert_ulps_eq!(l, r, epsilon = eps));
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/metadata.rs.html b/0.10.0/src/chemfiles/metadata.rs.html new file mode 100644 index 000000000..4a1c626e5 --- /dev/null +++ b/0.10.0/src/chemfiles/metadata.rs.html @@ -0,0 +1,210 @@ +metadata.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2020 Guillaume Fraux -- BSD licensed
+
+use std::convert::TryInto;
+use std::ffi::CStr;
+
+use chemfiles_sys::{chfl_format_metadata, chfl_formats_list, chfl_free};
+use errors::check_success;
+
+/// `FormatMetadata` contains metdata associated with one format.
+#[allow(clippy::struct_excessive_bools)]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct FormatMetadata {
+    /// Name of the format.
+    pub name: &'static str,
+    /// Extension associated with the format.
+    pub extension: Option<&'static str>,
+    /// Extended, user-facing description of the format.
+    pub description: &'static str,
+    /// URL pointing to the format definition/reference.
+    pub reference: &'static str,
+    /// Is reading files in this format implemented?
+    pub read: bool,
+    /// Is writing files in this format implemented?
+    pub write: bool,
+    /// Does this format support in-memory IO?
+    pub memory: bool,
+    /// Does this format support storing atomic positions?
+    pub positions: bool,
+    /// Does this format support storing atomic velocities?
+    pub velocities: bool,
+    /// Does this format support storing unit cell information?
+    pub unit_cell: bool,
+    /// Does this format support storing atom names or types?
+    pub atoms: bool,
+    /// Does this format support storing bonds between atoms?
+    pub bonds: bool,
+    /// Does this format support storing residues?
+    pub residues: bool,
+}
+
+impl FormatMetadata {
+    pub(crate) fn from_raw(raw: &chfl_format_metadata) -> Self {
+        let str_from_ptr = |ptr| unsafe {
+            CStr::from_ptr(ptr)
+                .to_str()
+                .expect("Invalid Rust str from C")
+        };
+        let extension = if raw.extension.is_null() {
+            None
+        } else {
+            Some(str_from_ptr(raw.extension))
+        };
+        Self {
+            name: str_from_ptr(raw.name),
+            extension,
+            description: str_from_ptr(raw.description),
+            reference: str_from_ptr(raw.reference),
+            read: raw.read,
+            write: raw.write,
+            memory: raw.memory,
+            positions: raw.positions,
+            velocities: raw.velocities,
+            unit_cell: raw.unit_cell,
+            atoms: raw.atoms,
+            bonds: raw.bonds,
+            residues: raw.residues,
+        }
+    }
+}
+
+/// Get the list of formats known by chemfiles, as well as all associated metadata.
+///
+/// # Example
+/// ```
+/// let formats = chemfiles::formats_list();
+/// println!("chemfiles supports {} formats:", formats.len());
+/// for format in &formats {
+///     println!(
+///         "   {:<15} {}",
+///         format.name,
+///         format.extension.as_deref().unwrap_or("")
+///     );
+/// }
+/// ```
+#[must_use]
+pub fn formats_list() -> Vec<FormatMetadata> {
+    let mut formats = std::ptr::null_mut();
+    let mut count: u64 = 0;
+    let formats_slice = unsafe {
+        check_success(chfl_formats_list(&mut formats, &mut count));
+        std::slice::from_raw_parts(formats, count.try_into().unwrap())
+    };
+    let formats_vec = formats_slice
+        .iter()
+        .map(|fm| FormatMetadata::from_raw(fm))
+        .collect();
+    unsafe {
+        let _ = chfl_free(formats as *const _);
+    }
+    return formats_vec;
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/property.rs.html b/0.10.0/src/chemfiles/property.rs.html new file mode 100644 index 000000000..b812081c7 --- /dev/null +++ b/0.10.0/src/chemfiles/property.rs.html @@ -0,0 +1,586 @@ +property.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::vec::IntoIter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use strings;
+
+/// A thin wrapper around `CHFL_PROPERTY`
+pub(crate) struct RawProperty {
+    handle: *mut CHFL_PROPERTY,
+}
+
+impl RawProperty {
+    /// Create a `RawProperty` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    pub unsafe fn from_ptr(ptr: *mut CHFL_PROPERTY) -> RawProperty {
+        check_not_null(ptr);
+        RawProperty {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    pub fn as_ptr(&self) -> *const CHFL_PROPERTY {
+        self.handle
+    }
+
+    fn double(value: f64) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_double(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn bool(value: bool) -> RawProperty {
+        let value = if value { 1 } else { 0 };
+        unsafe {
+            let handle = chfl_property_bool(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn vector3d(value: [f64; 3]) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_vector3d(value.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn string(value: &str) -> RawProperty {
+        let buffer = strings::to_c(value);
+        unsafe {
+            let handle = chfl_property_string(buffer.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn get_kind(&self) -> chfl_property_kind {
+        let mut kind = chfl_property_kind::CHFL_PROPERTY_BOOL;
+        unsafe {
+            check_success(chfl_property_get_kind(self.as_ptr(), &mut kind));
+        }
+        return kind;
+    }
+
+    fn get_bool(&self) -> Result<bool, Error> {
+        let mut value = 0;
+        unsafe {
+            check(chfl_property_get_bool(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value != 0);
+    }
+
+    fn get_double(&self) -> Result<f64, Error> {
+        let mut value = 0.0;
+        unsafe {
+            check(chfl_property_get_double(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value);
+    }
+
+    fn get_string(&self) -> Result<String, Error> {
+        let get_string = |ptr, len| unsafe { chfl_property_get_string(self.as_ptr(), ptr, len) };
+        let value = strings::call_autogrow_buffer(64, get_string)?;
+        return Ok(strings::from_c(value.as_ptr()));
+    }
+
+    fn get_vector3d(&self) -> Result<[f64; 3], Error> {
+        let mut value = [0.0; 3];
+        unsafe {
+            check(chfl_property_get_vector3d(self.as_ptr(), value.as_mut_ptr()))?;
+        }
+        return Ok(value);
+    }
+}
+
+impl Drop for RawProperty {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr() as *const _);
+        }
+    }
+}
+
+/// A `Property` is a piece of data that can be associated with an `Atom` or a
+/// `Frame`.
+#[derive(Debug, Clone, PartialEq, PartialOrd)]
+pub enum Property {
+    /// Boolean property
+    Bool(bool),
+    /// Floating point property
+    Double(f64),
+    /// String property
+    String(String),
+    /// 3-dimensional vector property
+    Vector3D([f64; 3]),
+}
+
+impl From<bool> for Property {
+    fn from(value: bool) -> Self {
+        Property::Bool(value)
+    }
+}
+
+impl From<f64> for Property {
+    fn from(value: f64) -> Self {
+        Property::Double(value)
+    }
+}
+
+impl From<String> for Property {
+    fn from(value: String) -> Self {
+        Property::String(value)
+    }
+}
+
+impl<'a> From<&'a str> for Property {
+    fn from(value: &'a str) -> Self {
+        Property::String(value.into())
+    }
+}
+
+impl From<[f64; 3]> for Property {
+    fn from(value: [f64; 3]) -> Self {
+        Property::Vector3D(value)
+    }
+}
+
+impl Property {
+    pub(crate) fn as_raw(&self) -> RawProperty {
+        match *self {
+            Property::Bool(value) => RawProperty::bool(value),
+            Property::Double(value) => RawProperty::double(value),
+            Property::String(ref value) => RawProperty::string(value),
+            Property::Vector3D(value) => RawProperty::vector3d(value),
+        }
+    }
+
+    #[allow(clippy::needless_pass_by_value)]  // raw property
+    pub(crate) fn from_raw(raw: RawProperty) -> Property {
+        match raw.get_kind() {
+            chfl_property_kind::CHFL_PROPERTY_BOOL => {
+                Property::Bool(raw.get_bool().expect("shoudl be a bool"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_DOUBLE => {
+                Property::Double(raw.get_double().expect("should be a double"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_STRING => {
+                Property::String(raw.get_string().expect("should be a string"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_VECTOR3D => {
+                Property::Vector3D(raw.get_vector3d().expect("should be a vector3d"))
+            }
+        }
+    }
+}
+
+/// An iterator over the properties in an atom/frame/residue
+pub struct PropertiesIter<'a> where  {
+    pub(crate) names: IntoIter<String>,
+    pub(crate) getter: Box<dyn Fn(&str) -> Property + 'a>,
+}
+
+impl<'a> Iterator for PropertiesIter<'a> {
+    type Item = (String, Property);
+    fn next(&mut self) -> Option<Self::Item> {
+        self.names.next().map(|name| {
+            let property = (self.getter)(&*name);
+            (name, property)
+        })
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.names.size_hint()
+    }
+
+    fn count(self) -> usize {
+        self.names.count()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    mod raw {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = RawProperty::bool(false);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(property.get_bool(), Ok(false));
+        }
+
+        #[test]
+        fn double() {
+            let property = RawProperty::double(45.0);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(property.get_double(), Ok(45.0));
+        }
+
+        #[test]
+        fn string() {
+            let property = RawProperty::string("test");
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(property.get_string(), Ok("test".into()));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = RawProperty::vector3d([1.2, 3.4, 5.6]);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(property.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+        }
+    }
+
+    mod rust {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = Property::Bool(false);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(raw.get_bool(), Ok(false));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn double() {
+            let property = Property::Double(45.0);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(raw.get_double(), Ok(45.0));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn string() {
+            let property = Property::String("test".into());
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(raw.get_string(), Ok("test".into()));
+
+            assert_eq!(Property::from_raw(raw), property);
+
+            let property = Property::String("long string ".repeat(128));
+            let raw = property.as_raw();
+            assert_eq!(raw.get_string(), Ok("long string ".repeat(128)));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = Property::Vector3D([1.2, 3.4, 5.6]);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(raw.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/residue.rs.html b/0.10.0/src/chemfiles/residue.rs.html new file mode 100644 index 000000000..b58de7dd6 --- /dev/null +++ b/0.10.0/src/chemfiles/residue.rs.html @@ -0,0 +1,824 @@ +residue.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_not_null, check_success, Error};
+use property::{Property, RawProperty, PropertiesIter};
+use strings;
+
+/// A `Residue` is a group of atoms belonging to the same logical unit. They
+/// can be small molecules, amino-acids in a protein, monomers in polymers,
+/// *etc.*
+pub struct Residue {
+    handle: *mut CHFL_RESIDUE,
+}
+
+/// An analog to a reference to a residue (`&Residue`)
+pub struct ResidueRef<'a> {
+    inner: Residue,
+    marker: PhantomData<&'a Residue>
+}
+
+impl<'a> Deref for ResidueRef<'a> {
+    type Target = Residue;
+    fn deref(&self) -> &Residue {
+        &self.inner
+    }
+}
+
+impl Clone for Residue {
+    fn clone(&self) -> Residue {
+        unsafe {
+            let new_handle = chfl_residue_copy(self.as_ptr());
+            Residue::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Residue {
+    /// Create a `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_RESIDUE) -> Residue {
+        check_not_null(ptr);
+        Residue {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_RESIDUE) -> ResidueRef<'a> {
+        ResidueRef {
+            inner: Residue::from_ptr(ptr as *mut CHFL_RESIDUE),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Create a new residue with the given `name`
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("ALA");
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), None);
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue(buffer.as_ptr());
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Create a new residue with the given `name` and `id` as identifier.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("ALA", 67);
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), Some(67));
+    /// ```
+    pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue_with_id(buffer.as_ptr(), id);
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Get the number of atoms in this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    ///
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// assert_eq!(residue.size(), 3);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_residue_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the identifier of this residue in the initial topology file.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("", 42);
+    /// assert_eq!(residue.id(), Some(42));
+    /// ```
+    pub fn id(&self) -> Option<i64> {
+        let mut resid = 0;
+        let status = unsafe {
+            chfl_residue_id(self.as_ptr(), &mut resid)
+        };
+
+        if status == chfl_status::CHFL_SUCCESS {
+            return Some(resid);
+        } else if status == chfl_status::CHFL_GENERIC_ERROR {
+            return None;
+        } else {
+            panic!("unexpected failure: {}", Error::last_error());
+        }
+    }
+
+    /// Get the name of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("water");
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_residue_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(64, get_name).expect("getting residue name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Add the atom at index `atom` in this residue.
+    ///
+    /// This will fail if the atom is already in the residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// assert_eq!(residue.contains(56), true);
+    ///
+    /// // Adding the same atom twice is fine
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// ```
+    pub fn add_atom(&mut self, atom: usize) {
+        unsafe {
+            check_success(chfl_residue_add_atom(self.as_mut_ptr(), atom as u64));
+        }
+    }
+
+    /// Check if the atom at index `i` is in this residue
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.contains(56), true);
+    /// ```
+    pub fn contains(&self, atom: usize) -> bool {
+        let mut inside = 0;
+        unsafe {
+            check_success(chfl_residue_contains(self.as_ptr(), atom as u64, &mut inside));
+        }
+        return inside != 0;
+    }
+
+    /// Get the list of atoms of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.atoms(), vec![]);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.atoms(), vec![56]);
+    /// ```
+    pub fn atoms(&self) -> Vec<usize> {
+        let size = self.size();
+        let count = size as u64;
+        let mut indices = vec![u64::max_value(); size];
+        unsafe {
+            check_success(chfl_residue_atoms(
+                self.as_ptr(),
+                indices.as_mut_ptr(),
+                count,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return indices.into_iter().map(|idx| idx as usize).collect();
+    }
+
+    /// Add a new `property` with the given `name` to this residue.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("a string", "hello");
+    /// residue.set("a double", 3.2);
+    ///
+    /// assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_residue_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(residue.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_residue_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    /// residue.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in residue.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_residue_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_residue_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Residue {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr() as *const _);
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        let copy = residue.clone();
+        assert_eq!(copy.size(), 0);
+
+        residue.add_atom(3);
+        residue.add_atom(7);
+        assert_eq!(residue.size(), 2);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn name() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.name(), "A");
+    }
+
+    #[test]
+    fn id() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.id(), None);
+
+        let residue = Residue::with_id("A", 42);
+        assert_eq!(residue.id(), Some(42));
+
+        let residue = Residue::with_id("A", -3);
+        assert_eq!(residue.id(), Some(-3));
+    }
+
+    #[test]
+    fn atoms() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        residue.add_atom(0);
+        residue.add_atom(3);
+        residue.add_atom(45);
+        assert_eq!(residue.size(), 3);
+
+        assert_eq!(residue.contains(3), true);
+        assert_eq!(residue.contains(5), false);
+
+        assert_eq!(residue.atoms(), vec![0, 3, 45]);
+    }
+
+    #[test]
+    fn property() {
+        let mut residue = Residue::new("ALA");
+
+        residue.set("foo", -22.0);
+        assert_eq!(residue.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(residue.get("bar"), None);
+
+        residue.set("bar", Property::String("here".into()));
+        for (name, property) in residue.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/selection.rs.html b/0.10.0/src/chemfiles/selection.rs.html new file mode 100644 index 000000000..a8753f2c5 --- /dev/null +++ b/0.10.0/src/chemfiles/selection.rs.html @@ -0,0 +1,862 @@ +selection.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Index};
+use std::iter::IntoIterator;
+use std::slice::Iter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error, Status};
+use strings;
+use frame::Frame;
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+/// A `Match` is a set of atomic indexes matching a given selection. It can
+/// mostly be used like a `&[usize]`.
+pub struct Match {
+    size: usize,
+    atoms: [usize; 4],
+}
+
+#[allow(clippy::len_without_is_empty)]
+impl Match {
+    /// Get the length of the Match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// ```
+    pub fn len(&self) -> usize {
+        self.size
+    }
+
+    /// Create a new match containing the atoms in the `atoms` slice.
+    ///
+    /// # Panics
+    ///
+    /// If the slice contains more than 4 elements, which is the maximal size
+    /// of a match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// assert_eq!(atomic_match[0], 3);
+    /// assert_eq!(atomic_match[1], 4);
+    /// assert_eq!(atomic_match[2], 5);
+    /// ```
+    pub fn new(atoms: &[usize]) -> Match {
+        assert!(atoms.len() <= 4);
+        let size = atoms.len();
+        let mut matches = [usize::max_value(); 4];
+        for (i, atom) in atoms.iter().enumerate() {
+            matches[i] = *atom;
+        }
+        Match {
+            size,
+            atoms: matches,
+        }
+    }
+
+    /// Iterate over the atomic indexes in the match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// let mut iter = atomic_match.iter();
+    ///
+    /// assert_eq!(iter.next(), Some(&3));
+    /// assert_eq!(iter.next(), Some(&4));
+    /// assert_eq!(iter.next(), Some(&5));
+    /// assert_eq!(iter.next(), None);
+    /// ```
+    pub fn iter(&self) -> Iter<usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+impl Index<usize> for Match {
+    type Output = usize;
+    fn index(&self, i: usize) -> &Self::Output {
+        assert!(i < self.len());
+        &self.atoms[i]
+    }
+}
+
+impl<'a> IntoIterator for &'a Match {
+    type Item = &'a usize;
+    type IntoIter = Iter<'a, usize>;
+    fn into_iter(self) -> Iter<'a, usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+/// A `Selection` allow to select atoms in a `Frame`, from a selection
+/// language. The selection language is built by combining basic operations.
+/// Each basic operation follows the `<selector>[(<variable>)] <operator>
+/// <value>` structure, where `<operator>` is a comparison operator in
+/// `== != < <= > >=`.
+pub struct Selection {
+    handle: *mut CHFL_SELECTION,
+}
+
+impl Clone for Selection {
+    fn clone(&self) -> Selection {
+        unsafe {
+            let new_handle = chfl_selection_copy(self.as_ptr());
+            Selection::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Drop for Selection {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr() as *const _);
+        }
+    }
+}
+
+impl Selection {
+    /// Create a `Selection` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_SELECTION) -> Selection {
+        check_not_null(ptr);
+        Selection {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Create a new selection from the given selection string.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the selection string is invalid.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// ```
+    pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error> {
+        let buffer = strings::to_c(selection.into());
+        unsafe {
+            let handle = chfl_selection(buffer.as_ptr());
+            if handle.is_null() {
+                Err(Error {
+                    status: Status::SelectionError,
+                    message: Error::last_error()
+                })
+            } else {
+                Ok(Selection::from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the size of the selection, i.e. the number of atoms we are selecting
+    /// together.
+    ///
+    /// This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond'
+    /// context, 3 for the 'three' and 'angles' context and 4 for the 'four'
+    /// and 'dihedral' context.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// assert_eq!(selection.size(), 2);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_selection_size(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the selection string used to create this selection.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("name H").unwrap();
+    /// assert_eq!(selection.string(), "name H");
+    /// ```
+    pub fn string(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_selection_string(self.as_ptr(), ptr, len) };
+        let selection = strings::call_autogrow_buffer(1024, get_string).expect("failed to get selection string");
+        return strings::from_c(selection.as_ptr());
+    }
+
+    /// Evaluate a selection for a given frame, and return the corresponding
+    /// matches.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// let matches = selection.evaluate(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    ///
+    /// assert_eq!(matches[0].len(), 2);
+    /// assert_eq!(matches[0][0], 0);
+    /// assert_eq!(matches[0][1], 1);
+    ///
+    /// assert_eq!(matches[1].len(), 2);
+    /// assert_eq!(matches[1][0], 2);
+    /// assert_eq!(matches[1][1], 1);
+    /// ```
+    pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match> {
+        #![allow(clippy::cast_possible_truncation)]
+        let mut count = 0;
+        unsafe {
+            check(chfl_selection_evaluate(
+                self.as_mut_ptr(), frame.as_ptr(), &mut count
+            )).expect("failed to evaluate selection");
+        }
+
+        let size = count as usize;
+        let mut chfl_matches = vec![chfl_match { size: 0, atoms: [0; 4] }; size];
+        unsafe {
+            check(chfl_selection_matches(
+                self.handle,
+                chfl_matches.as_mut_ptr(),
+                count
+            )).expect("failed to extract matches");
+        }
+
+        return chfl_matches.into_iter()
+            .map(|chfl_match| Match {
+                size: chfl_match.size as usize,
+                atoms: [
+                    chfl_match.atoms[0] as usize,
+                    chfl_match.atoms[1] as usize,
+                    chfl_match.atoms[2] as usize,
+                    chfl_match.atoms[3] as usize,
+                ],
+            })
+            .collect();
+    }
+
+    /// Evaluates a selection of size 1 on a given `frame`. This function
+    /// returns the list of atomic indexes in the frame matching this selection.
+    ///
+    /// # Panics
+    ///
+    /// If the selection size is not 1
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("name H").unwrap();
+    /// let matches = selection.list(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    /// assert_eq!(matches[0], 0);
+    /// assert_eq!(matches[1], 2);
+    /// ```
+    pub fn list(&mut self, frame: &Frame) -> Vec<usize> {
+        if self.size() != 1 {
+            panic!("can not call `Selection::list` on a multiple selection")
+        }
+        return self.evaluate(frame)
+            .into_iter()
+            .map(|m| m[0] as usize)
+            .collect();
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use Frame;
+    use Topology;
+    use Atom;
+
+    #[test]
+    fn clone() {
+        let selection = Selection::new("name H").unwrap();
+
+        let copy = selection.clone();
+        assert_eq!(selection.size(), 1);
+        assert_eq!(copy.size(), 1);
+    }
+
+    fn testing_frame() -> Frame {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("H"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("H"));
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(2, 3);
+
+        let mut frame = Frame::new();
+        frame.resize(4);
+        frame.set_topology(&topology).unwrap();
+        return frame;
+    }
+
+    mod matches {
+        use super::*;
+
+        #[test]
+        fn index() {
+            let m = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+            assert_eq!(m[2], 3);
+            assert_eq!(m[3], 4);
+
+            let m = Match::new(&[1, 2]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+        }
+
+        #[test]
+        fn iter() {
+            let match_ = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(match_.iter().cloned().collect::<Vec<usize>>(), vec![1, 2, 3, 4]);
+
+            let v = vec![1, 2, 3, 4];
+            for (i, &m) in match_.iter().enumerate() {
+                assert_eq!(v[i], m);
+            }
+        }
+
+        #[test]
+        #[should_panic]
+        fn out_of_bound() {
+            let m = Match::new(&[1, 2]);
+            let _ = m[2];
+        }
+
+        #[test]
+        #[should_panic]
+        fn too_big() {
+            let _ = Match::new(&[1, 2, 3, 5, 4]);
+        }
+    }
+
+    #[test]
+    fn size() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.size(), 1);
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 3);
+
+        let selection = Selection::new("four: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 4);
+    }
+
+    #[test]
+    fn string() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.string(), "name H");
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.string(), "angles: name(#1) H");
+    }
+
+    #[test]
+    fn evaluate() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.evaluate(&frame);
+        assert_eq!(res, &[Match::new(&[0]), Match::new(&[3])]);
+
+        let mut selection = Selection::new("angles: all").unwrap();
+        let res = selection.evaluate(&frame);
+        for m in &[Match::new(&[0, 1, 2]), Match::new(&[1, 2, 3])] {
+            assert!(res.iter().any(|r| r == m))
+        }
+    }
+
+    #[test]
+    fn list() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.list(&frame);
+        assert_eq!(res, vec![0, 3]);
+    }
+
+    #[test]
+    #[should_panic = "can not call `Selection::list` on a multiple selection"]
+    fn list_on_size_1_selection() {
+        let frame = testing_frame();
+        let mut selection = Selection::new("pairs: name(#1) H").unwrap();
+        let _ = selection.list(&frame);
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/strings.rs.html b/0.10.0/src/chemfiles/strings.rs.html new file mode 100644 index 000000000..c86c056dc --- /dev/null +++ b/0.10.0/src/chemfiles/strings.rs.html @@ -0,0 +1,120 @@ +strings.rs - source + +
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! String conversions between C and Rust
+use std::ffi::{CStr, CString};
+
+use chemfiles_sys::chfl_status;
+use errors::{check, Error};
+
+/// Create a Rust string from a C string. Clones all characters in `buffer`.
+pub fn from_c(buffer: *const i8) -> String {
+    unsafe {
+        let rust_str = CStr::from_ptr(buffer)
+            .to_str()
+            .expect("Invalid Rust string from C");
+        return String::from(rust_str);
+    }
+}
+
+/// Create a C string from a Rust string.
+pub fn to_c(string: &str) -> CString {
+    CString::new(string).expect("Invalid C string from Rust")
+}
+
+/// Check if a string buffer was big enough when passed to a C function
+fn buffer_was_big_enough(buffer: &[i8]) -> bool {
+    let len = buffer.len();
+    if len < 2 {
+        false
+    } else {
+        // The C code should always set the last element to 0
+        debug_assert_eq!(buffer[len - 1], 0);
+        buffer[len - 2] == 0
+    }
+}
+
+/// Call `callback` C function with a string buffer and it length, using
+/// `initial` as the buffer initial size. If the buffer was filled and the
+/// result truncated by the C library, grow the buffer and try again until we
+/// get all the data. Then return the filled buffer to the caller.
+pub fn call_autogrow_buffer<F>(initial: usize, callback: F) -> Result<Vec<i8>, Error>
+where
+    F: Fn(*mut i8, u64) -> chfl_status,
+{
+    let mut size = initial;
+    let mut buffer = vec![0; size];
+    check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+
+    while !buffer_was_big_enough(&buffer) {
+        // Grow the buffer and retry
+        size *= 2;
+        buffer.resize(size, 0);
+        check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+    }
+
+    Ok(buffer)
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/topology.rs.html b/0.10.0/src/chemfiles/topology.rs.html new file mode 100644 index 000000000..ba81326b5 --- /dev/null +++ b/0.10.0/src/chemfiles/topology.rs.html @@ -0,0 +1,2016 @@ +topology.rs - source + +
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Residue, ResidueRef};
+
+/// Possible bond order associated with bonds
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+pub enum BondOrder {
+    /// Unknown or unspecified bond order
+    Unknown = chfl_bond_order::CHFL_BOND_UNKNOWN as isize,
+    /// Single bond
+    Single = chfl_bond_order::CHFL_BOND_SINGLE as isize,
+    /// Double bond
+    Double = chfl_bond_order::CHFL_BOND_DOUBLE as isize,
+    /// Triple bond
+    Triple = chfl_bond_order::CHFL_BOND_TRIPLE as isize,
+    /// Quadruple bond (present in some metals)
+    Quadruple = chfl_bond_order::CHFL_BOND_QUADRUPLE as isize,
+    /// Quintuplet bond (present in some metals)
+    Quintuplet = chfl_bond_order::CHFL_BOND_QUINTUPLET as isize,
+    /// Amide bond (required by some file formats)
+    Amide = chfl_bond_order::CHFL_BOND_AMIDE as isize,
+    /// Aromatic bond (required by some file formats)
+    Aromatic = chfl_bond_order::CHFL_BOND_AROMATIC as isize,
+}
+
+impl BondOrder {
+    pub(crate) fn as_raw(self) -> chfl_bond_order {
+        match self {
+            BondOrder::Unknown => chfl_bond_order::CHFL_BOND_UNKNOWN,
+            BondOrder::Single => chfl_bond_order::CHFL_BOND_SINGLE,
+            BondOrder::Double => chfl_bond_order::CHFL_BOND_DOUBLE,
+            BondOrder::Triple => chfl_bond_order::CHFL_BOND_TRIPLE,
+            BondOrder::Quadruple => chfl_bond_order::CHFL_BOND_QUADRUPLE,
+            BondOrder::Quintuplet => chfl_bond_order::CHFL_BOND_QUINTUPLET,
+            BondOrder::Amide => chfl_bond_order::CHFL_BOND_AMIDE,
+            BondOrder::Aromatic => chfl_bond_order::CHFL_BOND_AROMATIC,
+        }
+    }
+}
+
+impl From<chfl_bond_order> for BondOrder {
+    fn from(order: chfl_bond_order) -> BondOrder {
+        match order {
+            chfl_bond_order::CHFL_BOND_UNKNOWN => BondOrder::Unknown,
+            chfl_bond_order::CHFL_BOND_SINGLE => BondOrder::Single,
+            chfl_bond_order::CHFL_BOND_DOUBLE => BondOrder::Double,
+            chfl_bond_order::CHFL_BOND_TRIPLE => BondOrder::Triple,
+            chfl_bond_order::CHFL_BOND_QUADRUPLE => BondOrder::Quadruple,
+            chfl_bond_order::CHFL_BOND_QUINTUPLET => BondOrder::Quintuplet,
+            chfl_bond_order::CHFL_BOND_AMIDE => BondOrder::Amide,
+            chfl_bond_order::CHFL_BOND_AROMATIC => BondOrder::Aromatic,
+        }
+    }
+}
+
+/// A `Topology` contains the definition of all the atoms in the system, and
+/// the liaisons between the atoms (bonds, angles, dihedrals, ...). It will
+/// also contain all the residues information if it is available.
+pub struct Topology {
+    handle: *mut CHFL_TOPOLOGY,
+}
+
+/// An analog to a reference to a topology (`&Topology`)
+pub struct TopologyRef<'a> {
+    inner: Topology,
+    marker: PhantomData<&'a Topology>
+}
+
+impl<'a> Deref for TopologyRef<'a> {
+    type Target = Topology;
+    fn deref(&self) -> &Topology {
+        &self.inner
+    }
+}
+
+impl Clone for Topology {
+    fn clone(&self) -> Topology {
+        unsafe {
+            let new_handle = chfl_topology_copy(self.as_ptr());
+            Topology::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Topology {
+    /// Create a `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TOPOLOGY) -> Topology {
+        check_not_null(ptr);
+        Topology {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_TOPOLOGY) -> TopologyRef<'a> {
+        TopologyRef {
+            inner: Topology::from_ptr(ptr as *mut CHFL_TOPOLOGY),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Create a new empty topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    /// ```
+    pub fn new() -> Topology {
+        unsafe {
+            Topology::from_ptr(chfl_topology())
+        }
+    }
+
+    /// Get a reference of the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// let atom = topology.atom(4);
+    /// assert_eq!(atom.name(), "");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// assert_eq!(topology.atom(4).name(), "");
+    ///
+    /// topology.atom_mut(4).set_name("Fe");
+    /// assert_eq!(topology.atom(4).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr(), index as u64
+            );
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_topology_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize this topology to hold `natoms` atoms, inserting dummy atoms if
+    /// the new size if bigger than the old one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_topology_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` at the end of this topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Atom};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Mg"));
+    ///
+    /// let atom = topology.atom(0);
+    /// assert_eq!(atom.name(), "Mg");
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom) {
+        unsafe {
+            check_success(chfl_topology_add_atom(self.as_mut_ptr(), atom.as_ptr()));
+        }
+    }
+
+    /// Remove an `Atom` from this topology by `index`. This modify all the
+    /// other atoms indexes.
+    ///
+    /// # Panics
+    ///
+    /// If the `index` is out of bounds
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(9);
+    /// assert_eq!(topology.size(), 9);
+    ///
+    /// topology.remove(7);
+    /// assert_eq!(topology.size(), 8);
+    /// ```
+    pub fn remove(&mut self, index: usize) {
+        unsafe {
+            check_success(chfl_topology_remove(self.as_mut_ptr(), index as u64));
+        }
+    }
+
+    /// Get the number of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds_count(), 3);
+    /// ```
+    pub fn bonds_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_bonds_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.angles_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles_count(), 2);
+    /// ```
+    pub fn angles_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_angles_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.dihedrals_count(), 1);
+    /// ```
+    pub fn dihedrals_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_dihedrals_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    /// assert_eq!(topology.impropers_count(), 1);
+    /// ```
+    pub fn impropers_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_impropers_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the list of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+    /// ```
+    pub fn bonds(&self) -> Vec<[usize; 2]> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![[u64::max_value(); 2]; size];
+        unsafe {
+            check_success(chfl_topology_bonds(self.as_ptr(), bonds.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return bonds
+            .into_iter()
+            .map(|bond| [bond[0] as usize, bond[1] as usize])
+            .collect();
+    }
+
+    /// Get the list of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+    /// ```
+    pub fn angles(&self) -> Vec<[usize; 3]> {
+        let size = self.angles_count();
+        let count = size as u64;
+        let mut angles = vec![[u64::max_value(); 3]; size];
+        unsafe {
+            check_success(chfl_topology_angles(self.as_ptr(), angles.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return angles
+            .into_iter()
+            .map(|angle| [angle[0] as usize, angle[1] as usize, angle[2] as usize])
+            .collect();
+    }
+
+    /// Get the list of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    ///
+    /// assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+    /// ```
+    pub fn dihedrals(&self) -> Vec<[usize; 4]> {
+        let size = self.dihedrals_count();
+        let count = size as u64;
+        let mut dihedrals = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_dihedrals(
+                self.as_ptr(), dihedrals.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return dihedrals
+            .into_iter()
+            .map(|dihedral| {
+                [
+                    dihedral[0] as usize,
+                    dihedral[1] as usize,
+                    dihedral[2] as usize,
+                    dihedral[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Get the list of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    ///
+    /// assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+    /// ```
+    pub fn impropers(&self) -> Vec<[usize; 4]> {
+        let size = self.impropers_count();
+        let count = size as u64;
+        let mut impropers = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_impropers(
+                self.as_ptr(), impropers.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return impropers
+            .into_iter()
+            .map(|improper| {
+                [
+                    improper[0] as usize,
+                    improper[1] as usize,
+                    improper[2] as usize,
+                    improper[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    /// assert_eq!(topology.angles().len(), 1);
+    ///
+    /// topology.clear_bonds();
+    /// assert!(topology.bonds().is_empty());
+    /// assert!(topology.angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_topology_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_topology_bond_with_order(
+                self.as_mut_ptr(), i as u64, j as u64, order.as_raw()
+            ));
+        }
+    }
+
+    /// Get the bond order for the bond between the atoms at indexes `i` and
+    /// `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn bond_order(&self, i: usize, j: usize) -> BondOrder {
+        let mut order = chfl_bond_order::CHFL_BOND_UNKNOWN;
+        unsafe {
+            check_success(chfl_topology_bond_order(
+                self.as_ptr(), i as u64, j as u64, &mut order
+            ));
+        }
+        return order.into()
+    }
+
+    /// Get the bond order for all the bonds in the topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(3);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// topology.add_bond_with_order(0, 2, BondOrder::Single);
+    ///
+    /// assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+    /// ```
+    pub fn bond_orders(&self) -> Vec<BondOrder> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![BondOrder::Unknown; size];
+        unsafe {
+            check_success(chfl_topology_bond_orders(
+                self.as_ptr(),
+                // Casting BondOrder to chfl_bond_order is safe, as they are
+                // both `repr(C)` enums with the same values.
+                bonds.as_mut_ptr() as *mut _,
+                count
+            ));
+        }
+        return bonds;
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// this topology.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// topology.remove_bond(0, 1);
+    /// assert_eq!(topology.bonds_count(), 1);
+    ///
+    /// // Removing a bond that does not exists is fine
+    /// topology.remove_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 1);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Get a reference to the residue at index `index` from this topology.
+    ///
+    /// The residue index in the topology is not always the same as the residue
+    /// `id`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn residue(&self, index: u64) -> Option<ResidueRef> {
+        unsafe {
+            let handle = chfl_residue_from_topology(self.as_ptr(), index as u64);
+            if handle.is_null() {
+                None
+            } else {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get a copy of the residue containing the atom at index `index` in this
+    /// topology, if any.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.resize(8);
+    ///
+    /// let mut residue = Residue::new("water");
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// topology.add_residue(&residue).unwrap();
+    ///
+    /// let residue = topology.residue_for_atom(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    ///
+    /// assert!(topology.residue_for_atom(6).is_none());
+    /// ```
+    pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef> {
+        let handle = unsafe {
+            chfl_residue_for_atom(self.as_ptr(), index as u64)
+        };
+        if handle.is_null() {
+            None
+        } else {
+            unsafe {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the number of residues in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.residues_count(), 0);
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    /// assert_eq!(topology.residues_count(), 2);
+    /// ```
+    pub fn residues_count(&self) -> u64 {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_residues_count(self.as_ptr(), &mut count));
+        }
+        return count;
+    }
+
+    /// Add a residue to this topology.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue `id` is not already in the topology,
+    /// or if the residue contains atoms that are already in another residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_topology_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Check if the two residues `first` and `second` from the `topology` are
+    /// linked together, *i.e.* if there is a bond between one atom in the
+    /// first residue and one atom in the second one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    ///
+    /// let first = topology.residue(0).unwrap();
+    /// let second = topology.residue(1).unwrap();
+    /// assert_eq!(topology.are_linked(&first, &second), false);
+    /// ```
+    pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool {
+        let mut linked = 0;
+        unsafe {
+            check_success(chfl_topology_residues_linked(
+                self.as_ptr(),
+                first.as_ptr(),
+                second.as_ptr(),
+                &mut linked
+            ));
+        }
+        return linked != 0;
+    }
+}
+
+impl Drop for Topology {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr() as *const _);
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Residue};
+
+    #[test]
+    fn clone() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        let copy = topology.clone();
+        assert_eq!(copy.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+
+        topology.remove(7);
+        assert_eq!(topology.size(), 9);
+
+        topology.add_atom(&Atom::new("Hg"));
+        assert_eq!(topology.size(), 10);
+    }
+
+    #[test]
+    fn atoms() {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(3).name(), "Fe");
+    }
+
+    #[test]
+    fn remove() {
+        let mut topology = Topology::new();
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "W");
+
+        topology.remove(1);
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "Fe");
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove() {
+        let mut topology = Topology::new();
+        topology.resize(18);
+        topology.remove(33);
+    }
+
+
+    #[test]
+    fn bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.bonds_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(9, 2);
+        topology.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(topology.bonds_count(), 3);
+
+        assert_eq!(topology.bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(topology.bond_orders(), expected);
+
+        assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(topology.bond_order(3, 7), BondOrder::Aromatic);
+
+        topology.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        topology.remove_bond(8, 7);
+        assert_eq!(topology.bonds_count(), 2);
+
+        topology.clear_bonds();
+        assert_eq!(topology.bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn angles() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.angles_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 7);
+        topology.add_bond(3, 5);
+        assert_eq!(topology.angles_count(), 2);
+
+        assert_eq!(topology.angles(), vec![[0, 1, 2], [5, 3, 7]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.angles_count(), 0);
+    }
+
+    #[test]
+    fn dihedrals() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.dihedrals_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 2);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(7, 10);
+        assert_eq!(topology.dihedrals_count(), 2);
+
+        assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3], [5, 4, 7, 10]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.dihedrals_count(), 0);
+    }
+
+    #[test]
+    fn impropers() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.impropers_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(0, 2);
+        topology.add_bond(0, 3);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(4, 8);
+        assert_eq!(topology.impropers_count(), 2);
+
+        assert_eq!(topology.impropers(), vec![[1, 0, 2, 3], [5, 4, 7, 8]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.impropers_count(), 0);
+    }
+
+    #[test]
+    fn residues() {
+        let mut topology = Topology::new();
+        topology.resize(4);
+        assert_eq!(topology.residues_count(), 0);
+
+        let mut residue = Residue::new("Foo");
+        residue.add_atom(0);
+        residue.add_atom(2);
+
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 1);
+
+        assert_eq!(topology.residue(0).unwrap().name(), "Foo");
+        {
+            let residue = topology.residue_for_atom(2).unwrap();
+            assert_eq!(residue.name(), "Foo");
+        }
+
+        let mut residue = Residue::new("Bar");
+        residue.add_atom(3);
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 2);
+
+        let first = topology.residue(0).unwrap();
+        let second = topology.residue(0).unwrap();
+        assert_eq!(topology.are_linked(&first, &second), true);
+
+        // missing residue
+        assert!(topology.residue_for_atom(1).is_none());
+        // out of bounds
+        assert!(topology.residue_for_atom(67).is_none());
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/src/chemfiles/trajectory.rs.html b/0.10.0/src/chemfiles/trajectory.rs.html new file mode 100644 index 000000000..39de32c30 --- /dev/null +++ b/0.10.0/src/chemfiles/trajectory.rs.html @@ -0,0 +1,1174 @@ +trajectory.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::path::Path;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check, check_success, Error, Status};
+use strings;
+
+use {Frame, Topology, UnitCell};
+
+/// The `Trajectory` type is the main entry point when using chemfiles. A
+/// `Trajectory` behave a bit like a file, allowing to read and/or write
+/// `Frame`.
+pub struct Trajectory {
+    handle: *mut CHFL_TRAJECTORY,
+}
+
+impl Trajectory {
+    /// Create a `Trajectory` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TRAJECTORY) -> Result<Trajectory, Error> {
+        if ptr.is_null() {
+            Err(Error {
+                status: Status::FileError,
+                message: Error::last_error()
+            })
+        } else {
+            Ok(Trajectory {
+                handle: ptr
+            })
+        }
+    }
+
+    /// Get the underlying C pointer as a pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Open the file at the given `path` in the given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// ```
+    pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_open(path.as_ptr(), mode as i8);
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Open the file at the given `path` using a specific file `format` and the
+    /// given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// Specifying a format is needed when the file format does not match the
+    /// extension, or when there is not standard extension for this format. If
+    /// `format` is an empty string, the format will be guessed from the
+    /// extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+    /// ```
+    pub fn open_with_format<'a, P, S>(filename: P, mode: char, format: S) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let filename =
+            filename.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(filename.as_ref()))?;
+
+        let filename = strings::to_c(filename);
+        let format = strings::to_c(format.into());
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_with_format(
+                filename.as_ptr(), mode as i8, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read a memory buffer as though it was a formatted file.
+    ///
+    /// The memory buffer used to store the file is given using the `data`
+    /// argument. The `format` parameter is required and should follow the same
+    /// rules as in the main `Trajectory` constructor.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or if the format do not support in-memory readers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+    /// let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+    /// let mut frame = Frame::new();
+    /// trajectory.read(&mut frame).unwrap();
+    /// assert_eq!(frame.size(), 6);
+    /// ```
+    pub fn memory_reader<'a, S>(data: S, format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let data = strings::to_c(data.into());
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_reader(
+                data.as_ptr(), data.as_bytes().len() as u64, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Write to a memory buffer as though it was a formatted file.
+    ///
+    /// The `format` parameter should follow the same rules as in the main
+    /// `Trajectory` constructor, except that compression specification
+    /// is not supported.
+    ///
+    /// The `memory_buffer` function can be used to retrieve the data written
+    /// to memory of the `Trajectory`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the format do not support in-memory writers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Trajectory;
+    /// let trajectory_memory = Trajectory::memory_writer("SMI");
+    ///
+    /// // Binary formats typically do not support this feature
+    /// assert!(Trajectory::memory_writer("XTC").is_err());
+    /// ```
+    pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_writer(format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read the next step of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of atom
+    /// in the next step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read(&mut frame).unwrap();
+    /// ```
+    pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read(self.as_mut_ptr(), frame.as_mut_ptr()))
+        }
+    }
+
+    /// Read a specific `step` of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of
+    /// atom at this step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read_step(10, &mut frame).unwrap();
+    /// ```
+    pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read_step(self.as_mut_ptr(), step as u64, frame.as_mut_ptr()))
+        }
+    }
+
+    /// Write a `frame` to this trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.write(&mut frame).unwrap();
+    /// ```
+    pub fn write(&mut self, frame: &Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_write(self.as_mut_ptr(), frame.as_ptr()))
+        }
+    }
+
+    /// Set the `topology` associated with this trajectory. This topology will
+    /// be used when reading and writing the files, replacing any topology in
+    /// the frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Atom, Topology};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_atom(&Atom::new("O"));
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    ///
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_topology(&topology);
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) {
+        unsafe {
+            check_success(chfl_trajectory_set_topology(self.as_mut_ptr(), topology.as_ptr()));
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in `format`;
+    /// and extracting the topology of this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_file("topology.pdb").unwrap();
+    /// ```
+    pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), ptr::null()))
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in
+    /// `format`; and extracting the topology of this frame.
+    ///
+    /// If `format` is an empty string, the format will be guessed from the
+    /// `path` extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+    /// ```
+    pub fn set_topology_with_format<'a, P, S>(&mut self, path: P, format: S) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let format = strings::to_c(format.into());
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), format.as_ptr()))
+        }
+    }
+
+    /// Set the unit `cell` associated with a trajectory. This cell will be
+    /// used when reading and writing the files, replacing any unit cell in the
+    /// frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, UnitCell};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_trajectory_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get the number of steps (the number of frames) in a trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// println!("This trajectory contains {} steps", trajectory.nsteps());
+    /// ```
+    // FIXME should this take &self instead? The file can be modified by this
+    // function, but the format should reset the state.
+    pub fn nsteps(&mut self) -> usize {
+        let mut res = 0;
+        unsafe {
+            check(chfl_trajectory_nsteps(self.as_mut_ptr(), &mut res)).expect(
+                "failed to get the number of steps in this trajectory"
+            );
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return res as usize;
+    }
+
+    /// Obtain the memory buffer written to by the trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This fails if the trajectory was not opened with
+    /// `Trajectory::memory_writer`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, BondOrder, Frame, Trajectory};
+    /// let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+    ///
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_bond_with_order(0, 1, BondOrder::Single);
+    ///
+    /// trajectory_memory.write(&frame).unwrap();
+    ///
+    /// let result = trajectory_memory.memory_buffer();
+    /// assert_eq!(result.unwrap(), "CC\n");
+    /// ```
+    #[allow(clippy::cast_possible_truncation)]
+    pub fn memory_buffer(&self) -> Result<&str, Error> {
+            let mut raw_str: *const i8 = std::ptr::null();
+            let mut strlen: u64 = 0;
+            unsafe {
+                check(chfl_trajectory_memory_buffer(self.as_ptr(), &mut raw_str, &mut strlen))?;
+                let mem_buf = std::ffi::CStr::from_ptr(raw_str);
+                assert_eq!(mem_buf.to_bytes().len(), strlen as usize);
+                Ok(mem_buf.to_str().unwrap())
+            }
+    }
+
+    /// Get file path for this trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// assert_eq!(trajectory.path(), "water.xyz");
+    /// ```
+    pub fn path(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_trajectory_path(self.as_ptr(), ptr, len) };
+        let path = strings::call_autogrow_buffer(1024, get_string).expect("failed to get path string");
+        return strings::from_c(path.as_ptr());
+    }
+}
+
+impl Drop for Trajectory {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_trajectory_close(self.as_ptr());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use std::fs;
+    use std::path::Path;
+    use std::io::Read;
+
+    use approx::assert_ulps_eq;
+
+    use {Atom, CellShape, Frame, Topology, UnitCell};
+
+    #[test]
+    fn read() {
+        let root = Path::new(file!()).parent().unwrap().join("..");
+        let filename = root.join("data").join("water.xyz");
+        let mut file = Trajectory::open(filename.to_str().unwrap(), 'r').unwrap();
+
+        if cfg!(target_family = "unix") {
+            assert_eq!(file.path(), "src/../data/water.xyz");
+        } else if cfg!(target_family = "windows") {
+            assert_eq!(file.path(), "src\\..\\data\\water.xyz");
+        } else {
+            panic!("please add test for this OS!");
+        }
+
+        assert_eq!(file.nsteps(), 100);
+
+        let mut frame = Frame::new();
+        assert!(file.read(&mut frame).is_ok());
+
+        assert_eq!(frame.size(), 297);
+        assert_ulps_eq!(frame.positions()[0][0], 0.417219);
+        assert_ulps_eq!(frame.positions()[0][1], 8.303366);
+        assert_ulps_eq!(frame.positions()[0][2], 11.737172);
+        assert_ulps_eq!(frame.positions()[124][0], 5.099554);
+        assert_ulps_eq!(frame.positions()[124][1], -0.045104);
+        assert_ulps_eq!(frame.positions()[124][2], 14.153846);
+
+        assert_eq!(frame.atom(0).name(), "O");
+
+        file.set_cell(&UnitCell::new([30.0, 30.0, 30.0]));
+        assert!(file.read_step(41, &mut frame).is_ok());
+        let cell = frame.cell().clone();
+        assert_eq!(cell.lengths(), [30.0, 30.0, 30.0]);
+
+
+        assert_ulps_eq!(frame.positions()[0][0], 0.761277);
+        assert_ulps_eq!(frame.positions()[0][1], 8.106125);
+        assert_ulps_eq!(frame.positions()[0][2], 10.622949);
+        assert_ulps_eq!(frame.positions()[124][0], 5.13242);
+        assert_ulps_eq!(frame.positions()[124][1], 0.079862);
+        assert_ulps_eq!(frame.positions()[124][2], 14.194161);
+
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 0);
+        }
+
+        assert!(frame.guess_bonds().is_ok());
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 180);
+            assert_eq!(topology.angles_count(), 84);
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("Cs");
+        for _ in 0..297 {
+            topology.add_atom(&atom);
+        }
+
+        file.set_topology(&topology);
+        assert!(file.read_step(10, &mut frame).is_ok());
+        assert_eq!(frame.atom(42).name(), "Cs");
+
+        let filename = root.join("data").join("topology.xyz");
+        assert!(file.set_topology_file(filename.to_str().unwrap()).is_ok());
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.atom(100).name(), "Rd");
+
+        let filename = root.join("data").join("helium.xyz.but.not.really");
+        let filename = filename.to_str().unwrap();
+        let mut file = Trajectory::open_with_format(filename, 'r', "XYZ").unwrap();
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.size(), 125);
+    }
+
+    fn write_file(path: &str) {
+        let mut file = Trajectory::open(path, 'w').unwrap();
+        let mut frame = Frame::new();
+        frame.resize(4);
+
+        for position in frame.positions_mut() {
+            *position = [1.0, 2.0, 3.0];
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("X");
+        for _ in 0..4 {
+            topology.add_atom(&atom);
+        }
+        frame.set_topology(&topology).unwrap();
+        assert!(file.write(&frame).is_ok());
+    }
+
+    #[test]
+    fn write() {
+        let filename = "test-tmp.xyz";
+        write_file(filename);
+
+        let expected_content = "4
+Properties=species:S:1:pos:R:3
+X 1 2 3
+X 1 2 3
+X 1 2 3
+X 1 2 3".lines().collect::<Vec<_>>();
+
+        let mut file = fs::File::open(filename).unwrap();
+        let mut content = String::new();
+        let _ = file.read_to_string(&mut content).unwrap();
+
+        assert_eq!(expected_content, content.lines().collect::<Vec<_>>());
+        fs::remove_file(filename).unwrap();
+    }
+
+    #[test]
+    fn memory() {
+        // formats in decreasing order of their memory buffer length to check null termination
+        for format in &["CSSR", "GRO", "XYZ"] {
+            let mut frame_write = Frame::new();
+            frame_write.add_atom(&Atom::new("H"), [1.5, 3.0, -10.0], None);
+            frame_write.add_atom(&Atom::new("O"), [2.3, -1.4, 50.0], None);
+            frame_write.add_atom(&Atom::new("H"), [-1.5, 10.0, 0.0], None);
+            let cell = UnitCell::new([10.0, 11.0, 12.5]);
+
+            let mut trajectory_write = Trajectory::memory_writer(*format).unwrap();
+            trajectory_write.set_cell(&cell);
+            trajectory_write.write(&frame_write).unwrap();
+
+            let buffer = trajectory_write.memory_buffer().unwrap();
+            let mut trajectory_read = Trajectory::memory_reader(buffer, *format).unwrap();
+            let mut frame_read = Frame::new();
+            trajectory_read.read(&mut frame_read).unwrap();
+
+            assert_eq!(trajectory_read.nsteps(), 1);
+            assert_eq!(frame_read.cell().shape(), CellShape::Orthorhombic);
+            assert_eq!(frame_read.size(), 3);
+            assert_eq!(frame_read.atom(1).name(), "O");
+            crate::assert_vector3d_eq(&frame_read.positions()[2], &[-1.5, 10.0, 0.0], 1e-4);
+        }
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.0/storage.js b/0.10.0/storage.js new file mode 100644 index 000000000..318275ed3 --- /dev/null +++ b/0.10.0/storage.js @@ -0,0 +1 @@ +var resourcesSuffix="";var darkThemes=["dark","ayu"];var currentTheme=document.getElementById("themeStyle");var mainTheme=document.getElementById("mainThemeStyle");var settingsDataset=(function(){var settingsElement=document.getElementById("default-settings");if(settingsElement===null){return null}var dataset=settingsElement.dataset;if(dataset===undefined){return null}return dataset})();function getSettingValue(settingName){var current=getCurrentValue('rustdoc-'+settingName);if(current!==null){return current}if(settingsDataset!==null){var def=settingsDataset[settingName.replace(/-/g,'_')];if(def!==undefined){return def}}return null}var localStoredTheme=getSettingValue("theme");var savedHref=[];function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(!elem||!elem.classList){return}elem.classList.add(className)}function removeClass(elem,className){if(!elem||!elem.classList){return}elem.classList.remove(className)}function onEach(arr,func,reversed){if(arr&&arr.length>0&&func){var length=arr.length;var i;if(reversed!==true){for(i=0;i=0;--i){if(func(arr[i])===true){return true}}}}return false}function onEachLazy(lazyArray,func,reversed){return onEach(Array.prototype.slice.call(lazyArray),func,reversed)}function hasOwnProperty(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function usableLocalStorage(){if(typeof Storage==="undefined"){return false}try{return window.localStorage!==null&&window.localStorage!==undefined}catch(err){return false}}function updateLocalStorage(name,value){if(usableLocalStorage()){localStorage[name]=value}else{}}function getCurrentValue(name){if(usableLocalStorage()&&localStorage[name]!==undefined){return localStorage[name]}return null}function switchTheme(styleElem,mainStyleElem,newTheme,saveTheme){var fullBasicCss="rustdoc"+resourcesSuffix+".css";var fullNewTheme=newTheme+resourcesSuffix+".css";var newHref=mainStyleElem.href.replace(fullBasicCss,fullNewTheme);if(saveTheme===true){updateLocalStorage("rustdoc-theme",newTheme)}if(styleElem.href===newHref){return}var found=false;if(savedHref.length===0){onEachLazy(document.getElementsByTagName("link"),function(el){savedHref.push(el.href)})}onEach(savedHref,function(el){if(el===newHref){found=true;return true}});if(found===true){styleElem.href=newHref}}function useSystemTheme(value){if(value===undefined){value=true}updateLocalStorage("rustdoc-use-system-theme",value);var toggle=document.getElementById("use-system-theme");if(toggle&&toggle instanceof HTMLInputElement){toggle.checked=value}}var updateSystemTheme=(function(){if(!window.matchMedia){return function(){let cssTheme=getComputedStyle(document.documentElement).getPropertyValue('content');switchTheme(currentTheme,mainTheme,JSON.parse(cssTheme)||light,true)}}var mql=window.matchMedia("(prefers-color-scheme: dark)");function handlePreferenceChange(mql){if(getSettingValue("use-system-theme")!=="false"){var lightTheme=getSettingValue("preferred-light-theme")||"light";var darkTheme=getSettingValue("preferred-dark-theme")||"dark";if(mql.matches){switchTheme(currentTheme,mainTheme,darkTheme,true)}else{switchTheme(currentTheme,mainTheme,lightTheme,true)}}}mql.addListener(handlePreferenceChange);return function(){handlePreferenceChange(mql)}})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("rustdoc-preferred-dark-theme",localStoredTheme)}updateSystemTheme()}else{switchTheme(currentTheme,mainTheme,getSettingValue("theme")||"light",false)} \ No newline at end of file diff --git a/0.10.0/theme.js b/0.10.0/theme.js new file mode 100644 index 000000000..8f9c49a42 --- /dev/null +++ b/0.10.0/theme.js @@ -0,0 +1 @@ +var themes=document.getElementById("theme-choices");var themePicker=document.getElementById("theme-picker");function showThemeButtonState(){themes.style.display="block";themePicker.style.borderBottomRightRadius="0";themePicker.style.borderBottomLeftRadius="0"}function hideThemeButtonState(){themes.style.display="none";themePicker.style.borderBottomRightRadius="3px";themePicker.style.borderBottomLeftRadius="3px"}function switchThemeButtonState(){if(themes.style.display==="block"){hideThemeButtonState()}else{showThemeButtonState()}};function handleThemeButtonsBlur(e){var active=document.activeElement;var related=e.relatedTarget;if(active.id!=="theme-picker"&&(!active.parentNode||active.parentNode.id!=="theme-choices")&&(!related||(related.id!=="theme-picker"&&(!related.parentNode||related.parentNode.id!=="theme-choices")))){hideThemeButtonState()}}themePicker.onclick=switchThemeButtonState;themePicker.onblur=handleThemeButtonsBlur;["ayu","dark","light"].forEach(function(item){var but=document.createElement("button");but.textContent=item;but.onclick=function(el){switchTheme(currentTheme,mainTheme,item,true);useSystemTheme(false)};but.onblur=handleThemeButtonsBlur;themes.appendChild(but)}) \ No newline at end of file diff --git a/0.10.0/wheel.svg b/0.10.0/wheel.svg new file mode 100644 index 000000000..01da3b24c --- /dev/null +++ b/0.10.0/wheel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.1/.lock b/0.10.1/.lock new file mode 100755 index 000000000..e69de29bb diff --git a/0.10.1/COPYRIGHT.txt b/0.10.1/COPYRIGHT.txt new file mode 100644 index 000000000..16d79032f --- /dev/null +++ b/0.10.1/COPYRIGHT.txt @@ -0,0 +1,46 @@ +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff, FiraSans-Medium.woff): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff, + SourceCodePro-Semibold.ttf.woff, SourceCodePro-It.ttf.woff): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff, SourceSerif4-Bold.ttf.woff, + SourceSerif4-It.ttf.woff): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. diff --git a/0.10.1/FiraSans-LICENSE.txt b/0.10.1/FiraSans-LICENSE.txt new file mode 100644 index 000000000..d444ea92b --- /dev/null +++ b/0.10.1/FiraSans-LICENSE.txt @@ -0,0 +1,94 @@ +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.1/FiraSans-Medium.woff b/0.10.1/FiraSans-Medium.woff new file mode 100644 index 000000000..7d742c5fb Binary files /dev/null and b/0.10.1/FiraSans-Medium.woff differ diff --git a/0.10.1/FiraSans-Medium.woff2 b/0.10.1/FiraSans-Medium.woff2 new file mode 100644 index 000000000..7a1e5fc54 Binary files /dev/null and b/0.10.1/FiraSans-Medium.woff2 differ diff --git a/0.10.1/FiraSans-Regular.woff b/0.10.1/FiraSans-Regular.woff new file mode 100644 index 000000000..d8e0363f4 Binary files /dev/null and b/0.10.1/FiraSans-Regular.woff differ diff --git a/0.10.1/FiraSans-Regular.woff2 b/0.10.1/FiraSans-Regular.woff2 new file mode 100644 index 000000000..e766e06cc Binary files /dev/null and b/0.10.1/FiraSans-Regular.woff2 differ diff --git a/0.10.1/LICENSE-APACHE.txt b/0.10.1/LICENSE-APACHE.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/0.10.1/LICENSE-APACHE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/0.10.1/LICENSE-MIT.txt b/0.10.1/LICENSE-MIT.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/0.10.1/LICENSE-MIT.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/0.10.1/SourceCodePro-It.ttf.woff b/0.10.1/SourceCodePro-It.ttf.woff new file mode 100644 index 000000000..8d68f2feb Binary files /dev/null and b/0.10.1/SourceCodePro-It.ttf.woff differ diff --git a/0.10.1/SourceCodePro-LICENSE.txt b/0.10.1/SourceCodePro-LICENSE.txt new file mode 100644 index 000000000..07542572e --- /dev/null +++ b/0.10.1/SourceCodePro-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.1/SourceCodePro-Regular.ttf.woff b/0.10.1/SourceCodePro-Regular.ttf.woff new file mode 100644 index 000000000..7be076e1f Binary files /dev/null and b/0.10.1/SourceCodePro-Regular.ttf.woff differ diff --git a/0.10.1/SourceCodePro-Semibold.ttf.woff b/0.10.1/SourceCodePro-Semibold.ttf.woff new file mode 100644 index 000000000..61bc67b80 Binary files /dev/null and b/0.10.1/SourceCodePro-Semibold.ttf.woff differ diff --git a/0.10.1/SourceSerif4-Bold.ttf.woff b/0.10.1/SourceSerif4-Bold.ttf.woff new file mode 100644 index 000000000..8ad41888e Binary files /dev/null and b/0.10.1/SourceSerif4-Bold.ttf.woff differ diff --git a/0.10.1/SourceSerif4-It.ttf.woff b/0.10.1/SourceSerif4-It.ttf.woff new file mode 100644 index 000000000..2a34b5c42 Binary files /dev/null and b/0.10.1/SourceSerif4-It.ttf.woff differ diff --git a/0.10.1/SourceSerif4-LICENSE.md b/0.10.1/SourceSerif4-LICENSE.md new file mode 100644 index 000000000..68ea18924 --- /dev/null +++ b/0.10.1/SourceSerif4-LICENSE.md @@ -0,0 +1,93 @@ +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.1/SourceSerif4-Regular.ttf.woff b/0.10.1/SourceSerif4-Regular.ttf.woff new file mode 100644 index 000000000..45a5521ab Binary files /dev/null and b/0.10.1/SourceSerif4-Regular.ttf.woff differ diff --git a/0.10.1/ayu.css b/0.10.1/ayu.css new file mode 100644 index 000000000..f41123b03 --- /dev/null +++ b/0.10.1/ayu.css @@ -0,0 +1 @@ + body{background-color:#0f1419;color:#c5c5c5;}h1,h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){color:white;}h1.fqn{border-bottom-color:#5c6773;}h1.fqn a{color:#fff;}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod){border-bottom-color:#5c6773;}h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant){border:none;}.in-band{background-color:#0f1419;}.invisible{background:rgba(0,0,0,0);}code{color:#ffb454;}h3>code,h4>code,h5>code{color:#e6e1cf;}pre>code{color:#e6e1cf;}span code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}.docblock code,.docblock-short code{background-color:#191f26;}pre{color:#e6e1cf;background-color:#191f26;}.sidebar{background-color:#14191f;}.logo-container.rust-logo>img{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}*{scrollbar-color:#5c6773 transparent;}.sidebar{scrollbar-color:#5c6773 transparent;}::-webkit-scrollbar-track{background-color:transparent;}::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar::-webkit-scrollbar-track{background-color:transparent;}.sidebar::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar .current{background-color:transparent;color:#ffb44c;}.source .sidebar{background-color:#0f1419;}.sidebar .location{border-color:#000;background-color:#0f1419;color:#fff;}.sidebar-elems .location{color:#ff7733;}.sidebar-elems .location a{color:#fff;}.sidebar .version{border-bottom-color:#424c57;}.sidebar-title{border-top-color:#5c6773;border-bottom-color:#5c6773;}.block a:hover{background:transparent;color:#ffb44c;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#5c6773;}.docblock table,.docblock table td,.docblock table th{border-color:#5c6773;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#c5c5c5;}.content .highlighted{color:#000 !important;background-color:#c6afb3;}.content .highlighted a,.content .highlighted span{color:#000 !important;}.content .highlighted{background-color:#c6afb3;}.search-results a{color:#0096cf;}.search-results a span.desc{color:#c5c5c5;}.content .item-info::before{color:#ccc;}.content span.foreigntype,.content a.foreigntype{color:#ef57ff;}.content span.union,.content a.union{color:#98a01c;}.content span.constant,.content a.constant,.content span.static,.content a.static{color:#6380a0;}.content span.primitive,.content a.primitive{color:#32889b;}.content span.traitalias,.content a.traitalias{color:#57d399;}.content span.keyword,.content a.keyword{color:#de5249;}.content span.externcrate,.content span.mod,.content a.mod{color:#acccf9;}.content span.struct,.content a.struct{color:#ffa0a5;}.content span.enum,.content a.enum{color:#99e0c9;}.content span.trait,.content a.trait{color:#39AFD7;}.content span.type,.content a.type{color:#cfbcf5;}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod,.content .fnname{color:#fdd687;}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:#a37acc;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}nav:not(.sidebar){border-bottom-color:#424c57;}nav.main .current{border-top-color:#5c6773;border-bottom-color:#5c6773;}nav.main .separator{border:1px solid #5c6773;}a{color:#c5c5c5;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#39AFD7;}.collapse-toggle,details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before{color:#999;}#crate-search{color:#c5c5c5;background-color:#141920;box-shadow:0 0 0 1px #424c57,0 0 0 2px transparent;border-color:#424c57;}.search-input{color:#ffffff;background-color:#141920;box-shadow:0 0 0 1px #424c57,0 0 0 2px transparent;transition:box-shadow 150ms ease-in-out;}#crate-search+.search-input:focus{box-shadow:0 0 0 1px #148099,0 0 0 2px transparent;}.search-focus:disabled{color:#929292;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable,.stab.deprecated,.stab.portability{color:#c5c5c5;background:#314559 !important;border-style:none !important;border-radius:4px;padding:3px 6px 3px 6px;}.stab.portability>code{color:#e6e1cf;background:none;}#help>div{background:#14191f;box-shadow:0px 6px 20px 0px black;border:none;border-radius:4px;}#help>div>span{border-bottom-color:#5c6773;}.since{color:grey;}tr.result span.primitive::after,tr.result span.keyword::after{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .op,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}pre.rust .attribute .ident,pre.rust .attribute .op{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}.toggle-label,.code-attribute{color:#999;}:target>code,:target>.in-band{background:rgba(255,236,164,0.06);border-right:3px solid rgba(255,180,76,0.85);}pre.compile_fail{border-left:2px solid rgba(255,0,0,.4);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.4);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#39AFD7;}.tooltip::after{background-color:#314559;color:#c5c5c5;border:1px solid #5c6773;}.tooltip::before{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;border-color:#5c6773;}#titles>button.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>button:not(.selected){background-color:transparent !important;border:none;}#titles>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>button>div.count{color:#888;}.content .highlighted.mod,.content .highlighted.externcrate{}.search-input:focus{}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{}.content .highlighted.trait{}.content span.struct,.content a.struct,.block a.current.struct{}#titles>button:hover,#titles>button.selected{}.content .highlighted.traitalias{}.content span.type,.content a.type,.block a.current.type{}.content span.union,.content a.union,.block a.current.union{}.content .highlighted.foreigntype{}pre.rust .lifetime{}.content .highlighted.primitive{}.content .highlighted.constant,.content .highlighted.static{}.stab.unstable{}.content .highlighted.fn,.content .highlighted.method,.content .highlighted.tymethod{}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){}.content span.enum,.content a.enum,.block a.current.enum{}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{}.content span.keyword,.content a.keyword,.block a.current.keyword{}pre.rust .comment{}.content .highlighted.enum{}.content .highlighted.struct{}.content .highlighted.keyword{}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{}pre.rust .kw{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{}pre.rust .doccomment{}.stab.deprecated{}.content .highlighted.attr,.content .highlighted.derive,.content .highlighted.macro{}.stab.portability{}.content .highlighted.union{}.content span.primitive,.content a.primitive,.block a.current.primitive{}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{}.content .highlighted.type{}pre.rust .kw-2,pre.rust .prelude-ty{}.content span.trait,.content a.trait,.block a.current.trait{}@media (max-width:700px){.sidebar-menu{background-color:#14191f;border-bottom-color:#5c6773;border-right-color:#5c6773;}.sidebar-elems{background-color:#14191f;border-right-color:#5c6773;}#sidebar-filler{background-color:#14191f;border-bottom-color:#5c6773;}}kbd{color:#c5c5c5;background-color:#314559;border-color:#5c6773;border-bottom-color:#5c6773;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,.help-button,#copy-path{border-color:#5c6773;background-color:#0f1419;color:#fff;}#theme-picker>img,#settings-menu>img{filter:invert(100);}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,.help-button:hover,.help-button:focus,#copy-path:hover,#copy-path:focus{border-color:#e0e0e0;}#theme-choices{border-color:#5c6773;background-color:#0f1419;}#theme-choices>button:not(:first-child){border-top-color:#5c6773;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:rgba(110,110,110,0.33);}@media (max-width:700px){#theme-picker{background:#0f1419;}}#all-types{background-color:#14191f;}#all-types:hover{background-color:rgba(70,70,70,0.33);}.search-results td span.alias{color:#c5c5c5;}.search-results td span.grey{color:#999;}#sidebar-toggle{background-color:#14191f;}#sidebar-toggle:hover{background-color:rgba(70,70,70,0.33);}#source-sidebar{background-color:#14191f;}#source-sidebar>.title{color:#fff;border-bottom-color:#5c6773;}div.files>a:hover,div.name:hover{background-color:#14191f;color:#ffb44c;}div.files>.selected{background-color:#14191f;color:#ffb44c;}.setting-line>.title{border-bottom-color:#5c6773;}input:checked+.slider{background-color:#ffb454 !important;} \ No newline at end of file diff --git a/0.10.1/brush.svg b/0.10.1/brush.svg new file mode 100644 index 000000000..ea266e856 --- /dev/null +++ b/0.10.1/brush.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.1/chemfiles/all.html b/0.10.1/chemfiles/all.html new file mode 100644 index 000000000..ffd5627b4 --- /dev/null +++ b/0.10.1/chemfiles/all.html @@ -0,0 +1,7 @@ +List of all items in this crate + +

List of all items[] + +

Structs

Enums

Functions

+ \ No newline at end of file diff --git a/0.10.1/chemfiles/atom/struct.Atom.html b/0.10.1/chemfiles/atom/struct.Atom.html new file mode 100644 index 000000000..fce480c69 --- /dev/null +++ b/0.10.1/chemfiles/atom/struct.Atom.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Atom.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/atom/struct.AtomMut.html b/0.10.1/chemfiles/atom/struct.AtomMut.html new file mode 100644 index 000000000..a62923670 --- /dev/null +++ b/0.10.1/chemfiles/atom/struct.AtomMut.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.AtomMut.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/atom/struct.AtomRef.html b/0.10.1/chemfiles/atom/struct.AtomRef.html new file mode 100644 index 000000000..042ac5995 --- /dev/null +++ b/0.10.1/chemfiles/atom/struct.AtomRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.AtomRef.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/cell/enum.CellShape.html b/0.10.1/chemfiles/cell/enum.CellShape.html new file mode 100644 index 000000000..e1c2cc748 --- /dev/null +++ b/0.10.1/chemfiles/cell/enum.CellShape.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.CellShape.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/cell/struct.UnitCell.html b/0.10.1/chemfiles/cell/struct.UnitCell.html new file mode 100644 index 000000000..cddcfc6bf --- /dev/null +++ b/0.10.1/chemfiles/cell/struct.UnitCell.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.UnitCell.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/cell/struct.UnitCellMut.html b/0.10.1/chemfiles/cell/struct.UnitCellMut.html new file mode 100644 index 000000000..c6b7d5aee --- /dev/null +++ b/0.10.1/chemfiles/cell/struct.UnitCellMut.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.UnitCellMut.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/cell/struct.UnitCellRef.html b/0.10.1/chemfiles/cell/struct.UnitCellRef.html new file mode 100644 index 000000000..0b0ac3556 --- /dev/null +++ b/0.10.1/chemfiles/cell/struct.UnitCellRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.UnitCellRef.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/enum.BondOrder.html b/0.10.1/chemfiles/enum.BondOrder.html new file mode 100644 index 000000000..dd83d7ba8 --- /dev/null +++ b/0.10.1/chemfiles/enum.BondOrder.html @@ -0,0 +1,58 @@ +BondOrder in chemfiles - Rust + +

Enum chemfiles::BondOrder[][src]

#[repr(C)]
+#[non_exhaustive]
+pub enum BondOrder {
+    Unknown,
+    Single,
+    Double,
+    Triple,
+    Quadruple,
+    Quintuplet,
+    Amide,
+    Aromatic,
+}

Possible bond order associated with bonds

+

+ Variants (Non-exhaustive)

+
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unknown

Unknown or unspecified bond order

+
Single

Single bond

+
Double

Double bond

+
Triple

Triple bond

+
Quadruple

Quadruple bond (present in some metals)

+
Quintuplet

Quintuplet bond (present in some metals)

+
Amide

Amide bond (required by some file formats)

+
Aromatic

Aromatic bond (required by some file formats)

+

Trait Implementations

impl Clone for BondOrder[src]

impl Debug for BondOrder[src]

impl From<chfl_bond_order> for BondOrder[src]

impl Ord for BondOrder[src]

impl PartialEq<BondOrder> for BondOrder[src]

impl PartialOrd<BondOrder> for BondOrder[src]

impl Copy for BondOrder[src]

impl Eq for BondOrder[src]

impl StructuralEq for BondOrder[src]

impl StructuralPartialEq for BondOrder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/enum.CellShape.html b/0.10.1/chemfiles/enum.CellShape.html new file mode 100644 index 000000000..60b0fc9d6 --- /dev/null +++ b/0.10.1/chemfiles/enum.CellShape.html @@ -0,0 +1,36 @@ +CellShape in chemfiles - Rust + +

Enum chemfiles::CellShape[][src]

pub enum CellShape {
+    Orthorhombic,
+    Triclinic,
+    Infinite,
+}

Available unit cell shapes.

+

+ Variants

+
Orthorhombic

Orthorhombic cell, with the three angles equals to 90°.

+
Triclinic

Triclinic cell, with any values for the angles.

+
Infinite

Infinite cell, to use when there is no cell.

+

Trait Implementations

impl Clone for CellShape[src]

impl Debug for CellShape[src]

impl From<CellShape> for chfl_cellshape[src]

impl From<chfl_cellshape> for CellShape[src]

impl PartialEq<CellShape> for CellShape[src]

impl Eq for CellShape[src]

impl StructuralEq for CellShape[src]

impl StructuralPartialEq for CellShape[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/enum.Property.html b/0.10.1/chemfiles/enum.Property.html new file mode 100644 index 000000000..2a5855e33 --- /dev/null +++ b/0.10.1/chemfiles/enum.Property.html @@ -0,0 +1,49 @@ +Property in chemfiles - Rust + +

Enum chemfiles::Property[][src]

pub enum Property {
+    Bool(bool),
+    Double(f64),
+    String(String),
+    Vector3D([f64; 3]),
+}

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

+ Variants

+
Bool(bool)

Boolean property

+
Double(f64)

Floating point property

+
String(String)

String property

+
Vector3D([f64; 3])

3-dimensional vector property

+

Trait Implementations

impl Clone for Property[src]

impl Debug for Property[src]

impl<'a> From<&'a str> for Property[src]

impl From<[f64; 3]> for Property[src]

impl From<String> for Property[src]

impl From<bool> for Property[src]

impl From<f64> for Property[src]

impl PartialEq<Property> for Property[src]

impl PartialOrd<Property> for Property[src]

impl StructuralPartialEq for Property[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/enum.Status.html b/0.10.1/chemfiles/enum.Status.html new file mode 100644 index 000000000..43c913856 --- /dev/null +++ b/0.10.1/chemfiles/enum.Status.html @@ -0,0 +1,52 @@ +Status in chemfiles - Rust + +

Enum chemfiles::Status[][src]

#[repr(C)]
+#[non_exhaustive]
+pub enum Status {
+    Success,
+    MemoryError,
+    FileError,
+    FormatError,
+    SelectionError,
+    ConfigurationError,
+    OutOfBounds,
+    PropertyError,
+    ChemfilesError,
+    StdCppError,
+    UTF8PathError,
+}

Possible causes of error in chemfiles

+

+ Variants (Non-exhaustive)

+
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Success

No error

+
MemoryError

Error in memory allocations

+
FileError

Error while reading or writing a file

+
FormatError

Error in file formatting, i.e. the file is invalid

+
SelectionError

Error in selection string syntax

+
ConfigurationError

Error in configuration files syntax

+
OutOfBounds

Error for out of bounds indexing

+
PropertyError

Error related to properties

+
ChemfilesError

Exception in the C++ chemfiles library

+
StdCppError

Exception in the C++ standard library

+
UTF8PathError

The given path is not valid UTF8

+

Trait Implementations

impl Clone for Status[src]

impl Debug for Status[src]

impl PartialEq<Status> for Status[src]

impl StructuralPartialEq for Status[src]

Auto Trait Implementations

impl RefUnwindSafe for Status

impl Send for Status

impl Sync for Status

impl Unpin for Status

impl UnwindSafe for Status

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/errors/enum.Status.html b/0.10.1/chemfiles/errors/enum.Status.html new file mode 100644 index 000000000..1ea316611 --- /dev/null +++ b/0.10.1/chemfiles/errors/enum.Status.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.Status.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/errors/fn.set_warning_callback.html b/0.10.1/chemfiles/errors/fn.set_warning_callback.html new file mode 100644 index 000000000..bf8004830 --- /dev/null +++ b/0.10.1/chemfiles/errors/fn.set_warning_callback.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/fn.set_warning_callback.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/errors/struct.Error.html b/0.10.1/chemfiles/errors/struct.Error.html new file mode 100644 index 000000000..413e6df25 --- /dev/null +++ b/0.10.1/chemfiles/errors/struct.Error.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Error.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/fn.add_configuration.html b/0.10.1/chemfiles/fn.add_configuration.html new file mode 100644 index 000000000..3741d3989 --- /dev/null +++ b/0.10.1/chemfiles/fn.add_configuration.html @@ -0,0 +1,17 @@ +add_configuration in chemfiles - Rust + +

Function chemfiles::add_configuration[][src]

pub fn add_configuration<S>(path: S) -> Result<(), Error> where
    S: AsRef<str>, 

Read configuration data from the file at path.

+

By default, chemfiles reads configuration from any file named +.chemfiles.toml in the current directory or any parent directory. This +function can be used to add data from another configuration file. Data from +the new configuration file will overwrite any existing data.

+

Errors

+

This function will fail if there is no file at path, or if the file is +incorrectly formatted.

+

Example

+
+chemfiles::add_configuration("local-config.toml").unwrap();
+// from now on, the data from "local-config.toml" will be used
+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/fn.formats_list.html b/0.10.1/chemfiles/fn.formats_list.html new file mode 100644 index 000000000..95819b257 --- /dev/null +++ b/0.10.1/chemfiles/fn.formats_list.html @@ -0,0 +1,18 @@ +formats_list in chemfiles - Rust + +

Function chemfiles::formats_list[][src]

#[must_use]
+pub fn formats_list() -> Vec<FormatMetadata>

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Example

+
+let formats = chemfiles::formats_list();
+println!("chemfiles supports {} formats:", formats.len());
+for format in &formats {
+    println!(
+        "   {:<15} {}",
+        format.name,
+        format.extension.as_deref().unwrap_or("")
+    );
+}
+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/fn.guess_format.html b/0.10.1/chemfiles/fn.guess_format.html new file mode 100644 index 000000000..e0a00166e --- /dev/null +++ b/0.10.1/chemfiles/fn.guess_format.html @@ -0,0 +1,23 @@ +guess_format in chemfiles - Rust + +

Function chemfiles::guess_format[][src]

pub fn guess_format(path: &str) -> String

Get the format that chemfiles would use to read a file at the given +path.

+

The format is mostly guessed from the path extension, chemfiles only tries +to read the file to distinguish between CIF and mmCIF files. Opening the +file using the returned format string might still fail. For example, it will +fail if the file is not actually formatted according to the guessed format; +or the format/compression combination is not supported (e.g. XTC / GZ will +not work since the XTC reader does not support compressed files).

+

The returned format is represented in a way compatible with the various +Trajectory constructors, i.e. "<format name> [/ <compression>]", where +compression is optional.

+

Examples

+
+let format = chemfiles::guess_format("trajectory.xyz.xz");
+assert_eq!(format, "XYZ / XZ");
+
+let format = chemfiles::guess_format("trajectory.nc");
+assert_eq!(format, "Amber NetCDF");
+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/fn.set_warning_callback.html b/0.10.1/chemfiles/fn.set_warning_callback.html new file mode 100644 index 000000000..2657fc8ab --- /dev/null +++ b/0.10.1/chemfiles/fn.set_warning_callback.html @@ -0,0 +1,7 @@ +set_warning_callback in chemfiles - Rust + +

Function chemfiles::set_warning_callback[][src]

pub fn set_warning_callback<F>(callback: F) where
    F: WarningCallback + 'static, 

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/fn.version.html b/0.10.1/chemfiles/fn.version.html new file mode 100644 index 000000000..3f07a6b7f --- /dev/null +++ b/0.10.1/chemfiles/fn.version.html @@ -0,0 +1,10 @@ +version in chemfiles - Rust + +

Function chemfiles::version[][src]

pub fn version() -> String

Get the version of the chemfiles library.

+

Example

+
+let version = chemfiles::version();
+assert!(version.starts_with("0.10"));
+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/frame/struct.Frame.html b/0.10.1/chemfiles/frame/struct.Frame.html new file mode 100644 index 000000000..0bcf1ad5e --- /dev/null +++ b/0.10.1/chemfiles/frame/struct.Frame.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Frame.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/index.html b/0.10.1/chemfiles/index.html new file mode 100644 index 000000000..6c84d4dbf --- /dev/null +++ b/0.10.1/chemfiles/index.html @@ -0,0 +1,65 @@ +chemfiles - Rust + +

Crate chemfiles[][src]

Chemfiles is a multi-language library written in modern C++ for reading and +writing from and to molecular trajectory files. These files are created by +your favorite theoretical chemistry program, and contains information about +atomic or residues names and positions. Some format also have additional +information, such as velocities, forces, energy, …

+

This crate expose the C API of chemfiles to Rust, and make all the +functionalities accessible. For more information on the C++ library, +please see its documentation. Specifically, the following pages +are worth reading:

+ +

Structs

+
Atom

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
AtomMut

An analog to a mutable reference to an atom (&mut Atom)

+
AtomRef

An analog to a reference to an atom (&Atom)

+
Error

Error type for Chemfiles.

+
FormatMetadata

FormatMetadata contains metadata associated with one format.

+
Frame

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+
Match

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+
PropertiesIter

An iterator over the properties in an atom/frame/residue

+
Residue

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+
ResidueRef

An analog to a reference to a residue (&Residue)

+
Selection

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+
Topology

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+
TopologyRef

An analog to a reference to a topology (&Topology)

+
Trajectory

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+
UnitCell

An UnitCell represent the box containing the atoms, and its periodicity.

+
UnitCellMut

An analog to a mutable reference to an unit cell (&mut UnitCell)

+
UnitCellRef

An analog to a reference to an unit cell (&UnitCell)

+

Enums

+
BondOrder

Possible bond order associated with bonds

+
CellShape

Available unit cell shapes.

+
Property

A Property is a piece of data that can be associated with an Atom or a +Frame.

+
Status

Possible causes of error in chemfiles

+

Functions

+
add_configuration

Read configuration data from the file at path.

+
formats_list

Get the list of formats known by chemfiles, as well as all associated metadata.

+
guess_format

Get the format that chemfiles would use to read a file at the given +path.

+
set_warning_callback

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
version

Get the version of the chemfiles library.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/misc/fn.formats_list.html b/0.10.1/chemfiles/misc/fn.formats_list.html new file mode 100644 index 000000000..93b494c4c --- /dev/null +++ b/0.10.1/chemfiles/misc/fn.formats_list.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/fn.formats_list.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/misc/fn.guess_format.html b/0.10.1/chemfiles/misc/fn.guess_format.html new file mode 100644 index 000000000..f4741431e --- /dev/null +++ b/0.10.1/chemfiles/misc/fn.guess_format.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/fn.guess_format.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/misc/struct.FormatMetadata.html b/0.10.1/chemfiles/misc/struct.FormatMetadata.html new file mode 100644 index 000000000..f380c5718 --- /dev/null +++ b/0.10.1/chemfiles/misc/struct.FormatMetadata.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.FormatMetadata.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/property/enum.Property.html b/0.10.1/chemfiles/property/enum.Property.html new file mode 100644 index 000000000..b3727aac1 --- /dev/null +++ b/0.10.1/chemfiles/property/enum.Property.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.Property.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/property/struct.PropertiesIter.html b/0.10.1/chemfiles/property/struct.PropertiesIter.html new file mode 100644 index 000000000..815bc6c1c --- /dev/null +++ b/0.10.1/chemfiles/property/struct.PropertiesIter.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.PropertiesIter.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/residue/struct.Residue.html b/0.10.1/chemfiles/residue/struct.Residue.html new file mode 100644 index 000000000..d9b75c1b0 --- /dev/null +++ b/0.10.1/chemfiles/residue/struct.Residue.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Residue.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/residue/struct.ResidueRef.html b/0.10.1/chemfiles/residue/struct.ResidueRef.html new file mode 100644 index 000000000..7219dbf27 --- /dev/null +++ b/0.10.1/chemfiles/residue/struct.ResidueRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.ResidueRef.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/selection/struct.Match.html b/0.10.1/chemfiles/selection/struct.Match.html new file mode 100644 index 000000000..848ab37f8 --- /dev/null +++ b/0.10.1/chemfiles/selection/struct.Match.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Match.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/selection/struct.Selection.html b/0.10.1/chemfiles/selection/struct.Selection.html new file mode 100644 index 000000000..2268a4ddb --- /dev/null +++ b/0.10.1/chemfiles/selection/struct.Selection.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Selection.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/sidebar-items.js b/0.10.1/chemfiles/sidebar-items.js new file mode 100644 index 000000000..dc3572b15 --- /dev/null +++ b/0.10.1/chemfiles/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["BondOrder","Possible bond order associated with bonds"],["CellShape","Available unit cell shapes."],["Property","A `Property` is a piece of data that can be associated with an `Atom` or a `Frame`."],["Status","Possible causes of error in chemfiles"]],"fn":[["add_configuration","Read configuration data from the file at `path`."],["formats_list","Get the list of formats known by chemfiles, as well as all associated metadata."],["guess_format","Get the format that chemfiles would use to read a file at the given `path`."],["set_warning_callback","Use `callback` for every chemfiles warning. The callback will be passed the warning message. This will drop any previous warning callback."],["version","Get the version of the chemfiles library."]],"struct":[["Atom","An `Atom` is a particle in the current `Frame`. It stores the following atomic properties:"],["AtomMut","An analog to a mutable reference to an atom (`&mut Atom`)"],["AtomRef","An analog to a reference to an atom (`&Atom`)"],["Error","Error type for Chemfiles."],["FormatMetadata","`FormatMetadata` contains metadata associated with one format."],["Frame","A `Frame` contains data from one simulation step: the current unit cell, the topology, the positions, and the velocities of the particles in the system. If some information is missing (topology or velocity or unit cell), the corresponding data is filled with a default value."],["Match","A `Match` is a set of atomic indexes matching a given selection. It can mostly be used like a `&[usize]`."],["PropertiesIter","An iterator over the properties in an atom/frame/residue"],["Residue","A `Residue` is a group of atoms belonging to the same logical unit. They can be small molecules, amino-acids in a protein, monomers in polymers, etc."],["ResidueRef","An analog to a reference to a residue (`&Residue`)"],["Selection","A `Selection` allow to select atoms in a `Frame`, from a selection language. The selection language is built by combining basic operations. Each basic operation follows the `[()] ` structure, where `` is a comparison operator in `== != < <= > >=`."],["Topology","A `Topology` contains the definition of all the atoms in the system, and the liaisons between the atoms (bonds, angles, dihedrals, …). It will also contain all the residues information if it is available."],["TopologyRef","An analog to a reference to a topology (`&Topology`)"],["Trajectory","The `Trajectory` type is the main entry point when using chemfiles. A `Trajectory` behave a bit like a file, allowing to read and/or write `Frame`."],["UnitCell","An `UnitCell` represent the box containing the atoms, and its periodicity."],["UnitCellMut","An analog to a mutable reference to an unit cell (`&mut UnitCell`)"],["UnitCellRef","An analog to a reference to an unit cell (`&UnitCell`)"]]}); \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.Atom.html b/0.10.1/chemfiles/struct.Atom.html new file mode 100644 index 000000000..332a5a287 --- /dev/null +++ b/0.10.1/chemfiles/struct.Atom.html @@ -0,0 +1,143 @@ +Atom in chemfiles - Rust + +

Struct chemfiles::Atom[][src]

pub struct Atom { /* fields omitted */ }

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
    +
  • atom name;
  • +
  • atom type;
  • +
  • atom mass;
  • +
  • atom charge.
  • +
+

The atom name is usually an unique identifier (H1, C_a) while the +atom type will be shared between all particles of the same type: H, +Ow, CH3.

+

Implementations

impl Atom[src]

pub fn new<'a>(name: impl Into<&'a str>) -> Atom[src]

Create an atom with the given name, and set the atom type to name.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

pub fn mass(&self) -> f64[src]

Get the atom mass, in atomic mass units.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

pub fn set_mass(&mut self, mass: f64)[src]

Set the atom mass to mass, in atomic mass units.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

pub fn charge(&self) -> f64[src]

Get the atom charge, in number of the electron charge e.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

pub fn set_charge(&mut self, charge: f64)[src]

Set the atom charge to charge, in number of the electron charge e.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

pub fn name(&self) -> String[src]

Get the atom name.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

pub fn atomic_type(&self) -> String[src]

Get the atom type.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

pub fn set_name<'a>(&mut self, name: impl Into<&'a str>)[src]

Set the atom name to name.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>)[src]

Set the atom type to atomic_type.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

pub fn full_name(&self) -> String[src]

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
+let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

pub fn vdw_radius(&self) -> f64[src]

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

pub fn covalent_radius(&self) -> f64[src]

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

pub fn atomic_number(&self) -> u64[src]

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

pub fn set(&mut self, name: &str, property: impl Into<Property>)[src]

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this atom, if it exist.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl Clone for Atom[src]

impl Drop for Atom[src]

Auto Trait Implementations

impl RefUnwindSafe for Atom

impl !Send for Atom

impl !Sync for Atom

impl Unpin for Atom

impl UnwindSafe for Atom

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.AtomMut.html b/0.10.1/chemfiles/struct.AtomMut.html new file mode 100644 index 000000000..5b0cea488 --- /dev/null +++ b/0.10.1/chemfiles/struct.AtomMut.html @@ -0,0 +1,124 @@ +AtomMut in chemfiles - Rust + +

Struct chemfiles::AtomMut[][src]

pub struct AtomMut<'a> { /* fields omitted */ }

An analog to a mutable reference to an atom (&mut Atom)

+

Methods from Deref<Target = Atom>

pub fn mass(&self) -> f64[src]

Get the atom mass, in atomic mass units.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

pub fn set_mass(&mut self, mass: f64)[src]

Set the atom mass to mass, in atomic mass units.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

pub fn charge(&self) -> f64[src]

Get the atom charge, in number of the electron charge e.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

pub fn set_charge(&mut self, charge: f64)[src]

Set the atom charge to charge, in number of the electron charge e.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

pub fn name(&self) -> String[src]

Get the atom name.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

pub fn atomic_type(&self) -> String[src]

Get the atom type.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

pub fn set_name<'a>(&mut self, name: impl Into<&'a str>)[src]

Set the atom name to name.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>)[src]

Set the atom type to atomic_type.

+

Example

+
+let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

pub fn full_name(&self) -> String[src]

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
+let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

pub fn vdw_radius(&self) -> f64[src]

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

pub fn covalent_radius(&self) -> f64[src]

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

pub fn atomic_number(&self) -> u64[src]

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

pub fn set(&mut self, name: &str, property: impl Into<Property>)[src]

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this atom, if it exist.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl<'a> Deref for AtomMut<'a>[src]

type Target = Atom

The resulting type after dereferencing.

+

impl<'a> DerefMut for AtomMut<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for AtomMut<'a>

impl<'a> !Send for AtomMut<'a>

impl<'a> !Sync for AtomMut<'a>

impl<'a> Unpin for AtomMut<'a>

impl<'a> !UnwindSafe for AtomMut<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.AtomRef.html b/0.10.1/chemfiles/struct.AtomRef.html new file mode 100644 index 000000000..91395a97e --- /dev/null +++ b/0.10.1/chemfiles/struct.AtomRef.html @@ -0,0 +1,84 @@ +AtomRef in chemfiles - Rust + +

Struct chemfiles::AtomRef[][src]

pub struct AtomRef<'a> { /* fields omitted */ }

An analog to a reference to an atom (&Atom)

+

Methods from Deref<Target = Atom>

pub fn mass(&self) -> f64[src]

Get the atom mass, in atomic mass units.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

pub fn charge(&self) -> f64[src]

Get the atom charge, in number of the electron charge e.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

pub fn name(&self) -> String[src]

Get the atom name.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

pub fn atomic_type(&self) -> String[src]

Get the atom type.

+

Example

+
+let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

pub fn full_name(&self) -> String[src]

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
+let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

pub fn vdw_radius(&self) -> f64[src]

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

pub fn covalent_radius(&self) -> f64[src]

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

pub fn atomic_number(&self) -> u64[src]

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
+assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this atom, if it exist.

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
+let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl<'a> Deref for AtomRef<'a>[src]

type Target = Atom

The resulting type after dereferencing.

+

Auto Trait Implementations

impl<'a> RefUnwindSafe for AtomRef<'a>

impl<'a> !Send for AtomRef<'a>

impl<'a> !Sync for AtomRef<'a>

impl<'a> Unpin for AtomRef<'a>

impl<'a> UnwindSafe for AtomRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.Error.html b/0.10.1/chemfiles/struct.Error.html new file mode 100644 index 000000000..0a884622d --- /dev/null +++ b/0.10.1/chemfiles/struct.Error.html @@ -0,0 +1,41 @@ +Error in chemfiles - Rust + +

Struct chemfiles::Error[][src]

pub struct Error {
+    pub status: Status,
+    pub message: String,
+}

Error type for Chemfiles.

+

+ Fields

status: Status

The error status code

+
message: String

A message describing the error cause

+

Implementations

impl Error[src]

pub fn last_error() -> String[src]

Get the last error message from the C++ library.

+

pub fn cleanup()[src]

Clear any error from the C++ library

+

Trait Implementations

impl Clone for Error[src]

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

impl From<Utf8Error> for Error[src]

impl From<chfl_status> for Error[src]

impl PartialEq<Error> for Error[src]

impl StructuralPartialEq for Error[src]

Auto Trait Implementations

impl RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl UnwindSafe for Error

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.FormatMetadata.html b/0.10.1/chemfiles/struct.FormatMetadata.html new file mode 100644 index 000000000..cad3fc993 --- /dev/null +++ b/0.10.1/chemfiles/struct.FormatMetadata.html @@ -0,0 +1,53 @@ +FormatMetadata in chemfiles - Rust + +

Struct chemfiles::FormatMetadata[][src]

pub struct FormatMetadata {
Show fields + pub name: &'static str, + pub extension: Option<&'static str>, + pub description: &'static str, + pub reference: &'static str, + pub read: bool, + pub write: bool, + pub memory: bool, + pub positions: bool, + pub velocities: bool, + pub unit_cell: bool, + pub atoms: bool, + pub bonds: bool, + pub residues: bool, +
}

FormatMetadata contains metadata associated with one format.

+

+ Fields

name: &'static str

Name of the format.

+
extension: Option<&'static str>

Extension associated with the format.

+
description: &'static str

Extended, user-facing description of the format.

+
reference: &'static str

URL pointing to the format definition/reference.

+
read: bool

Is reading files in this format implemented?

+
write: bool

Is writing files in this format implemented?

+
memory: bool

Does this format support in-memory IO?

+
positions: bool

Does this format support storing atomic positions?

+
velocities: bool

Does this format support storing atomic velocities?

+
unit_cell: bool

Does this format support storing unit cell information?

+
atoms: bool

Does this format support storing atom names or types?

+
bonds: bool

Does this format support storing bonds between atoms?

+
residues: bool

Does this format support storing residues?

+

Trait Implementations

impl Clone for FormatMetadata[src]

impl Debug for FormatMetadata[src]

impl PartialEq<FormatMetadata> for FormatMetadata[src]

impl Eq for FormatMetadata[src]

impl StructuralEq for FormatMetadata[src]

impl StructuralPartialEq for FormatMetadata[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.Frame.html b/0.10.1/chemfiles/struct.Frame.html new file mode 100644 index 000000000..1f28c9e59 --- /dev/null +++ b/0.10.1/chemfiles/struct.Frame.html @@ -0,0 +1,388 @@ +Frame in chemfiles - Rust + +

Struct chemfiles::Frame[][src]

pub struct Frame { /* fields omitted */ }

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

Implementations

impl Frame[src]

pub fn new() -> Frame[src]

Create an empty frame. It will be resized by the library as needed.

+

Example

+
+let frame = Frame::new();
+
+assert_eq!(frame.size(), 0);
+

pub fn atom(&self, index: usize) -> AtomRef<'_>[src]

Get a reference to the atom at the given index in this frame.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+let atom = frame.atom(0);
+assert_eq!(atom.name(), "Zn");
+

pub fn atom_mut(&mut self, index: usize) -> AtomMut<'_>[src]

Get a mutable reference to the atom at the given index in this frame.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+assert_eq!(frame.atom(0).name(), "Zn");
+
+frame.atom_mut(0).set_name("Fe");
+assert_eq!(frame.atom(0).name(), "Fe");
+

pub fn size(&self) -> usize[src]

Get the current number of atoms in this frame.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.size(), 0);
+
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

pub fn resize(&mut self, natoms: usize)[src]

Resize the positions and the velocities in this frame, to make space for +natoms atoms. Previous data is conserved, as well as the presence of +absence of velocities.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

pub fn add_atom(
    &mut self,
    atom: &Atom,
    position: [f64; 3],
    velocity: impl Into<Option<[f64; 3]>>
)
[src]

Add an Atom and the corresponding position and optionally velocity +data to this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+
+frame.add_velocities();
+frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+

pub fn remove(&mut self, i: usize)[src]

Remove the atom at index i in this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+assert_eq!(frame.size(), 3);
+
+frame.remove(1);
+assert_eq!(frame.size(), 2);
+assert_eq!(frame.atom(1).name(), "Sn");
+

pub fn add_bond(&mut self, i: usize, j: usize)[src]

Add a bond between the atoms at indexes i and j in the frame.

+

The bond order is set to BondOrder::Unknown.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+assert_eq!(frame.topology().bonds_count(), 3);
+
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+

pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder)[src]

Add a bond between the atoms at indexes i and j in the frame +with the given bond order.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(2);
+
+frame.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+

pub fn remove_bond(&mut self, i: usize, j: usize)[src]

Remove any existing bond between the atoms at indexes i and j in +the frame.

+

This function does nothing if there is no bond between i and j.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+
+frame.remove_bond(2, 4);
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+

pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error>[src]

Add a copy of residue to this frame.

+

Errors

+

This function fails is the residue id is already in this frame’s +topology, or if the residue contain atoms that are already in another +residue.

+

Example

+
+let mut frame = Frame::new();
+
+let residue = Residue::new("foo");
+frame.add_residue(&residue).unwrap();
+
+let topology = frame.topology();
+assert_eq!(topology.residues_count(), 1);
+assert_eq!(topology.residue(0).unwrap().name(), "foo");
+

pub fn distance(&self, i: usize, j: usize) -> f64[src]

Get the distance between the atoms at indexes i and j in this frame, +accounting for periodic boundary conditions. The result is expressed in +Angstroms.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+
+assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+

pub fn angle(&self, i: usize, j: usize, k: usize) -> f64[src]

Get the angle formed by the atoms at indexes i, j and k in this +frame, accounting for periodic boundary conditions. The result is +expressed in radians.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+

pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64[src]

Get the dihedral angle formed by the atoms at indexes i, j, k and +m in this frame, accounting for periodic boundary conditions. The +result is expressed in radians.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+
+assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+

pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64[src]

Get the out of plane distance formed by the atoms at indexes i, j, +k and m in this frame, accounting for periodic boundary conditions. +The result is expressed in angstroms.

+

This is the distance between the atom j and the ikm plane. The j atom +is the center of the improper dihedral angle formed by i, j, k and m.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+

pub fn positions(&self) -> &[[f64; 3]][src]

Get a view into the positions of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+
+let positions = frame.positions();
+assert_eq!(positions.len(), 67);
+assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+

pub fn positions_mut(&mut self) -> &mut [[f64; 3]][src]

Get a mutable view into the positions of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+{
+    let positions = frame.positions_mut();
+    assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    positions[0] = [1.0, 2.0, 3.0];
+}
+
+let positions = frame.positions();
+assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+

pub fn velocities(&self) -> &[[f64; 3]][src]

Get a view into the velocities of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+
+let velocities = frame.velocities();
+assert_eq!(velocities.len(), 67);
+assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+

pub fn velocities_mut(&mut self) -> &mut [[f64; 3]][src]

Get a mutable view into the velocities of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+{
+    let velocities = frame.velocities_mut();
+    assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    velocities[0] = [1.0, 2.0, 3.0];
+}
+
+let velocities = frame.velocities();
+assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+

pub fn has_velocities(&self) -> bool[src]

Check if this frame contains velocity data.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

pub fn add_velocities(&mut self)[src]

Add velocity data to this frame. If the frame already have velocities, +this does nothing.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

pub fn cell(&self) -> UnitCellRef<'_>[src]

Get a reference to the UnitCell from this frame.

+

Example

+
+let frame = Frame::new();
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Infinite);
+

pub fn cell_mut(&mut self) -> UnitCellMut<'_>[src]

Get a mutable reference to the UnitCell from this frame.

+

Example

+
+let mut frame = Frame::new();
+
+assert_eq!(frame.cell().shape(), CellShape::Infinite);
+
+frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+

pub fn set_cell(&mut self, cell: &UnitCell)[src]

Set the UnitCell of this frame to cell.

+

Example

+
+let mut frame = Frame::new();
+
+frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+

pub fn topology(&self) -> TopologyRef<'_>[src]

Get a reference to the Topology of this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(42);
+
+let topology = frame.topology();
+assert_eq!(topology.size(), 42);
+

pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error>[src]

Set the Topology of this frame to topology.

+

Errors

+

This function fails if the topology contains a different number of atoms +than this frame.

+

Example

+
+let mut frame = Frame::new();
+frame.resize(2);
+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Cl"));
+topology.add_atom(&Atom::new("Cl"));
+topology.add_bond(0, 1);
+
+frame.set_topology(&topology).unwrap();
+assert_eq!(frame.atom(0).name(), "Cl");
+

pub fn step(&self) -> usize[src]

Get this frame step, i.e. the frame number in the trajectory

+

Example

+
+let frame = Frame::new();
+assert_eq!(frame.step(), 0);
+

pub fn set_step(&mut self, step: usize)[src]

Set this frame step to step.

+

Example

+
+let mut frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
+frame.set_step(10);
+assert_eq!(frame.step(), 10);
+

pub fn guess_bonds(&mut self) -> Result<(), Error>[src]

Guess the bonds, angles and dihedrals in this frame.

+

The bonds are guessed using a distance-based algorithm, and then angles +and dihedrals are guessed from the bonds.

+

Errors

+

This function can fail if the covalent radius is unknown for some atoms +in the frame.

+

Example

+
+let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+assert_eq!(frame.topology().bonds_count(), 0);
+
+frame.guess_bonds().unwrap();
+assert_eq!(frame.topology().bonds_count(), 1);
+

pub fn clear_bonds(&mut self)[src]

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology of the frame.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+
+frame.add_bond(0, 1);
+frame.add_bond(1, 2);
+
+assert_eq!(frame.topology().bonds().len(), 2);
+assert_eq!(frame.topology().angles().len(), 1);
+
+frame.clear_bonds();
+assert!(frame.topology().bonds().is_empty());
+assert!(frame.topology().angles().is_empty());
+

pub fn set(&mut self, name: &str, property: impl Into<Property>)[src]

Add a new property with the given name to this frame.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
+let mut frame = Frame::new();
+frame.set("a string", "hello");
+frame.set("a double", 4.3);
+
+assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this frame, if it exist.

+

Examples

+
+let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+
+assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(frame.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
+let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+frame.set("bar", Property::Bool(false));
+
+for (name, property) in frame.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl Clone for Frame[src]

impl Drop for Frame[src]

Auto Trait Implementations

impl RefUnwindSafe for Frame

impl !Send for Frame

impl !Sync for Frame

impl Unpin for Frame

impl UnwindSafe for Frame

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.Match.html b/0.10.1/chemfiles/struct.Match.html new file mode 100644 index 000000000..5d808bc0a --- /dev/null +++ b/0.10.1/chemfiles/struct.Match.html @@ -0,0 +1,57 @@ +Match in chemfiles - Rust + +

Struct chemfiles::Match[][src]

pub struct Match { /* fields omitted */ }

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

Implementations

impl Match[src]

pub fn len(&self) -> usize[src]

Get the length of the Match.

+

Example

+
+let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+

pub fn new(atoms: &[usize]) -> Match[src]

Create a new match containing the atoms in the atoms slice.

+

Panics

+

If the slice contains more than 4 elements, which is the maximal size +of a match.

+

Example

+
+let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+assert_eq!(atomic_match[0], 3);
+assert_eq!(atomic_match[1], 4);
+assert_eq!(atomic_match[2], 5);
+

pub fn iter(&self) -> Iter<'_, usize>[src]

Iterate over the atomic indexes in the match.

+

Example

+
+let atomic_match = Match::new(&[3, 4, 5]);
+let mut iter = atomic_match.iter();
+
+assert_eq!(iter.next(), Some(&3));
+assert_eq!(iter.next(), Some(&4));
+assert_eq!(iter.next(), Some(&5));
+assert_eq!(iter.next(), None);
+

Trait Implementations

impl Clone for Match[src]

impl Debug for Match[src]

impl Index<usize> for Match[src]

type Output = usize

The returned type after indexing.

+

impl<'a> IntoIterator for &'a Match[src]

type Item = &'a usize

The type of the elements being iterated over.

+

type IntoIter = Iter<'a, usize>

Which kind of iterator are we turning this into?

+

impl PartialEq<Match> for Match[src]

impl Eq for Match[src]

impl StructuralEq for Match[src]

impl StructuralPartialEq for Match[src]

Auto Trait Implementations

impl RefUnwindSafe for Match

impl Send for Match

impl Sync for Match

impl Unpin for Match

impl UnwindSafe for Match

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.PropertiesIter.html b/0.10.1/chemfiles/struct.PropertiesIter.html new file mode 100644 index 000000000..d4cdec195 --- /dev/null +++ b/0.10.1/chemfiles/struct.PropertiesIter.html @@ -0,0 +1,135 @@ +PropertiesIter in chemfiles - Rust + +

Struct chemfiles::PropertiesIter[][src]

pub struct PropertiesIter<'a> { /* fields omitted */ }

An iterator over the properties in an atom/frame/residue

+

Trait Implementations

impl<'a> Iterator for PropertiesIter<'a>[src]

type Item = (String, Property)

The type of the elements being iterated over.

+

Auto Trait Implementations

impl<'a> !RefUnwindSafe for PropertiesIter<'a>

impl<'a> !Send for PropertiesIter<'a>

impl<'a> !Sync for PropertiesIter<'a>

impl<'a> Unpin for PropertiesIter<'a>

impl<'a> !UnwindSafe for PropertiesIter<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

+

type IntoIter = I

Which kind of iterator are we turning this into?

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.Residue.html b/0.10.1/chemfiles/struct.Residue.html new file mode 100644 index 000000000..0427271a1 --- /dev/null +++ b/0.10.1/chemfiles/struct.Residue.html @@ -0,0 +1,120 @@ +Residue in chemfiles - Rust + +

Struct chemfiles::Residue[][src]

pub struct Residue { /* fields omitted */ }

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

Implementations

impl Residue[src]

pub fn new<'a>(name: impl Into<&'a str>) -> Residue[src]

Create a new residue with the given name

+

Example

+
+let residue = Residue::new("ALA");
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), None);
+

pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue[src]

Create a new residue with the given name and id as identifier.

+

Example

+
+let residue = Residue::with_id("ALA", 67);
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), Some(67));
+

pub fn size(&self) -> usize[src]

Get the number of atoms in this residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

pub fn id(&self) -> Option<i64>[src]

Get the identifier of this residue in the initial topology file.

+

Example

+
+let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

pub fn name(&self) -> String[src]

Get the name of this residue.

+

Example

+
+let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

pub fn add_atom(&mut self, atom: usize)[src]

Add the atom at index atom in this residue.

+

This will fail if the atom is already in the residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+assert_eq!(residue.contains(56), true);
+
+// Adding the same atom twice is fine
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+

pub fn contains(&self, atom: usize) -> bool[src]

Check if the atom at index i is in this residue

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

pub fn atoms(&self) -> Vec<usize>[src]

Get the list of atoms of this residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

pub fn set(&mut self, name: &str, property: impl Into<Property>)[src]

Add a new property with the given name to this residue.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("a string", "hello");
+residue.set("a double", 3.2);
+
+assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this frame, if it exist.

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl Clone for Residue[src]

impl Drop for Residue[src]

Auto Trait Implementations

impl RefUnwindSafe for Residue

impl !Send for Residue

impl !Sync for Residue

impl Unpin for Residue

impl UnwindSafe for Residue

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.ResidueRef.html b/0.10.1/chemfiles/struct.ResidueRef.html new file mode 100644 index 000000000..81fe17afb --- /dev/null +++ b/0.10.1/chemfiles/struct.ResidueRef.html @@ -0,0 +1,75 @@ +ResidueRef in chemfiles - Rust + +

Struct chemfiles::ResidueRef[][src]

pub struct ResidueRef<'a> { /* fields omitted */ }

An analog to a reference to a residue (&Residue)

+

Methods from Deref<Target = Residue>

pub fn size(&self) -> usize[src]

Get the number of atoms in this residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

pub fn id(&self) -> Option<i64>[src]

Get the identifier of this residue in the initial topology file.

+

Example

+
+let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

pub fn name(&self) -> String[src]

Get the name of this residue.

+

Example

+
+let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

pub fn contains(&self, atom: usize) -> bool[src]

Check if the atom at index i is in this residue

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

pub fn atoms(&self) -> Vec<usize>[src]

Get the list of atoms of this residue.

+

Example

+
+let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

pub fn get(&self, name: &str) -> Option<Property>[src]

Get a property with the given name in this frame, if it exist.

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

pub fn properties(&self) -> PropertiesIter<'_>

Notable traits for PropertiesIter<'a>

impl<'a> Iterator for PropertiesIter<'a> type Item = (String, Property);
[src]

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
+let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

impl<'a> Deref for ResidueRef<'a>[src]

type Target = Residue

The resulting type after dereferencing.

+

Auto Trait Implementations

impl<'a> RefUnwindSafe for ResidueRef<'a>

impl<'a> !Send for ResidueRef<'a>

impl<'a> !Sync for ResidueRef<'a>

impl<'a> Unpin for ResidueRef<'a>

impl<'a> UnwindSafe for ResidueRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.Selection.html b/0.10.1/chemfiles/struct.Selection.html new file mode 100644 index 000000000..27be86def --- /dev/null +++ b/0.10.1/chemfiles/struct.Selection.html @@ -0,0 +1,83 @@ +Selection in chemfiles - Rust + +

Struct chemfiles::Selection[][src]

pub struct Selection { /* fields omitted */ }

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

Implementations

impl Selection[src]

pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error>[src]

Create a new selection from the given selection string.

+

Errors

+

This function fails if the selection string is invalid.

+

Example

+
+let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+

pub fn size(&self) -> usize[src]

Get the size of the selection, i.e. the number of atoms we are selecting +together.

+

This value is 1 for the ‘atom’ context, 2 for the ‘pair’ and ‘bond’ +context, 3 for the ‘three’ and ‘angles’ context and 4 for the ‘four’ +and ‘dihedral’ context.

+

Example

+
+let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+assert_eq!(selection.size(), 2);
+

pub fn string(&self) -> String[src]

Get the selection string used to create this selection.

+

Example

+
+let selection = Selection::new("name H").unwrap();
+assert_eq!(selection.string(), "name H");
+

pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match>[src]

Evaluate a selection for a given frame, and return the corresponding +matches.

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+let matches = selection.evaluate(&frame);
+
+assert_eq!(matches.len(), 2);
+
+assert_eq!(matches[0].len(), 2);
+assert_eq!(matches[0][0], 0);
+assert_eq!(matches[0][1], 1);
+
+assert_eq!(matches[1].len(), 2);
+assert_eq!(matches[1][0], 2);
+assert_eq!(matches[1][1], 1);
+

pub fn list(&mut self, frame: &Frame) -> Vec<usize>[src]

Evaluates a selection of size 1 on a given frame. This function +returns the list of atomic indexes in the frame matching this selection.

+

Panics

+

If the selection size is not 1

+

Example

+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("name H").unwrap();
+let matches = selection.list(&frame);
+
+assert_eq!(matches.len(), 2);
+assert_eq!(matches[0], 0);
+assert_eq!(matches[1], 2);
+

Trait Implementations

impl Clone for Selection[src]

impl Drop for Selection[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.Topology.html b/0.10.1/chemfiles/struct.Topology.html new file mode 100644 index 000000000..7f502c4a0 --- /dev/null +++ b/0.10.1/chemfiles/struct.Topology.html @@ -0,0 +1,312 @@ +Topology in chemfiles - Rust + +

Struct chemfiles::Topology[][src]

pub struct Topology { /* fields omitted */ }

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

Implementations

impl Topology[src]

pub fn new() -> Topology[src]

Create a new empty topology.

+

Example

+
+let topology = Topology::new();
+assert_eq!(topology.size(), 0);
+

pub fn atom(&self, index: usize) -> AtomRef<'_>[src]

Get a reference of the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

pub fn atom_mut(&mut self, index: usize) -> AtomMut<'_>[src]

Get a mutable reference to the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(6);
+
+assert_eq!(topology.atom(4).name(), "");
+
+topology.atom_mut(4).set_name("Fe");
+assert_eq!(topology.atom(4).name(), "Fe");
+

pub fn size(&self) -> usize[src]

Get the current number of atoms in this topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

pub fn resize(&mut self, natoms: usize)[src]

Resize this topology to hold natoms atoms, inserting dummy atoms if +the new size if bigger than the old one.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

pub fn add_atom(&mut self, atom: &Atom)[src]

Add an Atom at the end of this topology

+

Example

+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Mg"));
+
+let atom = topology.atom(0);
+assert_eq!(atom.name(), "Mg");
+

pub fn remove(&mut self, index: usize)[src]

Remove an Atom from this topology by index. This modify all the +other atoms indexes.

+

Panics

+

If the index is out of bounds

+

Example

+
+let mut topology = Topology::new();
+topology.resize(9);
+assert_eq!(topology.size(), 9);
+
+topology.remove(7);
+assert_eq!(topology.size(), 8);
+

pub fn bonds_count(&self) -> usize[src]

Get the number of bonds in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

pub fn angles_count(&self) -> usize[src]

Get the number of angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

pub fn dihedrals_count(&self) -> usize[src]

Get the number of dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

pub fn impropers_count(&self) -> usize[src]

Get the number of improper dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

pub fn bonds(&self) -> Vec<[usize; 2]>[src]

Get the list of bonds in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

pub fn angles(&self) -> Vec<[usize; 3]>[src]

Get the list of angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

pub fn dihedrals(&self) -> Vec<[usize; 4]>[src]

Get the list of dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

pub fn impropers(&self) -> Vec<[usize; 4]>[src]

Get the list of improper dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

pub fn clear_bonds(&mut self)[src]

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+assert_eq!(topology.angles().len(), 1);
+
+topology.clear_bonds();
+assert!(topology.bonds().is_empty());
+assert!(topology.angles().is_empty());
+

pub fn add_bond(&mut self, i: usize, j: usize)[src]

Add a bond between the atoms at indexes i and j in the topology.

+

The bond order is set to BondOrder::Unknown.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+

pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder)[src]

Add a bond between the atoms at indexes i and j in the topology +with the given bond order.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

pub fn bond_order(&self, i: usize, j: usize) -> BondOrder[src]

Get the bond order for the bond between the atoms at indexes i and +j.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

pub fn bond_orders(&self) -> Vec<BondOrder>[src]

Get the bond order for all the bonds in the topology

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

pub fn remove_bond(&mut self, i: usize, j: usize)[src]

Remove any existing bond between the atoms at indexes i and j in +this topology.

+

This function does nothing if there is no bond between i and j.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+topology.remove_bond(0, 1);
+assert_eq!(topology.bonds_count(), 1);
+
+// Removing a bond that does not exists is fine
+topology.remove_bond(0, 2);
+assert_eq!(topology.bonds_count(), 1);
+

pub fn residue(&self, index: u64) -> Option<ResidueRef<'_>>[src]

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+

Example

+
+let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef<'_>>[src]

Get a copy of the residue containing the atom at index index in this +topology, if any.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

pub fn residues_count(&self) -> u64[src]

Get the number of residues in this topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error>[src]

Add a residue to this topology.

+

Errors

+

This function fails is the residue id is not already in the topology, +or if the residue contains atoms that are already in another residue.

+

Example

+
+let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool[src]

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+

Example

+
+let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

impl Clone for Topology[src]

impl Drop for Topology[src]

Auto Trait Implementations

impl RefUnwindSafe for Topology

impl !Send for Topology

impl !Sync for Topology

impl Unpin for Topology

impl UnwindSafe for Topology

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.TopologyRef.html b/0.10.1/chemfiles/struct.TopologyRef.html new file mode 100644 index 000000000..ecd329b7b --- /dev/null +++ b/0.10.1/chemfiles/struct.TopologyRef.html @@ -0,0 +1,191 @@ +TopologyRef in chemfiles - Rust + +

Struct chemfiles::TopologyRef[][src]

pub struct TopologyRef<'a> { /* fields omitted */ }

An analog to a reference to a topology (&Topology)

+

Methods from Deref<Target = Topology>

pub fn atom(&self, index: usize) -> AtomRef<'_>[src]

Get a reference of the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

pub fn size(&self) -> usize[src]

Get the current number of atoms in this topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

pub fn bonds_count(&self) -> usize[src]

Get the number of bonds in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

pub fn angles_count(&self) -> usize[src]

Get the number of angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

pub fn dihedrals_count(&self) -> usize[src]

Get the number of dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

pub fn impropers_count(&self) -> usize[src]

Get the number of improper dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

pub fn bonds(&self) -> Vec<[usize; 2]>[src]

Get the list of bonds in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

pub fn angles(&self) -> Vec<[usize; 3]>[src]

Get the list of angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

pub fn dihedrals(&self) -> Vec<[usize; 4]>[src]

Get the list of dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

pub fn impropers(&self) -> Vec<[usize; 4]>[src]

Get the list of improper dihedral angles in the topology.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

pub fn bond_order(&self, i: usize, j: usize) -> BondOrder[src]

Get the bond order for the bond between the atoms at indexes i and +j.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

pub fn bond_orders(&self) -> Vec<BondOrder>[src]

Get the bond order for all the bonds in the topology

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

pub fn residue(&self, index: u64) -> Option<ResidueRef<'_>>[src]

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+

Example

+
+let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef<'_>>[src]

Get a copy of the residue containing the atom at index index in this +topology, if any.

+

Example

+
+let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

pub fn residues_count(&self) -> u64[src]

Get the number of residues in this topology.

+

Example

+
+let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool[src]

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+

Example

+
+let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

impl<'a> Deref for TopologyRef<'a>[src]

type Target = Topology

The resulting type after dereferencing.

+

Auto Trait Implementations

impl<'a> RefUnwindSafe for TopologyRef<'a>

impl<'a> !Send for TopologyRef<'a>

impl<'a> !Sync for TopologyRef<'a>

impl<'a> Unpin for TopologyRef<'a>

impl<'a> UnwindSafe for TopologyRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.Trajectory.html b/0.10.1/chemfiles/struct.Trajectory.html new file mode 100644 index 000000000..acffd2a50 --- /dev/null +++ b/0.10.1/chemfiles/struct.Trajectory.html @@ -0,0 +1,175 @@ +Trajectory in chemfiles - Rust + +

Struct chemfiles::Trajectory[][src]

pub struct Trajectory { /* fields omitted */ }

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

Implementations

impl Trajectory[src]

pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error> where
    P: AsRef<Path>, 
[src]

Open the file at the given path in the given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Errors

+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+

Example

+
+let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+

pub fn open_with_format<'a, P, S>(
    filename: P,
    mode: char,
    format: S
) -> Result<Trajectory, Error> where
    P: AsRef<Path>,
    S: Into<&'a str>, 
[src]

Open the file at the given path using a specific file format and the +given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Specifying a format is needed when the file format does not match the +extension, or when there is not standard extension for this format. If +format is an empty string, the format will be guessed from the +extension.

+

Errors

+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+

Example

+
+let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+

pub fn memory_reader<'a, S>(data: S, format: S) -> Result<Trajectory, Error> where
    S: Into<&'a str>, 
[src]

Read a memory buffer as though it was a formatted file.

+

The memory buffer used to store the file is given using the data +argument. The format parameter is required and should follow the same +rules as in the main Trajectory constructor.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format, or if the format do not support in-memory readers.

+

Example

+
+let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+let mut frame = Frame::new();
+trajectory.read(&mut frame).unwrap();
+assert_eq!(frame.size(), 6);
+

pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error> where
    S: Into<&'a str>, 
[src]

Write to a memory buffer as though it was a formatted file.

+

The format parameter should follow the same rules as in the main +Trajectory constructor, except that compression specification +is not supported.

+

The memory_buffer function can be used to retrieve the data written +to memory of the Trajectory.

+

Errors

+

This function fails if the format do not support in-memory writers.

+

Example

+
+let trajectory_memory = Trajectory::memory_writer("SMI");
+
+// Binary formats typically do not support this feature
+assert!(Trajectory::memory_writer("XTC").is_err());
+

pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error>[src]

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+

Example

+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+

pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error>[src]

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format.

+

Example

+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+

pub fn write(&mut self, frame: &Frame) -> Result<(), Error>[src]

Write a frame to this trajectory.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format.

+

Example

+
+let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+

pub fn set_topology(&mut self, topology: &Topology)[src]

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+

Example

+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+

pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error> where
    P: AsRef<Path>, 
[src]

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+

Errors

+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+

Example

+
+let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+

pub fn set_topology_with_format<'a, P, S>(
    &mut self,
    path: P,
    format: S
) -> Result<(), Error> where
    P: AsRef<Path>,
    S: Into<&'a str>, 
[src]

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+

Errors

+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+

Example

+
+let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+

pub fn set_cell(&mut self, cell: &UnitCell)[src]

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+

Example

+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+

pub fn nsteps(&mut self) -> usize[src]

Get the number of steps (the number of frames) in a trajectory.

+

Example

+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+

pub fn memory_buffer(&self) -> Result<&str, Error>[src]

Obtain the memory buffer written to by the trajectory.

+

Errors

+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+

Example

+
+let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+

pub fn path(&self) -> String[src]

Get file path for this trajectory.

+

Example

+
+let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations

impl Drop for Trajectory[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.UnitCell.html b/0.10.1/chemfiles/struct.UnitCell.html new file mode 100644 index 000000000..42264b72f --- /dev/null +++ b/0.10.1/chemfiles/struct.UnitCell.html @@ -0,0 +1,167 @@ +UnitCell in chemfiles - Rust + +

Struct chemfiles::UnitCell[][src]

pub struct UnitCell { /* fields omitted */ }

An UnitCell represent the box containing the atoms, and its periodicity.

+

An unit cell is fully represented by three lengths (a, b, c); and three +angles (alpha, beta, gamma). The angles are stored in degrees, and the +lengths in Angstroms.

+

A cell also has a matricial representation, by projecting the three base +vector into an orthonormal base. We choose to represent such matrix as an +upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
+

Implementations

impl UnitCell[src]

pub fn new(lengths: [f64; 3]) -> UnitCell[src]

Create an Orthorhombic UnitCell from the three lengths, in Angstroms.

+

Example

+
+let cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn infinite() -> UnitCell[src]

Create an Infinite UnitCell.

+

Example

+
+let cell = UnitCell::infinite();
+
+assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Infinite);
+

pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell[src]

Create an Triclinic UnitCell from the three lengths (in Angstroms) +and three angles (in degree). alpha is the angle between the vectors +b and c; beta is the between the vectors a and c and gamma +is the angle between the vectors a and b.

+

Example

+
+let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+assert_eq!(cell.angles()[0], 98.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

pub fn from_matrix(matrix: [[f64; 3]; 3]) -> UnitCell[src]

Create an UnitCell from a cell matrix. If matrix contains only +zeros, then an Infinite cell is created. If only the diagonal of the +matrix is non-zero, then the cell is Orthorhombic. Else a +Triclinic cell is created. The matrix entries should be in Angstroms.

+

Panics

+

If the matrix has a negative determinant, or more generally is not +representing a unit cell.

+

Example

+
+let cell = UnitCell::from_matrix([
+    [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+]);
+
+assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn lengths(&self) -> [f64; 3][src]

Get the three lengths of the cell, in Angstroms.

+

Example

+
+let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error>[src]

Set the three lengths of the cell, in Angstroms.

+

Errors

+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+

Example

+
+let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

pub fn angles(&self) -> [f64; 3][src]

Get the three angles of the cell, in degrees.

+

Example

+
+let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error>[src]

Set the three angles of the cell, in degrees.

+

Errors

+

This function fails if the unit cell is not Triclinic.

+

Example

+
+let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

pub fn matrix(&self) -> [[f64; 3]; 3][src]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

pub fn shape(&self) -> CellShape[src]

Get the shape of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error>[src]

Set the shape of the unit cell to shape.

+

Errors

+

This can fail if the cell length or angles are incompatible with the +new shape.

+

Example

+
+let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

pub fn volume(&self) -> f64[src]

Get the volume of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

pub fn wrap(&self, vector: &mut [f64; 3])[src]

Wrap a vector in this unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

impl Clone for UnitCell[src]

impl Drop for UnitCell[src]

Auto Trait Implementations

impl RefUnwindSafe for UnitCell

impl !Send for UnitCell

impl !Sync for UnitCell

impl Unpin for UnitCell

impl UnwindSafe for UnitCell

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

+

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.UnitCellMut.html b/0.10.1/chemfiles/struct.UnitCellMut.html new file mode 100644 index 000000000..055fb5109 --- /dev/null +++ b/0.10.1/chemfiles/struct.UnitCellMut.html @@ -0,0 +1,107 @@ +UnitCellMut in chemfiles - Rust + +

Struct chemfiles::UnitCellMut[][src]

pub struct UnitCellMut<'a> { /* fields omitted */ }

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

Methods from Deref<Target = UnitCell>

pub fn lengths(&self) -> [f64; 3][src]

Get the three lengths of the cell, in Angstroms.

+

Example

+
+let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error>[src]

Set the three lengths of the cell, in Angstroms.

+

Errors

+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+

Example

+
+let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

pub fn angles(&self) -> [f64; 3][src]

Get the three angles of the cell, in degrees.

+

Example

+
+let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error>[src]

Set the three angles of the cell, in degrees.

+

Errors

+

This function fails if the unit cell is not Triclinic.

+

Example

+
+let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

pub fn matrix(&self) -> [[f64; 3]; 3][src]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

pub fn shape(&self) -> CellShape[src]

Get the shape of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error>[src]

Set the shape of the unit cell to shape.

+

Errors

+

This can fail if the cell length or angles are incompatible with the +new shape.

+

Example

+
+let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

pub fn volume(&self) -> f64[src]

Get the volume of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

pub fn wrap(&self, vector: &mut [f64; 3])[src]

Wrap a vector in this unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

impl<'a> Deref for UnitCellMut<'a>[src]

type Target = UnitCell

The resulting type after dereferencing.

+

impl<'a> DerefMut for UnitCellMut<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for UnitCellMut<'a>

impl<'a> !Send for UnitCellMut<'a>

impl<'a> !Sync for UnitCellMut<'a>

impl<'a> Unpin for UnitCellMut<'a>

impl<'a> !UnwindSafe for UnitCellMut<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/struct.UnitCellRef.html b/0.10.1/chemfiles/struct.UnitCellRef.html new file mode 100644 index 000000000..848d752fc --- /dev/null +++ b/0.10.1/chemfiles/struct.UnitCellRef.html @@ -0,0 +1,70 @@ +UnitCellRef in chemfiles - Rust + +

Struct chemfiles::UnitCellRef[][src]

pub struct UnitCellRef<'a> { /* fields omitted */ }

An analog to a reference to an unit cell (&UnitCell)

+

Methods from Deref<Target = UnitCell>

pub fn lengths(&self) -> [f64; 3][src]

Get the three lengths of the cell, in Angstroms.

+

Example

+
+let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

pub fn angles(&self) -> [f64; 3][src]

Get the three angles of the cell, in degrees.

+

Example

+
+let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

pub fn matrix(&self) -> [[f64; 3]; 3][src]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

pub fn shape(&self) -> CellShape[src]

Get the shape of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

pub fn volume(&self) -> f64[src]

Get the volume of the unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

pub fn wrap(&self, vector: &mut [f64; 3])[src]

Wrap a vector in this unit cell.

+

Example

+
+let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

impl<'a> Deref for UnitCellRef<'a>[src]

type Target = UnitCell

The resulting type after dereferencing.

+

Auto Trait Implementations

impl<'a> RefUnwindSafe for UnitCellRef<'a>

impl<'a> !Send for UnitCellRef<'a>

impl<'a> !Sync for UnitCellRef<'a>

impl<'a> Unpin for UnitCellRef<'a>

impl<'a> UnwindSafe for UnitCellRef<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

+

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

+
+ \ No newline at end of file diff --git a/0.10.1/chemfiles/topology/enum.BondOrder.html b/0.10.1/chemfiles/topology/enum.BondOrder.html new file mode 100644 index 000000000..cb0d340ce --- /dev/null +++ b/0.10.1/chemfiles/topology/enum.BondOrder.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.BondOrder.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/topology/struct.Topology.html b/0.10.1/chemfiles/topology/struct.Topology.html new file mode 100644 index 000000000..53c3a8234 --- /dev/null +++ b/0.10.1/chemfiles/topology/struct.Topology.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Topology.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/topology/struct.TopologyRef.html b/0.10.1/chemfiles/topology/struct.TopologyRef.html new file mode 100644 index 000000000..1a31a3219 --- /dev/null +++ b/0.10.1/chemfiles/topology/struct.TopologyRef.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.TopologyRef.html...

+ + + \ No newline at end of file diff --git a/0.10.1/chemfiles/trajectory/struct.Trajectory.html b/0.10.1/chemfiles/trajectory/struct.Trajectory.html new file mode 100644 index 000000000..8d4845dd3 --- /dev/null +++ b/0.10.1/chemfiles/trajectory/struct.Trajectory.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Trajectory.html...

+ + + \ No newline at end of file diff --git a/0.10.1/crates.js b/0.10.1/crates.js new file mode 100644 index 000000000..833ec8f70 --- /dev/null +++ b/0.10.1/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["chemfiles"]; \ No newline at end of file diff --git a/0.10.1/dark.css b/0.10.1/dark.css new file mode 100644 index 000000000..d606c8e21 --- /dev/null +++ b/0.10.1/dark.css @@ -0,0 +1 @@ +body{background-color:#353535;color:#ddd;}h1,h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){color:#ddd;}h1.fqn{border-bottom-color:#d2d2d2;}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){border-bottom-color:#d2d2d2;}.in-band{background-color:#353535;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#2A2A2A;}pre{background-color:#2A2A2A;}.sidebar{background-color:#505050;}.logo-container.rust-logo>img{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}*{scrollbar-color:rgb(64,65,67) #717171;}.sidebar{scrollbar-color:rgba(32,34,37,.6) transparent;}::-webkit-scrollbar-track{background-color:#717171;}::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar::-webkit-scrollbar-track{background-color:#717171;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar .current{background-color:#333;}.source .sidebar{background-color:#353535;}.sidebar .location{border-color:#fff;background:#575757;color:#DDD;}.sidebar .version{border-bottom-color:#DDD;}.sidebar-title{border-top-color:#777;border-bottom-color:#777;}.block a:hover{background:#444;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#DDD;}.docblock table,.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#ddd;}.content .highlighted{color:#eee !important;background-color:#616161;}.content .highlighted a,.content .highlighted span{color:#eee !important;}.content .highlighted.trait{background-color:#013191;}.content .highlighted.traitalias{background-color:#013191;}.content .highlighted.mod,.content .highlighted.externcrate{background-color:#afc6e4;}.content .highlighted.mod{background-color:#803a1b;}.content .highlighted.externcrate{background-color:#396bac;}.content .highlighted.enum{background-color:#5b4e68;}.content .highlighted.struct{background-color:#194e9f;}.content .highlighted.union{background-color:#b7bd49;}.content .highlighted.fn,.content .highlighted.method,.content .highlighted.tymethod{background-color:#4950ed;}.content .highlighted.type{background-color:#38902c;}.content .highlighted.foreigntype{background-color:#b200d6;}.content .highlighted.attr,.content .highlighted.derive,.content .highlighted.macro{background-color:#217d1c;}.content .highlighted.constant,.content .highlighted.static{background-color:#0063cc;}.content .highlighted.primitive{background-color:#00708a;}.content .highlighted.keyword{background-color:#884719;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#82b089;}.content span.struct,.content a.struct,.block a.current.struct{color:#2dbfb8;}.content span.type,.content a.type,.block a.current.type{color:#ff7f00;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#dd7de8;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#09bd00;}.content span.union,.content a.union,.block a.current.union{color:#a6ae37;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#82a5c9;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#43aec7;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#bda000;}.content span.trait,.content a.trait,.block a.current.trait{color:#b78cf2;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#b397da;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#2BAB63;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#de5249;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}nav:not(.sidebar){border-bottom-color:#4e4e4e;}nav.main .current{border-top-color:#eee;border-bottom-color:#eee;}nav.main .separator{border-color:#eee;}a{color:#ddd;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#D2991D;}a.test-arrow{color:#dedede;}.collapse-toggle,details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before{color:#999;}#crate-search{color:#111;background-color:#f0f0f0;border-color:#000;box-shadow:0 0 0 1px #000,0 0 0 2px transparent;}.search-input{color:#111;background-color:#f0f0f0;box-shadow:0 0 0 1px #000,0 0 0 2px transparent;}.search-input:focus{border-color:#008dfd;}.search-focus:disabled{background-color:#c5c4c4;}#crate-search+.search-input:focus{box-shadow:0 0 8px 4px #078dd8;}.module-item .stab,.import-item .stab{color:#ddd;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;color:#2f2f2f;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;color:#2f2f2f;}.stab.portability>code{background:none;}#help>div{background:#4d4d4d;border-color:#bfbfbf;}#help>div>span{border-bottom-color:#bfbfbf;}#help dt{border-color:#bfbfbf;background:rgba(0,0,0,0);}.since{color:grey;}tr.result span.primitive::after,tr.result span.keyword::after{color:#ddd;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target>code,:target>.in-band{background-color:#494a3d;border-right:3px solid #bb7410;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.8);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.8);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.8);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.8);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;border-color:#000;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;border-color:#777;}#titles>button:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>button:hover,#titles>button.selected{border-top-color:#0089ff;background-color:#353535;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#505050;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#505050;border-right-color:#000;}#sidebar-filler{background-color:#505050;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,.help-button,#copy-path{border-color:#e0e0e0;background:#f0f0f0;color:#000;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,.help-button:hover,.help-button:focus,#copy-path:hover,#copy-path:focus{border-color:#ffb900;}#theme-choices{border-color:#e0e0e0;background-color:#353535;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#4e4e4e;}@media (max-width:700px){#theme-picker{background:#f0f0f0;}}#all-types{background-color:#505050;}#all-types:hover{background-color:#606060;}.search-results td span.alias{color:#fff;}.search-results td span.grey{color:#ccc;}#sidebar-toggle{background-color:#565656;}#sidebar-toggle:hover{background-color:#676767;}#source-sidebar{background-color:#565656;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#444;}div.files>.selected{background-color:#333;}.setting-line>.title{border-bottom-color:#ddd;} \ No newline at end of file diff --git a/0.10.1/down-arrow.svg b/0.10.1/down-arrow.svg new file mode 100644 index 000000000..35437e77a --- /dev/null +++ b/0.10.1/down-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.1/favicon-16x16.png b/0.10.1/favicon-16x16.png new file mode 100644 index 000000000..7cfe6c135 Binary files /dev/null and b/0.10.1/favicon-16x16.png differ diff --git a/0.10.1/favicon-32x32.png b/0.10.1/favicon-32x32.png new file mode 100644 index 000000000..5109c1de8 Binary files /dev/null and b/0.10.1/favicon-32x32.png differ diff --git a/0.10.1/favicon.svg b/0.10.1/favicon.svg new file mode 100644 index 000000000..8b34b5119 --- /dev/null +++ b/0.10.1/favicon.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/0.10.1/implementors/core/clone/trait.Clone.js b/0.10.1/implementors/core/clone/trait.Clone.js new file mode 100644 index 000000000..7e38cb87c --- /dev/null +++ b/0.10.1/implementors/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Clone for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Clone for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Clone for Atom","synthetic":false,"types":["chemfiles::atom::Atom"]},{"text":"impl Clone for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Clone for UnitCell","synthetic":false,"types":["chemfiles::cell::UnitCell"]},{"text":"impl Clone for Residue","synthetic":false,"types":["chemfiles::residue::Residue"]},{"text":"impl Clone for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Clone for Topology","synthetic":false,"types":["chemfiles::topology::Topology"]},{"text":"impl Clone for Frame","synthetic":false,"types":["chemfiles::frame::Frame"]},{"text":"impl Clone for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Clone for Selection","synthetic":false,"types":["chemfiles::selection::Selection"]},{"text":"impl Clone for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl Clone for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/cmp/trait.Eq.js b/0.10.1/implementors/core/cmp/trait.Eq.js new file mode 100644 index 000000000..93c6ddab9 --- /dev/null +++ b/0.10.1/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Eq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Eq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Eq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Eq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/cmp/trait.Ord.js b/0.10.1/implementors/core/cmp/trait.Ord.js new file mode 100644 index 000000000..a9ca21e1e --- /dev/null +++ b/0.10.1/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Ord for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/cmp/trait.PartialEq.js b/0.10.1/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..9ad522208 --- /dev/null +++ b/0.10.1/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialEq<Error> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl PartialEq<Status> for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl PartialEq<CellShape> for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl PartialEq<BondOrder> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl PartialEq<Match> for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl PartialEq<Property> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl PartialEq<FormatMetadata> for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/cmp/trait.PartialOrd.js b/0.10.1/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..475b50bfb --- /dev/null +++ b/0.10.1/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialOrd<BondOrder> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl PartialOrd<Property> for Property","synthetic":false,"types":["chemfiles::property::Property"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/convert/trait.From.js b/0.10.1/implementors/core/convert/trait.From.js new file mode 100644 index 000000000..e8d807311 --- /dev/null +++ b/0.10.1/implementors/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl From<chfl_status> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl From<Utf8Error> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl From<chfl_cellshape> for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl From<CellShape> for chfl_cellshape","synthetic":false,"types":["chemfiles_sys::chfl_cellshape"]},{"text":"impl From<chfl_bond_order> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl From<bool> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<f64> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<String> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl<'a> From<&'a str> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<[f64; 3]> for Property","synthetic":false,"types":["chemfiles::property::Property"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/fmt/trait.Debug.js b/0.10.1/implementors/core/fmt/trait.Debug.js new file mode 100644 index 000000000..48bcdd1e0 --- /dev/null +++ b/0.10.1/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Debug for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Debug for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Debug for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Debug for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Debug for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Debug for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl Debug for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/fmt/trait.Display.js b/0.10.1/implementors/core/fmt/trait.Display.js new file mode 100644 index 000000000..271d5bff5 --- /dev/null +++ b/0.10.1/implementors/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Display for Error","synthetic":false,"types":["chemfiles::errors::Error"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/iter/traits/collect/trait.IntoIterator.js b/0.10.1/implementors/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 000000000..1579f5afe --- /dev/null +++ b/0.10.1/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> IntoIterator for &'a Match","synthetic":false,"types":["chemfiles::selection::Match"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/iter/traits/iterator/trait.Iterator.js b/0.10.1/implementors/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 000000000..3f278b3c0 --- /dev/null +++ b/0.10.1/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Iterator for PropertiesIter<'a>","synthetic":false,"types":["chemfiles::property::PropertiesIter"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/marker/trait.Copy.js b/0.10.1/implementors/core/marker/trait.Copy.js new file mode 100644 index 000000000..a45a3f929 --- /dev/null +++ b/0.10.1/implementors/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Copy for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/marker/trait.Freeze.js b/0.10.1/implementors/core/marker/trait.Freeze.js new file mode 100644 index 000000000..7a6ceb43d --- /dev/null +++ b/0.10.1/implementors/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Freeze for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Freeze for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl Freeze for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> Freeze for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Freeze for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Freeze for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl Freeze for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> Freeze for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Freeze for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl Freeze for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> Freeze for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Freeze for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Freeze for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> Freeze for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl Freeze for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl Freeze for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Freeze for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl Freeze for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Freeze for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> Freeze for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Freeze for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/marker/trait.Send.js b/0.10.1/implementors/core/marker/trait.Send.js new file mode 100644 index 000000000..91f3ac277 --- /dev/null +++ b/0.10.1/implementors/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Send for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Send for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl !Send for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> !Send for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !Send for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Send for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl !Send for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> !Send for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !Send for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl !Send for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> !Send for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Send for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl !Send for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> !Send for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl !Send for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl !Send for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Send for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl !Send for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Send for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !Send for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Send for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/marker/trait.StructuralEq.js b/0.10.1/implementors/core/marker/trait.StructuralEq.js new file mode 100644 index 000000000..a33ac84d0 --- /dev/null +++ b/0.10.1/implementors/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralEq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl StructuralEq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl StructuralEq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl StructuralEq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/marker/trait.StructuralPartialEq.js b/0.10.1/implementors/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 000000000..3a01ca7c6 --- /dev/null +++ b/0.10.1/implementors/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralPartialEq for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl StructuralPartialEq for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl StructuralPartialEq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl StructuralPartialEq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl StructuralPartialEq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl StructuralPartialEq for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl StructuralPartialEq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/marker/trait.Sync.js b/0.10.1/implementors/core/marker/trait.Sync.js new file mode 100644 index 000000000..e7672c774 --- /dev/null +++ b/0.10.1/implementors/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Sync for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Sync for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl !Sync for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> !Sync for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !Sync for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Sync for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl !Sync for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> !Sync for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !Sync for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl !Sync for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> !Sync for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Sync for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl !Sync for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> !Sync for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl !Sync for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl !Sync for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Sync for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl !Sync for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Sync for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !Sync for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Sync for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/marker/trait.Unpin.js b/0.10.1/implementors/core/marker/trait.Unpin.js new file mode 100644 index 000000000..f122ade53 --- /dev/null +++ b/0.10.1/implementors/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Unpin for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Unpin for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl Unpin for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> Unpin for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Unpin for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Unpin for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl Unpin for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> Unpin for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Unpin for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl Unpin for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> Unpin for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Unpin for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Unpin for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> Unpin for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl Unpin for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl Unpin for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Unpin for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl Unpin for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Unpin for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> Unpin for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Unpin for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/ops/deref/trait.Deref.js b/0.10.1/implementors/core/ops/deref/trait.Deref.js new file mode 100644 index 000000000..752558cba --- /dev/null +++ b/0.10.1/implementors/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Deref for AtomRef<'a>","synthetic":false,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Deref for AtomMut<'a>","synthetic":false,"types":["chemfiles::atom::AtomMut"]},{"text":"impl<'a> Deref for UnitCellRef<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Deref for UnitCellMut<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl<'a> Deref for ResidueRef<'a>","synthetic":false,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl<'a> Deref for TopologyRef<'a>","synthetic":false,"types":["chemfiles::topology::TopologyRef"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/ops/deref/trait.DerefMut.js b/0.10.1/implementors/core/ops/deref/trait.DerefMut.js new file mode 100644 index 000000000..57e98f5d9 --- /dev/null +++ b/0.10.1/implementors/core/ops/deref/trait.DerefMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> DerefMut for AtomMut<'a>","synthetic":false,"types":["chemfiles::atom::AtomMut"]},{"text":"impl<'a> DerefMut for UnitCellMut<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellMut"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/ops/drop/trait.Drop.js b/0.10.1/implementors/core/ops/drop/trait.Drop.js new file mode 100644 index 000000000..cda43de9d --- /dev/null +++ b/0.10.1/implementors/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Drop for Atom","synthetic":false,"types":["chemfiles::atom::Atom"]},{"text":"impl Drop for UnitCell","synthetic":false,"types":["chemfiles::cell::UnitCell"]},{"text":"impl Drop for Residue","synthetic":false,"types":["chemfiles::residue::Residue"]},{"text":"impl Drop for Topology","synthetic":false,"types":["chemfiles::topology::Topology"]},{"text":"impl Drop for Frame","synthetic":false,"types":["chemfiles::frame::Frame"]},{"text":"impl Drop for Trajectory","synthetic":false,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Drop for Selection","synthetic":false,"types":["chemfiles::selection::Selection"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/core/ops/index/trait.Index.js b/0.10.1/implementors/core/ops/index/trait.Index.js new file mode 100644 index 000000000..3201d6d5b --- /dev/null +++ b/0.10.1/implementors/core/ops/index/trait.Index.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Index<usize> for Match","synthetic":false,"types":["chemfiles::selection::Match"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/std/error/trait.Error.js b/0.10.1/implementors/std/error/trait.Error.js new file mode 100644 index 000000000..b49ff426e --- /dev/null +++ b/0.10.1/implementors/std/error/trait.Error.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Error for Error","synthetic":false,"types":["chemfiles::errors::Error"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/std/panic/trait.RefUnwindSafe.js b/0.10.1/implementors/std/panic/trait.RefUnwindSafe.js new file mode 100644 index 000000000..a955f801b --- /dev/null +++ b/0.10.1/implementors/std/panic/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl RefUnwindSafe for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl RefUnwindSafe for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl RefUnwindSafe for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> RefUnwindSafe for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> RefUnwindSafe for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl RefUnwindSafe for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl RefUnwindSafe for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> RefUnwindSafe for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> RefUnwindSafe for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl RefUnwindSafe for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> RefUnwindSafe for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl RefUnwindSafe for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl RefUnwindSafe for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> RefUnwindSafe for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl RefUnwindSafe for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl RefUnwindSafe for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl RefUnwindSafe for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl RefUnwindSafe for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl RefUnwindSafe for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !RefUnwindSafe for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl RefUnwindSafe for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/implementors/std/panic/trait.UnwindSafe.js b/0.10.1/implementors/std/panic/trait.UnwindSafe.js new file mode 100644 index 000000000..80751d2b8 --- /dev/null +++ b/0.10.1/implementors/std/panic/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl UnwindSafe for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl UnwindSafe for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl UnwindSafe for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> UnwindSafe for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !UnwindSafe for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl UnwindSafe for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl UnwindSafe for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> UnwindSafe for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !UnwindSafe for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl UnwindSafe for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> UnwindSafe for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl UnwindSafe for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl UnwindSafe for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> UnwindSafe for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl UnwindSafe for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl UnwindSafe for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl UnwindSafe for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl UnwindSafe for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl UnwindSafe for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !UnwindSafe for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl UnwindSafe for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.1/index.html b/0.10.1/index.html new file mode 100644 index 000000000..8b8b920bb --- /dev/null +++ b/0.10.1/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/0.10.1/light.css b/0.10.1/light.css new file mode 100644 index 000000000..a5060b7b2 --- /dev/null +++ b/0.10.1/light.css @@ -0,0 +1 @@ + body{background-color:white;color:black;}h1,h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){color:black;}h1.fqn{border-bottom-color:#D5D5D5;}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){border-bottom-color:#DDDDDD;}.in-band{background-color:white;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#F5F5F5;}pre{background-color:#F5F5F5;}.sidebar{background-color:#F1F1F1;}*{scrollbar-color:rgba(36,37,39,0.6) #e6e6e6;}.sidebar{scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;}.logo-container.rust-logo>img{}::-webkit-scrollbar-track{background-color:#ecebeb;}::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar::-webkit-scrollbar-track{background-color:#dcdcdc;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar .current{background-color:#fff;}.source .sidebar{background-color:#fff;}.sidebar .location{border-color:#000;background-color:#fff;color:#333;}.sidebar .version{border-bottom-color:#DDD;}.sidebar-title{border-top-color:#777;border-bottom-color:#777;}.block a:hover{background:#F5F5F5;}.line-numbers span{color:#c67e2d;}.line-numbers .line-highlighted{background-color:#f6fdb0 !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#ddd;}.docblock table,.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#4E4C4C;}.content .highlighted{color:#000 !important;background-color:#ccc;}.content .highlighted a,.content .highlighted span{color:#000 !important;}.content .highlighted.trait{background-color:#c7b6ff;}.content .highlighted.traitalias{background-color:#c7b6ff;}.content .highlighted.mod,.content .highlighted.externcrate{background-color:#afc6e4;}.content .highlighted.enum{background-color:#b4d1b9;}.content .highlighted.struct{background-color:#e7b1a0;}.content .highlighted.union{background-color:#b7bd49;}.content .highlighted.fn,.content .highlighted.method,.content .highlighted.tymethod{background-color:#c6afb3;}.content .highlighted.type{background-color:#ffc891;}.content .highlighted.foreigntype{background-color:#f5c4ff;}.content .highlighted.attr,.content .highlighted.derive,.content .highlighted.macro{background-color:#8ce488;}.content .highlighted.constant,.content .highlighted.static{background-color:#c3e0ff;}.content .highlighted.primitive{background-color:#9aecff;}.content .highlighted.keyword{background-color:#f99650;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#508157;}.content span.struct,.content a.struct,.block a.current.struct{color:#ad448e;}.content span.type,.content a.type,.block a.current.type{color:#ba5d00;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#cd00e2;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#068000;}.content span.union,.content a.union,.block a.current.union{color:#767b27;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#546e8a;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#2c8093;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#4d76ae;}.content span.trait,.content a.trait,.block a.current.trait{color:#7c5af3;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#6841f1;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#9a6e31;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#de5249;}pre.rust .comment{color:#8E908C;}pre.rust .doccomment{color:#4D4D4C;}nav:not(.sidebar){border-bottom-color:#e0e0e0;}nav.main .current{border-top-color:#000;border-bottom-color:#000;}nav.main .separator{border:1px solid #000;}a{color:#000;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#3873AD;}a.test-arrow{color:#f5f5f5;}.collapse-toggle,details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before{color:#999;}#crate-search{color:#555;background-color:white;border-color:#e0e0e0;box-shadow:0 0 0 1px #e0e0e0,0 0 0 2px transparent;}.search-input{color:#555;background-color:white;box-shadow:0 0 0 1px #e0e0e0,0 0 0 2px transparent;}.search-input:focus{border-color:#66afe9;}.search-focus:disabled{background-color:#e6e6e6;}#crate-search+.search-input:focus{box-shadow:0 0 8px #078dd8;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;}.stab.portability>code{background:none;}#help>div{background:#e9e9e9;border-color:#bfbfbf;}#help>div>span{border-bottom-color:#bfbfbf;}.since{color:grey;}tr.result span.primitive::after,tr.result span.keyword::after{color:black;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#8959A8;}pre.rust .kw-2,pre.rust .prelude-ty{color:#4271AE;}pre.rust .number,pre.rust .string{color:#718C00;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#C82829;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#B76514;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#c7c7c7;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target>code,:target>.in-band{background:#FDFFD3;border-right:3px solid #ffb44c;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.5);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.5);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#eee;border-color:#999;}#titles>button:not(.selected){background-color:#e6e6e6;border-top-color:#e6e6e6;}#titles>button:hover,#titles>button.selected{background-color:#ffffff;border-top-color:#0089ff;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#F1F1F1;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#F1F1F1;border-right-color:#000;}#sidebar-filler{background-color:#F1F1F1;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,.help-button,#copy-path{border-color:#e0e0e0;background-color:#fff;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,.help-button:hover,.help-button:focus,#copy-path:hover,#copy-path:focus{border-color:#717171;}#theme-choices{border-color:#ccc;background-color:#fff;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#eee;}@media (max-width:700px){#theme-picker{background:#fff;}}#all-types{background-color:#fff;}#all-types:hover{background-color:#f9f9f9;}.search-results td span.alias{color:#000;}.search-results td span.grey{color:#999;}#sidebar-toggle{background-color:#F1F1F1;}#sidebar-toggle:hover{background-color:#E0E0E0;}#source-sidebar{background-color:#F1F1F1;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#E0E0E0;}div.files>.selected{background-color:#fff;}.setting-line>.title{border-bottom-color:#D5D5D5;} \ No newline at end of file diff --git a/0.10.1/main.js b/0.10.1/main.js new file mode 100644 index 000000000..0639f0700 --- /dev/null +++ b/0.10.1/main.js @@ -0,0 +1,8 @@ +if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.indexOf(searchString,position)===position}}if(!String.prototype.endsWith){String.prototype.endsWith=function(suffix,length){var l=length||this.length;return this.indexOf(suffix,l-suffix.length)!==-1}}if(!DOMTokenList.prototype.add){DOMTokenList.prototype.add=function(className){if(className&&!hasClass(this,className)){if(this.className&&this.className.length>0){this.className+=" "+className}else{this.className=className}}}}if(!DOMTokenList.prototype.remove){DOMTokenList.prototype.remove=function(className){if(className&&this.className){this.className=(" "+this.className+" ").replace(" "+className+" "," ").trim()}}}(function(){var rustdocVars=document.getElementById("rustdoc-vars");if(rustdocVars){window.rootPath=rustdocVars.attributes["data-root-path"].value;window.currentCrate=rustdocVars.attributes["data-current-crate"].value;window.searchJS=rustdocVars.attributes["data-search-js"].value;window.searchIndexJS=rustdocVars.attributes["data-search-index-js"].value}var sidebarVars=document.getElementById("sidebar-vars");if(sidebarVars){window.sidebarCurrent={name:sidebarVars.attributes["data-name"].value,ty:sidebarVars.attributes["data-ty"].value,relpath:sidebarVars.attributes["data-relpath"].value,}}}());function getVirtualKey(ev){if("key"in ev&&typeof ev.key!="undefined"){return ev.key}var c=ev.charCode||ev.keyCode;if(c==27){return"Escape"}return String.fromCharCode(c)}var THEME_PICKER_ELEMENT_ID="theme-picker";var THEMES_ELEMENT_ID="theme-choices";function getThemesElement(){return document.getElementById(THEMES_ELEMENT_ID)}function getThemePickerElement(){return document.getElementById(THEME_PICKER_ELEMENT_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function showThemeButtonState(){var themePicker=getThemePickerElement();var themeChoices=getThemesElement();themeChoices.style.display="block";themePicker.style.borderBottomRightRadius="0";themePicker.style.borderBottomLeftRadius="0"}function hideThemeButtonState(){var themePicker=getThemePickerElement();var themeChoices=getThemesElement();themeChoices.style.display="none";themePicker.style.borderBottomRightRadius="3px";themePicker.style.borderBottomLeftRadius="3px"}(function(){var themeChoices=getThemesElement();var themePicker=getThemePickerElement();var availableThemes=["ayu","dark","light"];function switchThemeButtonState(){if(themeChoices.style.display==="block"){hideThemeButtonState()}else{showThemeButtonState()}}function handleThemeButtonsBlur(e){var active=document.activeElement;var related=e.relatedTarget;if(active.id!==THEME_PICKER_ELEMENT_ID&&(!active.parentNode||active.parentNode.id!==THEMES_ELEMENT_ID)&&(!related||(related.id!==THEME_PICKER_ELEMENT_ID&&(!related.parentNode||related.parentNode.id!==THEMES_ELEMENT_ID)))){hideThemeButtonState()}}themePicker.onclick=switchThemeButtonState;themePicker.onblur=handleThemeButtonsBlur;availableThemes.forEach(function(item){var but=document.createElement("button");but.textContent=item;but.onclick=function(){switchTheme(window.currentTheme,window.mainTheme,item,true);useSystemTheme(false)};but.onblur=handleThemeButtonsBlur;themeChoices.appendChild(but)})}());(function(){"use strict";window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:function(){return document.getElementById("search")},title:null,titleBeforeSearch:document.title,timeout:null,currentTab:0,mouseMovedAfterSearch:true,clearInputTimeout:function(){if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},focus:function(){searchState.input.focus()},defocus:function(){searchState.input.blur()},showResults:function(search){if(search===null||typeof search==='undefined'){search=searchState.outputElement()}addClass(main,"hidden");removeClass(search,"hidden");searchState.mouseMovedAfterSearch=false;document.title=searchState.title},hideResults:function(search){if(search===null||typeof search==='undefined'){search=searchState.outputElement()}addClass(search,"hidden");removeClass(main,"hidden");document.title=searchState.titleBeforeSearch;if(searchState.browserSupportsHistoryApi()){history.replaceState("",window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}},getQueryStringParams:function(){var params={};window.location.search.substring(1).split("&").map(function(s){var pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},putBackSearch:function(search_input){var search=searchState.outputElement();if(search_input.value!==""&&hasClass(search,"hidden")){searchState.showResults(search);if(searchState.browserSupportsHistoryApi()){var extra="?search="+encodeURIComponent(search_input.value);history.replaceState(search_input.value,"",getNakedUrl()+extra+window.location.hash)}document.title=searchState.title}},browserSupportsHistoryApi:function(){return window.history&&typeof window.history.pushState==="function"},setup:function(){var search_input=searchState.input;if(!searchState.input){return}function loadScript(url){var script=document.createElement('script');script.src=url;document.head.append(script)}var searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(window.searchJS);loadScript(window.searchIndexJS)}}search_input.addEventListener("focus",function(){searchState.putBackSearch(this);search_input.origPlaceholder=searchState.input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});search_input.addEventListener("blur",function(){search_input.placeholder=searchState.input.origPlaceholder});document.addEventListener("mousemove",function(){searchState.mouseMovedAfterSearch=true});search_input.removeAttribute('disabled');searchState.addCrateDropdown(window.ALL_CRATES);var params=searchState.getQueryStringParams();if(params.search!==undefined){var search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search);loadSearch()}},addCrateDropdown:function(crates){var elem=document.getElementById("crate-search");if(!elem){return}var savedCrate=getSettingValue("saved-filter-crate");for(var i=0,len=crates.length;i0){return tmp}}return null}function showSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){addClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];if(sidebar){addClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(!filler){var div=document.createElement("div");div.id="sidebar-filler";sidebar.appendChild(div)}}}function hideSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){removeClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(filler){filler.remove()}document.getElementsByTagName("body")[0].style.marginTop=""}function isHidden(elem){return elem.offsetHeight===0}var toggleAllDocsId="toggle-all-docs";var main=document.getElementById("main");var savedHash="";function handleHashes(ev){var elem;var search=searchState.outputElement();if(ev!==null&&search&&!hasClass(search,"hidden")&&ev.newURL){searchState.hideResults(search);var hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(searchState.browserSupportsHistoryApi()){history.replaceState(hash,"",getNakedUrl()+window.location.search+"#"+hash)}elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}elem=document.getElementById(savedHash.slice(1));if(!elem||!isHidden(elem)){return}var parent=elem.parentNode;if(parent&&hasClass(parent,"impl-items")){onEachLazy(parent.getElementsByClassName("collapsed"),function(e){if(e.parentNode===parent){e.click();return true}});if(isHidden(elem)){if(hasClass(parent.lastElementChild,"collapse-toggle")){parent.lastElementChild.click()}}}}}function highlightSourceLines(match,ev){if(typeof match==="undefined"){hideSidebar();match=window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/)}if(!match){return}var from=parseInt(match[1],10);var to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to0){collapseDocs(collapses[0],"show")}openParentDetails(h3.parentNode)}else{openParentDetails(elem.parentNode)}}}function getHelpElement(build){if(build!==false){buildHelperPopup()}return document.getElementById("help")}function displayHelp(display,ev,help){if(display===true){help=help?help:getHelpElement(true);if(hasClass(help,"hidden")){ev.preventDefault();removeClass(help,"hidden");addClass(document.body,"blur")}}else{help=help?help:getHelpElement(false);if(help&&hasClass(help,"hidden")===false){ev.preventDefault();addClass(help,"hidden");removeClass(document.body,"blur")}}}function handleEscape(ev){var help=getHelpElement(false);var search=searchState.outputElement();if(hasClass(help,"hidden")===false){displayHelp(false,ev,help)}else if(hasClass(search,"hidden")===false){searchState.clearInputTimeout();ev.preventDefault();searchState.hideResults(search)}searchState.defocus();hideThemeButtonState()}var disableShortcuts=getSettingValue("disable-shortcuts")==="true";function handleShortcut(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts===true){return}if(document.activeElement.tagName==="INPUT"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":displayHelp(false,ev);ev.preventDefault();searchState.focus();break;case"+":case"-":ev.preventDefault();toggleAllDocs();break;case"?":displayHelp(true,ev);break;case"t":case"T":displayHelp(false,ev);ev.preventDefault();var themePicker=getThemePickerElement();themePicker.click();themePicker.focus();break;default:if(getThemePickerElement().parentNode.contains(ev.target)){handleThemeKeyDown(ev)}}}}function handleThemeKeyDown(ev){var active=document.activeElement;var themes=getThemesElement();switch(getVirtualKey(ev)){case"ArrowUp":ev.preventDefault();if(active.previousElementSibling&&ev.target.id!==THEME_PICKER_ELEMENT_ID){active.previousElementSibling.focus()}else{showThemeButtonState();themes.lastElementChild.focus()}break;case"ArrowDown":ev.preventDefault();if(active.nextElementSibling&&ev.target.id!==THEME_PICKER_ELEMENT_ID){active.nextElementSibling.focus()}else{showThemeButtonState();themes.firstElementChild.focus()}break;case"Enter":case"Return":case"Space":if(ev.target.id===THEME_PICKER_ELEMENT_ID&&themes.style.display==="none"){ev.preventDefault();showThemeButtonState();themes.firstElementChild.focus()}break;case"Home":ev.preventDefault();themes.firstElementChild.focus();break;case"End":ev.preventDefault();themes.lastElementChild.focus();break}}function findParentElement(elem,tagName){do{if(elem&&elem.tagName===tagName){return elem}elem=elem.parentNode}while(elem);return null}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);var handleSourceHighlight=(function(){var prev_line_id=0;var set_fragment=function(name){var x=window.scrollX,y=window.scrollY;if(searchState.browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSourceLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return function(ev){var cur_line_id=parseInt(ev.target.id,10);ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){var tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());document.addEventListener("click",function(ev){var helpElem=getHelpElement(false);if(hasClass(ev.target,"help-button")){displayHelp(true,ev)}else if(hasClass(ev.target,"collapse-toggle")){collapseDocs(ev.target,"toggle")}else if(hasClass(ev.target.parentNode,"collapse-toggle")){collapseDocs(ev.target.parentNode,"toggle")}else if(ev.target.tagName==="SPAN"&&hasClass(ev.target.parentNode,"line-numbers")){handleSourceHighlight(ev)}else if(helpElem&&hasClass(helpElem,"hidden")===false){var is_inside_help_popup=ev.target!==helpElem&&helpElem.contains(ev.target);if(is_inside_help_popup===false){addClass(helpElem,"hidden");removeClass(document.body,"blur")}}else{var a=findParentElement(ev.target,"A");if(a&&a.hash){expandSection(a.hash.replace(/^#/,""))}}});(function(){var x=document.getElementsByClassName("version-selector");if(x.length>0){x[0].onchange=function(){var i,match,url=document.location.href,stripped="",len=window.rootPath.match(/\.\.\//g).length+1;for(i=0;i"+""+"
"+code.outerHTML+"
";list.appendChild(display)}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}function labelForToggleButton(sectionIsCollapsed){if(sectionIsCollapsed){return"+"}return"\u2212"}function onEveryMatchingChild(elem,className,func){if(elem&&className&&func){var length=elem.childNodes.length;var nodes=elem.childNodes;for(var i=0;i"+labelForToggleButton(sectionIsCollapsed)+"]";return toggle}function createToggle(toggle,otherMessage,fontSize,extraClass,show){var span=document.createElement("span");span.className="toggle-label";if(show){span.style.display="none"}if(!otherMessage){span.innerHTML=" Expand description"}else{span.innerHTML=otherMessage}if(fontSize){span.style.fontSize=fontSize}var mainToggle=toggle.cloneNode(true);mainToggle.appendChild(span);var wrapper=document.createElement("div");wrapper.className="toggle-wrapper";if(!show){addClass(wrapper,"collapsed");var inner=mainToggle.getElementsByClassName("inner");if(inner&&inner.length>0){inner[0].innerHTML="+"}}if(extraClass){addClass(wrapper,extraClass)}wrapper.appendChild(mainToggle);return wrapper}(function(){var toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}var toggle=createSimpleToggle(false);var hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";var hideImplementors=getSettingValue("auto-collapse-implementors")!=="false";var hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";var hideTraitImplementations=getSettingValue("auto-hide-trait-implementations")!=="false";var impl_list=document.getElementById("trait-implementations-list");if(impl_list!==null){onEachLazy(impl_list.getElementsByClassName("collapse-toggle"),function(e){collapseNonInherent(e)})}var blanket_list=document.getElementById("blanket-implementations-list");if(blanket_list!==null){onEachLazy(blanket_list.getElementsByClassName("collapse-toggle"),function(e){collapseNonInherent(e)})}var func=function(e){var next=e.nextElementSibling;if(next&&hasClass(next,"item-info")){next=next.nextElementSibling}if(!next){return}if(hasClass(next,"docblock")){var newToggle=toggle.cloneNode(true);insertAfter(newToggle,e.childNodes[e.childNodes.length-1]);if(hideMethodDocs===true&&hasClass(e,"method")===true){collapseDocs(newToggle,"hide")}}};var funcImpl=function(e){var next=e.nextElementSibling;if(next&&hasClass(next,"item-info")){next=next.nextElementSibling}if(next&&hasClass(next,"docblock")){next=next.nextElementSibling}if(!next){return}};onEachLazy(document.getElementsByClassName("method"),func);onEachLazy(document.getElementsByClassName("associatedconstant"),func);var impl_call=function(){};onEachLazy(document.getElementsByTagName("details"),function(e){var showLargeItem=!hideLargeItemContents&&hasClass(e,"type-contents-toggle");var showImplementor=!hideImplementors&&hasClass(e,"implementors-toggle");if(showLargeItem||showImplementor){e.open=true}});if(hideMethodDocs===true){impl_call=function(e,newToggle){if(e.id.match(/^impl(?:-\d+)?$/)===null){if(hasClass(e,"impl")===true){collapseDocs(newToggle,"hide")}}}}var newToggle=document.createElement("a");newToggle.href="javascript:void(0)";newToggle.className="collapse-toggle hidden-default collapsed";newToggle.innerHTML="["+labelForToggleButton(true)+"] Show hidden undocumented items";function toggleClicked(){if(hasClass(this,"collapsed")){removeClass(this,"collapsed");onEachLazy(this.parentNode.getElementsByClassName("hidden"),function(x){if(hasClass(x,"content")===false){removeClass(x,"hidden");addClass(x,"x")}},true);this.innerHTML="["+labelForToggleButton(false)+"] Hide undocumented items"}else{addClass(this,"collapsed");onEachLazy(this.parentNode.getElementsByClassName("x"),function(x){if(hasClass(x,"content")===false){addClass(x,"hidden");removeClass(x,"x")}},true);this.innerHTML="["+labelForToggleButton(true)+"] Show hidden undocumented items"}}onEachLazy(document.getElementsByClassName("impl-items"),function(e){onEachLazy(e.getElementsByClassName("associatedconstant"),func);var hiddenElems=Array.prototype.slice.call(e.getElementsByClassName("hidden"));var needToggle=hiddenElems.some(function(hiddenElem){return hasClass(hiddenElem,"content")===false&&hasClass(hiddenElem,"docblock")===false});if(needToggle===true){var inner_toggle=newToggle.cloneNode(true);inner_toggle.onclick=toggleClicked;e.insertBefore(inner_toggle,e.firstChild);impl_call(e.previousSibling,inner_toggle)}});var currentType=document.getElementsByClassName("type-decl")[0];var className=null;if(currentType){currentType=currentType.getElementsByClassName("rust")[0];if(currentType){onEachLazy(currentType.classList,function(item){if(item!=="main"){className=item;return true}})}}function buildToggleWrapper(e){if(hasClass(e,"autohide")){var wrap=e.previousElementSibling;if(wrap&&hasClass(wrap,"toggle-wrapper")){var inner_toggle=wrap.childNodes[0];var extra=e.childNodes[0].tagName==="H3";e.style.display="none";addClass(wrap,"collapsed");onEachLazy(inner_toggle.getElementsByClassName("inner"),function(e){e.innerHTML=labelForToggleButton(true)});onEachLazy(inner_toggle.getElementsByClassName("toggle-label"),function(e){e.style.display="inline-block";if(extra===true){e.innerHTML=" Show "+e.childNodes[0].innerHTML}})}}if(e.parentNode.id==="main"){var otherMessage="";var fontSize;var extraClass;if(hasClass(e,"type-decl")){return}else if(hasClass(e,"non-exhaustive")){otherMessage=" This ";if(hasClass(e,"non-exhaustive-struct")){otherMessage+="struct"}else if(hasClass(e,"non-exhaustive-enum")){otherMessage+="enum"}else if(hasClass(e,"non-exhaustive-variant")){otherMessage+="enum variant"}else if(hasClass(e,"non-exhaustive-type")){otherMessage+="type"}otherMessage+=" is marked as non-exhaustive"}else if(hasClass(e.childNodes[0],"impl-items")){extraClass="marg-left"}e.parentNode.insertBefore(createToggle(toggle,otherMessage,fontSize,extraClass,true),e);if(hasClass(e,"non-exhaustive")===true){collapseDocs(e.previousSibling.childNodes[0],"toggle")}}}onEachLazy(document.getElementsByClassName("docblock"),buildToggleWrapper);var pageId=getPageId();if(pageId!==null){expandSection(pageId)}}());(function(){var lineNumbersFunc=function(){};if(getSettingValue("line-numbers")==="true"){lineNumbersFunc=function(x){var count=x.textContent.split("\n").length;var elems=[];for(var i=0;ithe rustdoc book.";var container=document.createElement("div");var shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["T","Focus the theme picker menu"],["↑","Move up in search results"],["↓","Move down in search results"],["ctrl + ↑ / ↓","Switch result tab"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(function(x){return"
"+x[0].split(" ").map(function(y,index){return(index&1)===0?""+y+"":" "+y+" "}).join("")+"
"+x[1]+"
"}).join("");var div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";var infos=["Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + * -> vec)","Search multiple things at once by splitting your query with comma (e.g., \ + str,u8 or String,struct:Vec,test)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for items inside another one by searching for a path: vec::Vec",].map(function(x){return"

"+x+"

"}).join("");var div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;container.appendChild(book_info);container.appendChild(div_shortcuts);container.appendChild(div_infos);popup.appendChild(container);insertAfter(popup,searchState.outputElement());buildHelperPopup=function(){}}onHashChange(null);window.onhashchange=onHashChange;searchState.setup()}());function copy_path(but){var parent=but.parentElement;var path=[];onEach(parent.childNodes,function(child){if(child.tagName==='A'){path.push(child.textContent)}});var el=document.createElement('textarea');el.value='use '+path.join('::')+';';el.setAttribute('readonly','');el.style.position='absolute';el.style.left='-9999px';document.body.appendChild(el);el.select();document.execCommand('copy');document.body.removeChild(el);but.textContent='✓'} \ No newline at end of file diff --git a/0.10.1/normalize.css b/0.10.1/normalize.css new file mode 100644 index 000000000..6d692b50c --- /dev/null +++ b/0.10.1/normalize.css @@ -0,0 +1,2 @@ + /*! normalize.css v3.0.0 | MIT License | git.io/normalize */ +html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0} \ No newline at end of file diff --git a/0.10.1/noscript.css b/0.10.1/noscript.css new file mode 100644 index 000000000..807cd868f --- /dev/null +++ b/0.10.1/noscript.css @@ -0,0 +1 @@ + #main>h2+div,#main>h2+h3,#main>h3+div{display:block;}.loading-content{display:none;}#main>h2+div,#main>h3+div{display:block;}#main>h2+h3{display:flex;}#main .impl-items .hidden{display:block !important;}#main .impl-items h4.hidden{display:flex !important;}#main .attributes{margin-left:0 !important;}#copy-path{display:none;} \ No newline at end of file diff --git a/0.10.1/rust-logo.png b/0.10.1/rust-logo.png new file mode 100644 index 000000000..74b4bd695 Binary files /dev/null and b/0.10.1/rust-logo.png differ diff --git a/0.10.1/rustdoc.css b/0.10.1/rustdoc.css new file mode 100644 index 000000000..909b415ba --- /dev/null +++ b/0.10.1/rustdoc.css @@ -0,0 +1 @@ + @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular.woff2") format("woff2"),url("FiraSans-Regular.woff") format('woff');font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium.woff2") format("woff2"),url("FiraSans-Medium.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular.ttf.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It.ttf.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold.ttf.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular.ttf.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It.ttf.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold.ttf.woff") format('woff');font-display:swap;}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:16px/1.4 "Source Serif 4",serif;margin:0;position:relative;padding:10px 15px 20px 15px;-webkit-font-feature-settings:"kern","liga";-moz-font-feature-settings:"kern","liga";font-feature-settings:"kern","liga";}h1{font-size:1.5em;}h2{font-size:1.4em;}h3{font-size:1.3em;}h1,h2,h3:not(.impl):not(.method):not(.type):not(.tymethod):not(.notable),h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant){font-weight:500;margin:20px 0 15px 0;padding-bottom:6px;}h1.fqn{display:flex;border-bottom:1px dashed;margin-top:0;padding-left:1px;}h1.fqn>.in-band>a:hover{text-decoration:underline;}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant){border-bottom:1px solid;}h3.impl,h3.method,h4.method,h3.type,h4.type,h4.associatedconstant{flex-basis:100%;font-weight:600;margin-top:16px;margin-bottom:10px;position:relative;}h3.impl,h3.method,h4.method.trait-impl,h3.type,h4.type.trait-impl,h4.associatedconstant.trait-impl{padding-left:15px;}h1,h2,h3,h4,.sidebar,a.source,.search-input,.content table td:first-child>a,.collapse-toggle,div.item-list .out-of-band,#source-sidebar,#sidebar-toggle,#main>ul.docblock>li>a{font-family:"Fira Sans",Arial,sans-serif;}.content ul.crate a.crate{font-size:16px/1.6;font-family:"Fira Sans",Arial,sans-serif;}ol,ul{padding-left:25px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.6em;}p{margin:0 0 .6em 0;}summary{outline:none;}code,pre,a.test-arrow{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.1em;}.docblock pre code,.docblock-short pre code{padding:0;padding-right:1ex;}pre{padding:14px;}.source .content pre{padding:20px;}img{max-width:100%;}li{position:relative;}.source .content{margin-top:50px;max-width:none;overflow:visible;margin-left:0px;min-width:70em;}nav.sub{font-size:16px;text-transform:uppercase;}.sidebar{width:200px;position:fixed;left:0;top:0;bottom:0;overflow:auto;}*{scrollbar-width:initial;}.sidebar{scrollbar-width:thin;}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;}.sidebar .block>ul>li{margin-right:-10px;}.content,nav{max-width:960px;}.hidden{display:none !important;}.logo-container{height:100px;width:100px;position:relative;margin:20px auto;display:block;margin-top:10px;}.logo-container>img{max-width:100px;max-height:100px;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;}.sidebar .location{border:1px solid;font-size:17px;margin:30px 10px 20px 10px;text-align:center;word-wrap:break-word;}.sidebar .version{font-size:15px;text-align:center;border-bottom:1px solid;overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;}.location:empty{border:none;}.location a:first-child{font-weight:500;}.block{padding:0;margin-bottom:14px;}.block h2,.block h3{margin-top:0;margin-bottom:8px;text-align:center;}.block ul,.block li{margin:0 10px;padding:0;list-style:none;}.block a{display:block;text-overflow:ellipsis;overflow:hidden;line-height:15px;padding:7px 5px;font-size:14px;font-weight:300;transition:border 500ms ease-out;}.sidebar-title{border-top:1px solid;border-bottom:1px solid;text-align:center;font-size:17px;margin-bottom:5px;}.sidebar-links{margin-bottom:15px;}.sidebar-links>a{padding-left:10px;width:100%;}.sidebar-menu{display:none;}.content{padding:15px 0;}.source .content pre.rust{white-space:pre;overflow:auto;padding-left:0;}.rustdoc:not(.source) .example-wrap{display:inline-flex;margin-bottom:10px;}.example-wrap{position:relative;width:100%;}.example-wrap>pre.line-number{overflow:initial;border:1px solid;border-top-left-radius:5px;border-bottom-left-radius:5px;padding:13px 8px;text-align:right;}.rustdoc:not(.source) .example-wrap>pre.rust{width:100%;overflow-x:auto;}.rustdoc:not(.source) .example-wrap>pre{margin:0;}#search{margin-left:230px;position:relative;}#results>table{width:100%;table-layout:fixed;}.content pre.line-numbers{float:left;border:none;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.line-numbers span{cursor:pointer;}.docblock-short{overflow-wrap:anywhere;}.docblock-short p{display:inline;}.docblock-short p{overflow:hidden;text-overflow:ellipsis;margin:0;}.docblock>:not(pre)>code,.docblock-short>:not(pre)>code{white-space:pre-wrap;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom:1px solid;}#main>.docblock h1{font-size:1.3em;}#main>.docblock h2{font-size:1.15em;}#main>.docblock h3,#main>.docblock h4,#main>.docblock h5{font-size:1em;}#main>h2+div,#main>h2+h3,#main>h3+div{display:none;flex-wrap:wrap;}.docblock h1{font-size:1em;}.docblock h2{font-size:0.95em;}.docblock h3,.docblock h4,.docblock h5{font-size:0.9em;}.docblock{margin-left:24px;position:relative;}.content .out-of-band{flex-grow:0;text-align:right;font-size:23px;margin:0px;padding:0 0 0 12px;font-weight:normal;}h3.impl>.out-of-band{font-size:21px;}h4.method>.out-of-band{font-size:19px;}h4>code,h3>code,.invisible>code{max-width:calc(100% - 41px);display:block;}.invisible{width:100%;display:inline-block;}.content .in-band{flex-grow:1;margin:0px;padding:0px;}.in-band>code{display:inline-block;}#main{position:relative;}#main>.since{top:inherit;font-family:"Fira Sans",Arial,sans-serif;}.content table:not(.table-display){border-spacing:0 5px;}.content td{vertical-align:top;}.content td:first-child{padding-right:20px;}.content td p:first-child{margin-top:0;}.content td h1,.content td h2{margin-left:0;font-size:1.1em;}.content tr:first-child td{border-top:0;}.docblock table{margin:.5em 0;width:calc(100% - 2px);border:1px dashed;}.docblock table td{padding:.5em;border:1px dashed;}.docblock table th{padding:.5em;text-align:left;border:1px solid;}.fields+table{margin-bottom:1em;}.content .item-list{list-style-type:none;padding:0;}.content .multi-column{-moz-column-count:5;-moz-column-gap:2.5em;-webkit-column-count:5;-webkit-column-gap:2.5em;column-count:5;column-gap:2.5em;}.content .multi-column li{width:100%;display:inline-block;}.content .method{font-size:1em;position:relative;}.content .method .where,.content .fn .where,.content .where.fmt-newline{display:block;font-size:0.8em;}.content .methods>div:not(.notable-traits){margin-left:40px;margin-bottom:15px;}.content .docblock>.impl-items{margin-left:20px;margin-top:-34px;}.content .docblock>.impl-items>h4{border-bottom:0;}.content .docblock>.impl-items .table-display{margin:0;}.content .docblock>.impl-items table td{padding:0;}.toggle-wrapper.marg-left>.collapse-toggle{left:-24px;}.content .docblock>.impl-items .table-display,.impl-items table td{border:none;}.content .item-info code{font-size:90%;}.content .item-info{position:relative;margin-left:33px;margin-top:-13px;}.sub-variant>div>.item-info{margin-top:initial;}.content .item-info::before{content:'⬑';font-size:25px;position:absolute;top:-6px;left:-19px;}.content .impl-items .method,.content .impl-items>.type,.impl-items>.associatedconstant{margin-left:20px;}.content .impl-items .docblock,.content .impl-items .item-info{margin-bottom:.6em;}.content .impl-items>.item-info{margin-left:40px;}.methods>.item-info,.content .impl-items>.item-info{margin-top:-8px;}.impl-items{flex-basis:100%;}#main>.item-info{margin-top:0;}nav:not(.sidebar){border-bottom:1px solid;padding-bottom:10px;margin-bottom:10px;}nav.main{padding:20px 0;text-align:center;}nav.main .current{border-top:1px solid;border-bottom:1px solid;}nav.main .separator{border:1px solid;display:inline-block;height:23px;margin:0 20px;}nav.sum{text-align:right;}nav.sub form{display:inline;}nav.sub,.content{margin-left:230px;}a{text-decoration:none;background:transparent;}.small-section-header:hover>.anchor{display:initial;}.in-band:hover>.anchor,.impl:hover>.anchor,.method.trait-impl:hover>.anchor,.type.trait-impl:hover>.anchor,.associatedconstant.trait-impl:hover>.anchor{display:inline-block;position:absolute;}.anchor{display:none;position:absolute;left:-7px;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-28px;padding-right:10px;}.anchor:before{content:'\2002\00a7\2002';}.docblock a:not(.srclink):not(.test-arrow):hover,.docblock-short a:not(.srclink):not(.test-arrow):hover,.item-info a{text-decoration:underline;}.invisible>.srclink,h4>code+.srclink,h3>code+.srclink{position:absolute;top:0;right:0;font-size:17px;font-weight:normal;}.block a.current.crate{font-weight:500;}.search-container{position:relative;}.search-container>div{display:inline-flex;width:calc(100% - 63px);}#crate-search{min-width:115px;margin-top:5px;padding:6px;padding-right:19px;flex:none;border:0;border-right:0;border-radius:4px 0 0 4px;outline:none;cursor:pointer;border-right:1px solid;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;text-overflow:"";background-repeat:no-repeat;background-color:transparent;background-size:20px;background-position:calc(100% - 1px) 56%;}.search-container>.top-button{position:absolute;right:0;top:10px;}.search-input{-moz-box-sizing:border-box !important;box-sizing:border-box !important;outline:none;border:none;border-radius:1px;margin-top:5px;padding:10px 16px;font-size:17px;transition:border-color 300ms ease;transition:border-radius 300ms ease-in-out;transition:box-shadow 300ms ease-in-out;width:100%;}#crate-search+.search-input{border-radius:0 1px 1px 0;width:calc(100% - 32px);}.search-input:focus{border-radius:2px;border:0;outline:0;}.search-results .desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:block;}.search-results a{display:block;}.content .search-results td:first-child{padding-right:0;width:50%;}.content .search-results td:first-child a{padding-right:10px;}.content .search-results td:first-child a:after{clear:both;content:"";display:block;}.content .search-results td:first-child a span{float:left;}tr.result span.primitive::after{content:' (primitive type)';font-style:italic;}tr.result span.keyword::after{content:' (keyword)';font-style:italic;}body.blur>:not(#help){filter:blur(8px);-webkit-filter:blur(8px);opacity:.7;}#help{width:100%;height:100vh;position:fixed;top:0;left:0;display:flex;justify-content:center;align-items:center;}#help>div{flex:0 0 auto;box-shadow:0 0 6px rgba(0,0,0,.2);width:550px;height:auto;border:1px solid;}#help dt{float:left;clear:left;display:block;margin-right:0.5rem;}#help>div>span{text-align:center;display:block;margin:10px 0;font-size:18px;border-bottom:1px solid #ccc;padding-bottom:4px;margin-bottom:6px;}#help dd{margin:5px 35px;}#help .infos{padding-left:0;}#help h1,#help h2{margin-top:0;}#help>div div{width:50%;float:left;padding:0 20px 20px 17px;;}.stab{display:table;border-width:1px;border-style:solid;padding:3px;margin-bottom:5px;font-size:90%;}.stab p{display:inline;}.stab summary{display:list-item;}.stab .emoji{font-size:1.5em;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.module-item .stab,.import-item .stab{border-radius:3px;display:inline-block;font-size:80%;line-height:1.2;margin-bottom:0;margin-right:.3em;padding:2px;vertical-align:text-bottom;}.module-item.unstable,.import-item.unstable{opacity:0.65;}.since{font-weight:normal;font-size:initial;position:absolute;right:0;top:0;}.impl-items .since,.impl .since,.methods .since{flex-grow:0;padding-left:12px;padding-right:2px;position:initial;}.impl-items .srclink,.impl .srclink,.methods .srclink{flex-grow:0;font-size:17px;font-weight:normal;}.impl-items code,.impl code,.methods code{flex-grow:1;}.impl-items h4,h4.impl,h3.impl,.methods h3{display:flex;flex-basis:100%;font-size:16px;margin-bottom:12px;justify-content:space-between;}.variants_table{width:100%;}.variants_table tbody tr td:first-child{width:1%;}td.summary-column{width:100%;}.summary{padding-right:0px;}pre.rust .question-mark{font-weight:bold;}a.test-arrow{display:inline-block;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:130%;top:5px;right:5px;z-index:1;}a.test-arrow:hover{text-decoration:none;}.section-header:hover a:before{position:absolute;left:-25px;padding-right:10px;content:'\2002\00a7\2002';}.section-header:hover a{text-decoration:none;}.section-header a{color:inherit;}.code-attribute{font-weight:300;}.collapse-toggle{font-weight:300;position:absolute;left:-23px;top:0;}h3>.collapse-toggle,h4>.collapse-toggle{font-size:0.8em;top:5px;}.toggle-wrapper>.collapse-toggle{left:-24px;margin-top:0px;}.toggle-wrapper{position:relative;margin-top:0;}.toggle-wrapper.collapsed{height:25px;transition:height .2s;margin-bottom:.6em;}.collapse-toggle>.inner{display:inline-block;width:1.2ch;text-align:center;}.collapse-toggle.hidden-default{position:relative;margin-left:20px;}.since+.srclink{display:table-cell;padding-left:10px;}.item-spacer{width:100%;height:12px;}.out-of-band>span.since{position:initial;font-size:20px;margin-right:5px;}.toggle-wrapper>.collapse-toggle{left:0;}.variant+.toggle-wrapper+.docblock>p{margin-top:5px;}.sub-variant,.sub-variant>h3{margin-top:0px !important;padding-top:1px;}#main>details>.sub-variant>h3{font-size:15px;margin-left:25px;margin-bottom:5px;}.sub-variant>div{margin-left:20px;margin-bottom:10px;}.sub-variant>div>span{display:block;position:relative;}.toggle-label{display:inline-block;margin-left:4px;margin-top:3px;}.docblock>.section-header:first-child{margin-left:15px;margin-top:0;}.docblock>.section-header:first-child:hover>a:before{left:-10px;}#main>.variant,#main>.structfield{display:block;}:target>code{opacity:1;}.information{position:absolute;left:-25px;margin-top:7px;z-index:1;}.tooltip{position:relative;display:inline-block;cursor:pointer;}.tooltip::after{display:none;text-align:center;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;font-size:16px;}.tooltip.ignore::after{content:"This example is not tested";}.tooltip.compile_fail::after{content:"This example deliberately fails to compile";}.tooltip.should_panic::after{content:"This example panics";}.tooltip.edition::after{content:"This code runs with edition " attr(data-edition);}.tooltip::before{content:" ";position:absolute;top:50%;left:16px;margin-top:-5px;border-width:5px;border-style:solid;display:none;}.tooltip:hover::before,.tooltip:hover::after{display:inline;}.tooltip.compile_fail,.tooltip.should_panic,.tooltip.ignore{font-weight:bold;font-size:20px;}.notable-traits-tooltip{display:inline-block;cursor:pointer;}.notable-traits:hover .notable-traits-tooltiptext,.notable-traits .notable-traits-tooltiptext.force-tooltip{display:inline-block;}.notable-traits .notable-traits-tooltiptext{display:none;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;z-index:10;font-size:16px;cursor:default;position:absolute;border:1px solid;}.notable-traits-tooltip::after{content:"\00a0\00a0\00a0";}.notable-traits .notable,.notable-traits .docblock{margin:0;}.notable-traits .docblock code.content{margin:0;padding:0;font-size:20px;}pre.rust.rust-example-rendered{position:relative;}pre.rust{tab-size:4;-moz-tab-size:4;}.search-failed{text-align:center;margin-top:20px;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#titles{height:35px;}#titles>button{float:left;width:33.3%;text-align:center;font-size:18px;cursor:pointer;border:0;border-top:2px solid;}#titles>button:not(:last-child){margin-right:1px;width:calc(33.3% - 1px);}#titles>button>div.count{display:inline-block;font-size:16px;}.notable-traits{cursor:pointer;z-index:2;margin-left:5px;}h4>.notable-traits{position:absolute;left:-44px;top:2px;}#all-types{text-align:center;border:1px solid;margin:0 10px;margin-bottom:10px;display:block;border-radius:7px;}#all-types>p{margin:5px 0;}#sidebar-toggle{position:fixed;top:30px;left:300px;z-index:10;padding:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;cursor:pointer;font-weight:bold;transition:left .5s;font-size:1.2em;border:1px solid;border-left:0;}#source-sidebar{position:fixed;top:0;bottom:0;left:0;width:300px;z-index:1;overflow:auto;transition:left .5s;border-right:1px solid;}#source-sidebar>.title{font-size:1.5em;text-align:center;border-bottom:1px solid;margin-bottom:6px;}.theme-picker{position:absolute;left:211px;top:19px;}.theme-picker button{outline:none;}#settings-menu,.help-button{position:absolute;top:10px;}#settings-menu{right:0;outline:none;}#theme-picker,#settings-menu,.help-button,#copy-path{padding:4px;width:27px;height:29px;border:1px solid;border-radius:3px;cursor:pointer;}.help-button{right:30px;font-family:"Fira Sans",Arial,sans-serif;text-align:center;font-size:17px;padding-top:2px;}#copy-path{height:30px;font-size:18px;margin-left:10px;padding:0 6px;width:28px;}#theme-choices{display:none;position:absolute;left:0;top:28px;border:1px solid;border-radius:3px;z-index:1;cursor:pointer;}#theme-choices>button{border:none;width:100%;padding:4px 8px;text-align:center;background:rgba(0,0,0,0);}#theme-choices>button:not(:first-child){border-top:1px solid;}@media (min-width:701px){.docblock>.information:first-child>.tooltip{margin-top:16px;}}@media (max-width:700px){body{padding-top:0px;}.rustdoc>.sidebar{height:45px;min-height:40px;margin:0;margin-left:-15px;padding:0 15px;position:static;z-index:11;}.sidebar>.location{float:right;margin:0px;margin-top:2px;padding:3px 10px 1px 10px;min-height:39px;background:inherit;text-align:left;font-size:24px;}.sidebar .location:empty{padding:0;}.sidebar .logo-container{width:35px;height:35px;margin-top:5px;margin-bottom:5px;float:left;margin-left:50px;}.sidebar .logo-container>img{max-width:35px;max-height:35px;}.sidebar-menu{position:fixed;z-index:10;font-size:2rem;cursor:pointer;width:45px;left:0;text-align:center;display:block;border-bottom:1px solid;border-right:1px solid;height:45px;}.rustdoc.source>.sidebar>.sidebar-menu{display:none;}.sidebar-elems{position:fixed;z-index:1;left:0;top:45px;bottom:0;overflow-y:auto;border-right:1px solid;display:none;}.sidebar>.block.version{border-bottom:none;margin-top:12px;margin-bottom:0;}nav.sub{width:calc(100% - 32px);float:right;}.content{margin-left:0px;}#main,#search{margin-top:45px;padding:0;}.content h4>.out-of-band{position:inherit;}.toggle-wrapper>.collapse-toggle{left:0px;}.toggle-wrapper{height:1.5em;}#search{margin-left:0;}.content .impl-items .method,.content .impl-items>.type,.impl-items>.associatedconstant{display:flex;}.anchor{display:none !important;}.theme-picker{left:10px;top:54px;z-index:1;}h4>.notable-traits{position:absolute;left:-22px;top:24px;}#titles>button>div.count{float:left;width:100%;}#titles{height:50px;}.sidebar.mobile{position:fixed;width:100%;margin-left:0;background-color:rgba(0,0,0,0);height:100%;}.sidebar.mobile>div.version{overflow:hidden;max-height:33px;}.sidebar{width:calc(100% + 30px);}.show-it{display:block;width:246px;}.show-it>.block.items{margin:8px 0;}.show-it>.block.items>ul{margin:0;}.show-it>.block.items>ul>li{text-align:center;margin:2px 0;}.show-it>.block.items>ul>li>a{font-size:21px;}#sidebar-filler{position:fixed;left:45px;width:calc(100% - 45px);top:0;height:45px;z-index:-1;border-bottom:1px solid;}.collapse-toggle{left:-20px;}.impl>.collapse-toggle{left:-10px;}.item-list>details.rustdoc-toggle>summary:not(.hideme)::before{left:-10px;}#all-types{margin:10px;}#sidebar-toggle{top:100px;width:30px;font-size:1.5rem;text-align:center;padding:0;}#source-sidebar{z-index:11;}#main>.line-numbers{margin-top:0;}.notable-traits .notable-traits-tooltiptext{left:0;top:100%;}.help-button{display:none;}.search-container>div{width:calc(100% - 32px);}}@media print{nav.sub,.content .out-of-band,.collapse-toggle{display:none;}}@media (max-width:464px){#titles,#titles>button{height:73px;}#main,#search{margin-top:100px;}#main>table:not(.table-display) td{word-break:break-word;width:50%;}.search-container>div{display:block;width:calc(100% - 37px);}#crate-search{width:100%;border-radius:4px;border:0;}#crate-search+.search-input{width:calc(100% + 71px);margin-left:-36px;}#theme-picker,#settings-menu{padding:5px;width:31px;height:31px;}#theme-picker{margin-top:-2px;}#settings-menu{top:7px;}.docblock{margin-left:12px;}}h3.notable{margin:0;margin-bottom:13px;font-size:19px;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px;border-radius:3px;box-shadow:inset 0 -1px 0;cursor:default;}.hidden-by-impl-hider,.hidden-by-usual-hider{display:none !important;}#implementations-list>h3>span.in-band{width:100%;}.table-display{width:100%;border:0;border-collapse:collapse;border-spacing:0;font-size:16px;}.table-display tr td:first-child{padding-right:0;}.table-display tr td:last-child{float:right;}.table-display .out-of-band{position:relative;font-size:19px;display:block;}#implementors-list>.impl-items .table-display .out-of-band{font-size:17px;}.table-display td:hover .anchor{display:block;top:2px;left:-5px;}#main>ul{padding-left:10px;}#main>ul>li{list-style:none;}.non-exhaustive{margin-bottom:1em;}div.children{padding-left:27px;display:none;}div.name{cursor:pointer;position:relative;margin-left:16px;}div.files>a{display:block;padding:0 3px;}div.files>a:hover,div.name:hover{background-color:#a14b4b;}div.name.expand+.children{display:block;}div.name::before{content:"\25B6";padding-left:4px;font-size:0.7em;position:absolute;left:-16px;top:4px;}div.name.expand::before{transform:rotate(90deg);left:-15px;top:2px;}details.rustdoc-toggle>summary.hideme{cursor:pointer;}details.rustdoc-toggle>summary::-webkit-details-marker{display:none;}details.rustdoc-toggle>summary.hideme>span{margin-left:9px;}details.rustdoc-toggle>summary::before{content:"[+]";font-weight:300;font-size:0.8em;letter-spacing:1px;cursor:pointer;}details.rustdoc-toggle>summary.hideme::before{position:relative;}details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-23px;}details.rustdoc-toggle[open] >summary.hideme{position:absolute;}details.rustdoc-toggle[open]{position:relative;}details.rustdoc-toggle[open] >summary.hideme>span{display:none;}details.rustdoc-toggle[open] >summary::before{content:"[−]";display:inline;} \ No newline at end of file diff --git a/0.10.1/search-index.js b/0.10.1/search-index.js new file mode 100644 index 000000000..aae41d6e0 --- /dev/null +++ b/0.10.1/search-index.js @@ -0,0 +1,4 @@ +var searchIndex = JSON.parse('{\ +"chemfiles":{"doc":"Chemfiles is a multi-language library written in modern …","t":[13,13,3,3,3,4,13,4,13,13,13,13,3,13,13,3,3,13,3,13,13,13,3,4,13,13,13,3,3,3,13,13,4,13,13,13,3,3,3,13,13,13,3,3,3,13,13,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,12,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,12,11,5,11,11,11,11,12],"n":["Amide","Aromatic","Atom","AtomMut","AtomRef","BondOrder","Bool","CellShape","ChemfilesError","ConfigurationError","Double","Double","Error","FileError","FormatError","FormatMetadata","Frame","Infinite","Match","MemoryError","Orthorhombic","OutOfBounds","PropertiesIter","Property","PropertyError","Quadruple","Quintuplet","Residue","ResidueRef","Selection","SelectionError","Single","Status","StdCppError","String","Success","Topology","TopologyRef","Trajectory","Triclinic","Triple","UTF8PathError","UnitCell","UnitCellMut","UnitCellRef","Unknown","Vector3D","add_atom","add_atom","add_atom","add_bond","add_bond","add_bond_with_order","add_bond_with_order","add_configuration","add_residue","add_residue","add_velocities","angle","angles","angles","angles_count","are_linked","atom","atom","atom_mut","atom_mut","atomic_number","atomic_type","atoms","atoms","bond_order","bond_orders","bonds","bonds","bonds_count","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","cell","cell_mut","charge","cleanup","clear_bonds","clear_bonds","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","contains","count","covalent_radius","deref","deref","deref","deref","deref","deref","deref_mut","deref_mut","description","description","dihedral","dihedrals","dihedrals_count","distance","drop","drop","drop","drop","drop","drop","drop","eq","eq","eq","eq","eq","eq","eq","evaluate","extension","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","formats_list","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_matrix","full_name","get","get","get","guess_bonds","guess_format","has_velocities","id","impropers","impropers_count","index","infinite","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into_iter","iter","last_error","len","lengths","list","mass","matrix","memory","memory_buffer","memory_reader","memory_writer","message","name","name","name","ne","ne","ne","ne","new","new","new","new","new","new","new","next","nsteps","open","open_with_format","out_of_plane","partial_cmp","partial_cmp","path","positions","positions","positions_mut","properties","properties","properties","read","read","read_step","reference","remove","remove","remove_bond","remove_bond","residue","residue_for_atom","residues","residues_count","resize","resize","set","set","set","set_angles","set_atomic_type","set_cell","set_cell","set_charge","set_lengths","set_mass","set_name","set_shape","set_step","set_topology","set_topology","set_topology_file","set_topology_with_format","set_warning_callback","shape","size","size","size","size","size_hint","status","step","string","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","topology","triclinic","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","unit_cell","vdw_radius","velocities","velocities","velocities_mut","version","volume","with_id","wrap","write","write"],"q":["chemfiles","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Amide bond (required by some file formats)","Aromatic bond (required by some file formats)","An Atom is a particle in the current Frame. It stores the …","An analog to a mutable reference to an atom (&mut Atom)","An analog to a reference to an atom (&Atom)","Possible bond order associated with bonds","Boolean property","Available unit cell shapes.","Exception in the C++ chemfiles library","Error in configuration files syntax","Double bond","Floating point property","Error type for Chemfiles.","Error while reading or writing a file","Error in file formatting, i.e. the file is invalid","FormatMetadata contains metadata associated with one …","A Frame contains data from one simulation step: the …","Infinite cell, to use when there is no cell.","A Match is a set of atomic indexes matching a given …","Error in memory allocations","Orthorhombic cell, with the three angles equals to 90°.","Error for out of bounds indexing","An iterator over the properties in an atom/frame/residue","A Property is a piece of data that can be associated with …","Error related to properties","Quadruple bond (present in some metals)","Quintuplet bond (present in some metals)","A Residue is a group of atoms belonging to the same …","An analog to a reference to a residue (&Residue)","A Selection allow to select atoms in a Frame, from a …","Error in selection string syntax","Single bond","Possible causes of error in chemfiles","Exception in the C++ standard library","String property","No error","A Topology contains the definition of all the atoms in …","An analog to a reference to a topology (&Topology)","The Trajectory type is the main entry point when using …","Triclinic cell, with any values for the angles.","Triple bond","The given path is not valid UTF8","An UnitCell represent the box containing the atoms, and …","An analog to a mutable reference to an unit cell (…","An analog to a reference to an unit cell (&UnitCell)","Unknown or unspecified bond order","3-dimensional vector property","Add the atom at index atom in this residue.","Add an Atom at the end of this topology","Add an Atom and the corresponding position and optionally …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Read configuration data from the file at path.","Add a residue to this topology.","Add a copy of residue to this frame.","Add velocity data to this frame. If the frame already …","Get the angle formed by the atoms at indexes i, j and k …","Get the three angles of the cell, in degrees.","Get the list of angles in the topology.","Get the number of angles in the topology.","Check if the two residues first and second from the …","Get a reference of the atom at the given index in this …","Get a reference to the atom at the given index in this …","Get a mutable reference to the atom at the given index in …","Get a mutable reference to the atom at the given index in …","Try to get the atomic number of the atom from the atomic …","Get the atom type.","Get the list of atoms of this residue.","Does this format support storing atom names or types?","Get the bond order for the bond between the atoms at …","Get the bond order for all the bonds in the topology","Get the list of bonds in the topology.","Does this format support storing bonds between atoms?","Get the number of bonds in the topology.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get a reference to the UnitCell from this frame.","Get a mutable reference to the UnitCell from this frame.","Get the atom charge, in number of the electron charge e.","Clear any error from the C++ library","Remove all existing bonds, angles, dihedral angles and …","Remove all existing bonds, angles, dihedral angles and …","","","","","","","","","","","","","","","","","","","","","","","","","","","","Check if the atom at index i is in this residue","","Try to get the covalent radius of the atom from the …","","","","","","","","","","Extended, user-facing description of the format.","Get the dihedral angle formed by the atoms at indexes i, j…","Get the list of dihedral angles in the topology.","Get the number of dihedral angles in the topology.","Get the distance between the atoms at indexes i and j in …","","","","","","","","","","","","","","","Evaluate a selection for a given frame, and return the …","Extension associated with the format.","","","","","","","","","Get the list of formats known by chemfiles, as well as …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Create an UnitCell from a cell matrix. If matrix contains …","Try to get the full name of the atom from the atomic …","Get a property with the given name in this atom, if it …","Get a property with the given name in this frame, if it …","Get a property with the given name in this frame, if it …","Guess the bonds, angles and dihedrals in this frame.","Get the format that chemfiles would use to read a file at …","Check if this frame contains velocity data.","Get the identifier of this residue in the initial …","Get the list of improper dihedral angles in the topology.","Get the number of improper dihedral angles in the …","","Create an Infinite UnitCell.","","","","","","","","","","","","","","","","","","","","","","","Iterate over the atomic indexes in the match.","Get the last error message from the C++ library.","Get the length of the Match.","Get the three lengths of the cell, in Angstroms.","Evaluates a selection of size 1 on a given frame. This …","Get the atom mass, in atomic mass units.","Get the unit cell matricial representation.","Does this format support in-memory IO?","Obtain the memory buffer written to by the trajectory.","Read a memory buffer as though it was a formatted file.","Write to a memory buffer as though it was a formatted …","A message describing the error cause","Get the atom name.","Get the name of this residue.","Name of the format.","","","","","Create an atom with the given name, and set the atom type …","Create an Orthorhombic UnitCell from the three lengths, …","Create a new residue with the given name","Create a new empty topology.","Create an empty frame. It will be resized by the library …","Create a new selection from the given selection string.","Create a new match containing the atoms in the atoms …","","Get the number of steps (the number of frames) in a …","Open the file at the given path in the given mode.","Open the file at the given path using a specific file …","Get the out of plane distance formed by the atoms at …","","","Get file path for this trajectory.","Get a view into the positions of this frame.","Does this format support storing atomic positions?","Get a mutable view into the positions of this frame.","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Read the next step of this trajectory into a frame.","Is reading files in this format implemented?","Read a specific step of this trajectory into a frame.","URL pointing to the format definition/reference.","Remove an Atom from this topology by index. This modify …","Remove the atom at index i in this frame.","Remove any existing bond between the atoms at indexes i …","Remove any existing bond between the atoms at indexes i …","Get a reference to the residue at index index from this …","Get a copy of the residue containing the atom at index …","Does this format support storing residues?","Get the number of residues in this topology.","Resize this topology to hold natoms atoms, inserting …","Resize the positions and the velocities in this frame, to …","Add a new property with the given name to this atom.","Add a new property with the given name to this residue.","Add a new property with the given name to this frame.","Set the three angles of the cell, in degrees.","Set the atom type to atomic_type.","Set the UnitCell of this frame to cell.","Set the unit cell associated with a trajectory. This cell …","Set the atom charge to charge, in number of the electron …","Set the three lengths of the cell, in Angstroms.","Set the atom mass to mass, in atomic mass units.","Set the atom name to name.","Set the shape of the unit cell to shape.","Set this frame step to step.","Set the Topology of this frame to topology.","Set the topology associated with this trajectory. This …","Set the topology associated with this trajectory by …","Set the topology associated with this trajectory by …","Use callback for every chemfiles warning. The callback …","Get the shape of the unit cell.","Get the number of atoms in this residue.","Get the current number of atoms in this topology.","Get the current number of atoms in this frame.","Get the size of the selection, i.e. the number of atoms …","","The error status code","Get this frame step, i.e. the frame number in the …","Get the selection string used to create this selection.","","","","","","","","","","","","","","","Get a reference to the Topology of this frame.","Create an Triclinic UnitCell from the three lengths (in …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Does this format support storing unit cell information?","Try to get the Van der Waals radius of the atom from the …","Get a view into the velocities of this frame.","Does this format support storing atomic velocities?","Get a mutable view into the velocities of this frame.","Get the version of the chemfiles library.","Get the volume of the unit cell.","Create a new residue with the given name and id as …","Wrap a vector in this unit cell.","Write a frame to this trajectory.","Is writing files in this format implemented?"],"i":[1,1,0,0,0,0,2,0,3,3,1,2,0,3,3,0,0,4,0,3,4,3,0,0,3,1,1,0,0,0,3,1,0,3,2,3,0,0,0,4,1,3,0,0,0,1,2,5,6,7,6,7,6,7,0,6,7,7,7,8,6,6,6,6,7,6,7,9,9,5,10,6,6,6,10,6,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,7,7,9,20,6,7,9,8,5,6,7,18,20,3,4,1,21,2,10,9,8,5,6,7,18,20,3,4,1,21,2,10,1,5,19,9,11,12,13,14,15,16,12,14,20,10,7,6,6,7,9,8,5,6,7,17,18,20,3,4,1,21,2,10,18,10,20,20,3,4,1,21,2,10,0,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,20,20,3,4,4,1,1,21,2,2,2,2,2,2,10,8,9,9,5,7,7,0,7,5,6,6,21,8,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,19,21,20,21,8,18,9,8,10,17,17,17,20,9,5,10,20,21,2,10,9,8,5,6,7,18,21,19,17,17,17,7,1,2,17,7,10,7,9,5,7,17,10,17,10,6,7,6,7,6,6,10,6,6,7,9,5,7,8,9,7,17,9,8,9,9,8,7,7,17,17,17,0,8,5,6,7,18,19,20,7,18,9,8,5,6,7,18,20,3,4,1,21,2,10,20,7,8,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,10,9,7,10,7,0,8,5,8,17,10],"f":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["usize",15]]],[[["atom",3]]],[[["atom",3]]],[[["usize",15]]],[[["usize",15]]],[[["usize",15],["bondorder",4]]],[[["usize",15],["bondorder",4]]],[[],[["error",3],["result",4]]],[[["residue",3]],[["error",3],["result",4]]],[[["residue",3]],[["error",3],["result",4]]],[[]],[[["usize",15]],["f64",15]],[[]],[[],["vec",3]],[[],["usize",15]],[[["residue",3]],["bool",15]],[[["usize",15]],["atomref",3]],[[["usize",15]],["atomref",3]],[[["usize",15]],["atommut",3]],[[["usize",15]],["atommut",3]],[[],["u64",15]],[[],["string",3]],[[],[["vec",3],["usize",15]]],null,[[["usize",15]],["bondorder",4]],[[],[["vec",3],["bondorder",4]]],[[],["vec",3]],null,[[],["usize",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["unitcellref",3]],[[],["unitcellmut",3]],[[],["f64",15]],[[]],[[]],[[]],[[],["atom",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["frame",3]],[[],["selection",3]],[[],["error",3]],[[],["status",4]],[[],["cellshape",4]],[[],["bondorder",4]],[[],["match",3]],[[],["property",4]],[[],["formatmetadata",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["bondorder",4]],["ordering",4]],[[["usize",15]],["bool",15]],[[],["usize",15]],[[],["f64",15]],[[],["atom",3]],[[],["atom",3]],[[],["unitcell",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["atom",3]],[[],["unitcell",3]],[[],["str",15]],null,[[["usize",15]],["f64",15]],[[],["vec",3]],[[],["usize",15]],[[["usize",15]],["f64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["error",3]],["bool",15]],[[["status",4]],["bool",15]],[[["cellshape",4]],["bool",15]],[[["bondorder",4]],["bool",15]],[[["match",3]],["bool",15]],[[["property",4]],["bool",15]],[[["formatmetadata",3]],["bool",15]],[[["frame",3]],[["vec",3],["match",3]]],null,[[["formatter",3]],[["error",3],["result",4]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[],[["vec",3],["formatmetadata",3]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["chfl_status",4]],["error",3]],[[]],[[["utf8error",3]]],[[]],[[["chfl_cellshape",4]],["cellshape",4]],[[]],[[["chfl_bond_order",4]],["bondorder",4]],[[]],[[]],[[["f64",15]]],[[["bool",15]]],[[]],[[["string",3]]],[[["str",15]]],[[]],[[]],[[],["unitcell",3]],[[],["string",3]],[[["str",15]],[["property",4],["option",4]]],[[["str",15]],[["property",4],["option",4]]],[[["str",15]],[["property",4],["option",4]]],[[],[["error",3],["result",4]]],[[["str",15]],["string",3]],[[],["bool",15]],[[],[["i64",15],["option",4]]],[[],["vec",3]],[[],["usize",15]],[[["usize",15]]],[[],["unitcell",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],[["iter",3],["usize",15]]],[[],["string",3]],[[],["usize",15]],[[]],[[["frame",3]],[["vec",3],["usize",15]]],[[],["f64",15]],[[]],null,[[],[["result",4],["error",3],["str",15]]],[[],[["error",3],["trajectory",3],["result",4]]],[[],[["error",3],["trajectory",3],["result",4]]],null,[[],["string",3]],[[],["string",3]],null,[[["error",3]],["bool",15]],[[["match",3]],["bool",15]],[[["property",4]],["bool",15]],[[["formatmetadata",3]],["bool",15]],[[],["atom",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["frame",3]],[[["into",8],["str",15]],[["error",3],["selection",3],["result",4]]],[[],["match",3]],[[],["option",4]],[[],["usize",15]],[[["char",15]],[["error",3],["trajectory",3],["result",4]]],[[["char",15]],[["error",3],["trajectory",3],["result",4]]],[[["usize",15]],["f64",15]],[[["bondorder",4]],[["option",4],["ordering",4]]],[[["property",4]],[["option",4],["ordering",4]]],[[],["string",3]],[[]],null,[[]],[[],["propertiesiter",3]],[[],["propertiesiter",3]],[[],["propertiesiter",3]],[[["frame",3]],[["error",3],["result",4]]],null,[[["frame",3],["usize",15]],[["error",3],["result",4]]],null,[[["usize",15]]],[[["usize",15]]],[[["usize",15]]],[[["usize",15]]],[[["u64",15]],[["residueref",3],["option",4]]],[[["usize",15]],[["residueref",3],["option",4]]],null,[[],["u64",15]],[[["usize",15]]],[[["usize",15]]],[[["str",15]]],[[["str",15]]],[[["str",15]]],[[],[["error",3],["result",4]]],[[]],[[["unitcell",3]]],[[["unitcell",3]]],[[["f64",15]]],[[],[["error",3],["result",4]]],[[["f64",15]]],[[]],[[["cellshape",4]],[["error",3],["result",4]]],[[["usize",15]]],[[["topology",3]],[["error",3],["result",4]]],[[["topology",3]]],[[],[["error",3],["result",4]]],[[],[["error",3],["result",4]]],[[]],[[],["cellshape",4]],[[],["usize",15]],[[],["usize",15]],[[],["usize",15]],[[],["usize",15]],[[]],null,[[],["usize",15]],[[],["string",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[],["topologyref",3]],[[],["unitcell",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],null,[[],["f64",15]],[[]],null,[[]],[[],["string",3]],[[],["f64",15]],[[["i64",15]],["residue",3]],[[]],[[["frame",3]],[["error",3],["result",4]]],null],"p":[[4,"BondOrder"],[4,"Property"],[4,"Status"],[4,"CellShape"],[3,"Residue"],[3,"Topology"],[3,"Frame"],[3,"UnitCell"],[3,"Atom"],[3,"FormatMetadata"],[3,"AtomRef"],[3,"AtomMut"],[3,"UnitCellRef"],[3,"UnitCellMut"],[3,"ResidueRef"],[3,"TopologyRef"],[3,"Trajectory"],[3,"Selection"],[3,"PropertiesIter"],[3,"Error"],[3,"Match"]]}\ +}'); +if (window.initSearch) {window.initSearch(searchIndex)}; \ No newline at end of file diff --git a/0.10.1/search.js b/0.10.1/search.js new file mode 100644 index 000000000..b2fd05d49 --- /dev/null +++ b/0.10.1/search.js @@ -0,0 +1 @@ +(function(){var itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias"];var TY_PRIMITIVE=itemTypes.indexOf("primitive");var TY_KEYWORD=itemTypes.indexOf("keyword");function printTab(nb){if(nb===0||nb===1||nb===2){searchState.currentTab=nb}var nb_copy=nb;onEachLazy(document.getElementById("titles").childNodes,function(elem){if(nb_copy===0){addClass(elem,"selected")}else{removeClass(elem,"selected")}nb_copy-=1});onEachLazy(document.getElementById("results").childNodes,function(elem){if(nb===0){elem.style.display=""}else{elem.style.display="none"}nb-=1})}function removeEmptyStringsFromArray(x){for(var i=0,len=x.length;i-1){var obj=searchIndex[results[i].id];obj.lev=results[i].lev;if(isType!==true||obj.type){var res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}}return out}function sortResults(results,isType){var ar=[];for(var entry in results){if(hasOwnProperty(results,entry)){ar.push(results[entry])}}results=ar;var i,len,result;for(i=0,len=results.length;ib?+1:-1)}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});for(i=0,len=results.length;i"));return{name:val.substring(0,val.indexOf("<")),generics:values.split(/\s*,\s*/),}}return{name:val,generics:[],}}function getObjectNameFromId(id){if(typeof id==="number"){return searchIndex[id].name}return id}function checkGenerics(obj,val){var tmp_lev,elem_name;if(val.generics.length>0){if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>=val.generics.length){var elems=Object.create(null);var elength=object[GENERICS_DATA].length;for(var x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length>=val.generics.length){var elems=Object.create(null);len=obj[GENERICS_DATA].length;for(x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length!==0){var tmp_lev=checkGenerics(obj,val);if(tmp_lev<=MAX_LEV_DISTANCE){return tmp_lev}}else{return 0}}if(literalSearch===true){if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){return obj[GENERICS_DATA].some(function(name){return name===val.name})}return false}lev_distance=Math.min(levenshtein(obj[NAME],val.name),lev_distance);if(lev_distance<=MAX_LEV_DISTANCE){lev_distance=Math.ceil((checkGenerics(obj,val)+lev_distance)/2)}else if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){var olength=obj[GENERICS_DATA].length;for(x=0;x0){var length=obj.type[INPUTS_DATA].length;for(var i=0;iOUTPUT_DATA){var ret=obj.type[OUTPUT_DATA];if(typeof ret[0]==="string"){ret=[ret]}for(var x=0,len=ret.length;xlength){return MAX_LEV_DISTANCE+1}for(var i=0;ilength){break}var lev_total=0;var aborted=false;for(var x=0;xMAX_LEV_DISTANCE){aborted=true;break}lev_total+=lev}if(aborted===false){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER)return true;if(filter===type)return true;var name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates){var aliases=[];var crateAliases=[];if(filterCrates!==undefined){if(ALIASES[filterCrates]&&ALIASES[filterCrates][query.search]){var query_aliases=ALIASES[filterCrates][query.search];var len=query_aliases.length;for(var i=0;iMAX_RESULTS){ret.others.pop()}};onEach(aliases,pushFunc);onEach(crateAliases,pushFunc)}var nSearchWords=searchWords.length;var i,it;var ty;var fullId;var returned;var in_args;var len;if((val.charAt(0)==="\""||val.charAt(0)==="'")&&val.charAt(val.length-1)===val.charAt(0)){val=extractGenerics(val.substr(1,val.length-2));for(i=0;i")>-1){var trimmer=function(s){return s.trim()};var parts=val.split("->").map(trimmer);var input=parts[0];var inputs=input.split(",").map(trimmer).sort();for(i=0,len=inputs.length;i1?paths.length-1:1);var lev,j;for(j=0;j1){lev=checkPath(contains,paths[paths.length-1],ty);if(lev>MAX_LEV_DISTANCE){continue}else if(lev>0){lev_add=lev/10}}returned=MAX_LEV_DISTANCE+1;in_args=MAX_LEV_DISTANCE+1;var index=-1;lev=MAX_LEV_DISTANCE+1;fullId=ty.id;if(searchWords[j].indexOf(split[i])>-1||searchWords[j].indexOf(val)>-1||ty.normalizedName.indexOf(val)>-1){if(typePassesFilter(typeFilter,ty.ty)&&results[fullId]===undefined){index=ty.normalizedName.indexOf(val)}}if((lev=levenshtein(searchWords[j],val))<=MAX_LEV_DISTANCE){if(typePassesFilter(typeFilter,ty.ty)===false){lev=MAX_LEV_DISTANCE+1}else{lev+=1}}in_args=findArg(ty,valGenerics,false,typeFilter);returned=checkReturned(ty,valGenerics,false,typeFilter);lev+=lev_add;if(lev>0&&val.length>3&&searchWords[j].indexOf(val)>-1){if(val.length<6){lev-=1}else{lev=0}}if(in_args<=MAX_LEV_DISTANCE){if(results_in_args[fullId]===undefined){results_in_args[fullId]={id:j,index:index,lev:in_args,}}results_in_args[fullId].lev=Math.min(results_in_args[fullId].lev,in_args)}if(returned<=MAX_LEV_DISTANCE){if(results_returned[fullId]===undefined){results_returned[fullId]={id:j,index:index,lev:returned,}}results_returned[fullId].lev=Math.min(results_returned[fullId].lev,returned)}if(index!==-1||lev<=MAX_LEV_DISTANCE){if(index!==-1&&paths.length<2){lev=0}if(results[fullId]===undefined){results[fullId]={id:j,index:index,lev:lev,}}results[fullId].lev=Math.min(results[fullId].lev,lev)}}}var ret={"in_args":sortResults(results_in_args,true),"returned":sortResults(results_returned,true),"others":sortResults(results),};handleAliases(ret,query,filterCrates);return ret}function validateResult(name,path,keys,parent){for(var i=0,len=keys.length;i-1||path.indexOf(keys[i])>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(keys[i])>-1)||levenshtein(name,keys[i])<=MAX_LEV_DISTANCE)){return false}}return true}function getQuery(raw){var matches,type,query;query=raw;matches=query.match(/^(fn|mod|struct|enum|trait|type|const|macro)\s*:\s*/i);if(matches){type=matches[1].replace(/^const$/,"constant");query=query.substring(matches[0].length)}return{raw:raw,query:query,type:type,id:query+type}}function initSearchNav(){var hoverTimeout;var click_func=function(e){var el=e.target;while(el.tagName!=="TR"){el=el.parentNode}var dst=e.target.getElementsByTagName("a");if(dst.length<1){return}dst=dst[0];if(window.location.pathname===dst.pathname){searchState.hideResults();document.location.href=dst.href}};var mouseover_func=function(e){if(searchState.mouseMovedAfterSearch){var el=e.target;while(el.tagName!=="TR"){el=el.parentNode}clearTimeout(hoverTimeout);hoverTimeout=setTimeout(function(){onEachLazy(document.getElementsByClassName("search-results"),function(e){onEachLazy(e.getElementsByClassName("result"),function(i_e){removeClass(i_e,"highlighted")})});addClass(el,"highlighted")},20)}};onEachLazy(document.getElementsByClassName("search-results"),function(e){onEachLazy(e.getElementsByClassName("result"),function(i_e){i_e.onclick=click_func;i_e.onmouseover=mouseover_func})});searchState.input.onkeydown=function(e){var actives=[[],[],[]];var current=0;onEachLazy(document.getElementById("results").childNodes,function(e){onEachLazy(e.getElementsByClassName("highlighted"),function(h_e){actives[current].push(h_e)});current+=1});var SHIFT=16;var CTRL=17;var ALT=18;var currentTab=searchState.currentTab;if(e.which===38){if(e.ctrlKey){printTab(currentTab>0?currentTab-1:2)}else{if(!actives[currentTab].length||!actives[currentTab][0].previousElementSibling){return}addClass(actives[currentTab][0].previousElementSibling,"highlighted");removeClass(actives[currentTab][0],"highlighted")}e.preventDefault()}else if(e.which===40){if(e.ctrlKey){printTab(currentTab>1?0:currentTab+1)}else if(!actives[currentTab].length){var results=document.getElementById("results").childNodes;if(results.length>0){var res=results[currentTab].getElementsByClassName("result");if(res.length>0){addClass(res[0],"highlighted")}}}else if(actives[currentTab][0].nextElementSibling){addClass(actives[currentTab][0].nextElementSibling,"highlighted");removeClass(actives[currentTab][0],"highlighted")}e.preventDefault()}else if(e.which===13){if(actives[currentTab].length){var elem=actives[currentTab][0].getElementsByTagName("a")[0];document.location.href=elem.href}}else if([SHIFT,CTRL,ALT].indexOf(e.which)!==-1){}else if(actives[currentTab].length>0){removeClass(actives[currentTab][0],"highlighted")}}}function buildHrefAndPath(item){var displayPath;var href;var type=itemTypes[item.ty];var name=item.name;var path=item.path;if(type==="mod"){displayPath=path+"::";href=window.rootPath+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="primitive"||type==="keyword"){displayPath="";href=window.rootPath+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=window.rootPath+name+"/index.html"}else if(item.parent!==undefined){var myparent=item.parent;var anchor="#"+type+"."+name;var parentType=itemTypes[myparent.ty];var pageType=parentType;var pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){var enumNameIdx=item.path.lastIndexOf("::");var enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=window.rootPath+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=window.rootPath+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function escape(content){var h1=document.createElement("h1");h1.textContent=content;return h1.innerHTML}function pathSplitter(path){var tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){var extraStyle="";if(display===false){extraStyle=" style=\"display: none;\""}var output="";var duplicates={};var length=0;if(array.length>0){output="";array.forEach(function(item){var name,type;name=item.name;type=itemTypes[item.ty];if(item.is_alias!==true){if(duplicates[item.fullPath]){return}duplicates[item.fullPath]=true}length+=1;output+=""});output+="
"+""+(item.is_alias===true?(""+item.alias+"  - see "):"")+item.displayPath+""+name+""+""+""+item.desc+" 
"}else{output="
No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:
"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results){var search=searchState.outputElement();if(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==searchState.loadingText)){var elem=document.createElement("a");elem.href=results.others[0].href;elem.style.display="none";document.body.appendChild(elem);elem.click();return}var query=getQuery(searchState.input.value);currentResults=query.id;var ret_others=addTab(results.others,query);var ret_in_args=addTab(results.in_args,query,false);var ret_returned=addTab(results.returned,query,false);var currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}var output="

Results for "+escape(query.query)+(query.type?" (type: "+escape(query.type)+")":"")+"

"+"
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"+ret_others[0]+ret_in_args[0]+ret_returned[0]+"
";search.innerHTML=output;searchState.showResults(search);initSearchNav();var elems=document.getElementById("titles").childNodes;elems[0].onclick=function(){printTab(0)};elems[1].onclick=function(){printTab(1)};elems[2].onclick=function(){printTab(2)};printTab(currentTab)}function execSearch(query,searchWords,filterCrates){function getSmallest(arrays,positions,notDuplicates){var start=null;for(var it=0,len=positions.length;itpositions[it]&&(start===null||start>arrays[it][positions[it]].lev)&&!notDuplicates[arrays[it][positions[it]].fullPath]){start=arrays[it][positions[it]].lev}}return start}function mergeArrays(arrays){var ret=[];var positions=[];var notDuplicates={};for(var x=0,arrays_len=arrays.length;xpositions[x]&&arrays[x][positions[x]].lev===smallest&&!notDuplicates[arrays[x][positions[x]].fullPath]){ret.push(arrays[x][positions[x]]);notDuplicates[arrays[x][positions[x]].fullPath]=true;positions[x]+=1}}}return ret}var queries=query.raw.split(",");var results={"in_args":[],"returned":[],"others":[],};for(var i=0,len=queries.length;i1){return{"in_args":mergeArrays(results.in_args),"returned":mergeArrays(results.returned),"others":mergeArrays(results.others),}}return{"in_args":results.in_args[0],"returned":results.returned[0],"others":results.others[0],}}function getFilterCrates(){var elem=document.getElementById("crate-search");if(elem&&elem.value!=="All crates"&&hasOwnProperty(rawSearchIndex,elem.value)){return elem.value}return undefined}function search(e,forced){var params=searchState.getQueryStringParams();var query=getQuery(searchState.input.value.trim());if(e){e.preventDefault()}if(query.query.length===0){return}if(forced!==true&&query.id===currentResults){if(query.query.length>0){searchState.putBackSearch(searchState.input)}return}searchState.title="Results for "+query.query+" - Rust";if(searchState.browserSupportsHistoryApi()){var newURL=getNakedUrl()+"?search="+encodeURIComponent(query.raw)+window.location.hash;if(!history.state&&!params.search){history.pushState(query,"",newURL)}else{history.replaceState(query,"",newURL)}}var filterCrates=getFilterCrates();showResults(execSearch(query,index,filterCrates))}function buildIndex(rawSearchIndex){searchIndex=[];var searchWords=[];var i,word;var currentIndex=0;var id=0;for(var crate in rawSearchIndex){if(!hasOwnProperty(rawSearchIndex,crate)){continue}var crateSize=0;searchWords.push(crate);var normalizedName=crate.indexOf("_")===-1?crate:crate.replace(/_/g,"");var crateRow={crate:crate,ty:1,name:crate,path:"",desc:rawSearchIndex[crate].doc,parent:undefined,type:null,id:id,normalizedName:normalizedName,};id+=1;searchIndex.push(crateRow);currentIndex+=1;var itemTypes=rawSearchIndex[crate].t;var itemNames=rawSearchIndex[crate].n;var itemPaths=rawSearchIndex[crate].q;var itemDescs=rawSearchIndex[crate].d;var itemParentIdxs=rawSearchIndex[crate].i;var itemFunctionSearchTypes=rawSearchIndex[crate].f;var paths=rawSearchIndex[crate].p;var aliases=rawSearchIndex[crate].a;var len=paths.length;for(i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:itemFunctionSearchTypes[i],id:id,normalizedName:normalizedName,};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){ALIASES[crate]={};var j,local_aliases;for(var alias_name in aliases){if(!aliases.hasOwnProperty(alias_name)){continue}if(!ALIASES[crate].hasOwnProperty(alias_name)){ALIASES[crate][alias_name]=[]}local_aliases=aliases[alias_name];for(j=0,len=local_aliases.length;j0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=function(){var qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}index=buildIndex(rawSearchIndex);registerSearchEvents();if(searchState.getQueryStringParams().search){search()}};if(window.searchIndex!==undefined){initSearch(window.searchIndex)}})() \ No newline at end of file diff --git a/0.10.1/settings.css b/0.10.1/settings.css new file mode 100644 index 000000000..670986588 --- /dev/null +++ b/0.10.1/settings.css @@ -0,0 +1 @@ +.setting-line{padding:5px;position:relative;}.setting-line>div{display:inline-block;vertical-align:top;font-size:17px;padding-top:2px;}.setting-line>.title{font-size:19px;width:100%;max-width:none;border-bottom:1px solid;}.toggle{position:relative;display:inline-block;width:45px;height:27px;margin-right:20px;}.toggle input{opacity:0;position:absolute;}.select-wrapper{float:right;position:relative;height:27px;min-width:25%;}.select-wrapper select{appearance:none;-moz-appearance:none;-webkit-appearance:none;background:none;border:2px solid #ccc;padding-right:28px;width:100%;}.select-wrapper img{pointer-events:none;position:absolute;right:0;bottom:0;background:#ccc;height:100%;width:28px;padding:0px 4px;}.select-wrapper select option{color:initial;}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.3s;transition:.3s;}.slider:before{position:absolute;content:"";height:19px;width:19px;left:4px;bottom:4px;background-color:white;-webkit-transition:.3s;transition:.3s;}input:checked+.slider{background-color:#2196F3;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}input:checked+.slider:before{-webkit-transform:translateX(19px);-ms-transform:translateX(19px);transform:translateX(19px);}.setting-line>.sub-settings{padding-left:42px;width:100%;display:block;} \ No newline at end of file diff --git a/0.10.1/settings.html b/0.10.1/settings.html new file mode 100644 index 000000000..1caaf6a4c --- /dev/null +++ b/0.10.1/settings.html @@ -0,0 +1,6 @@ +Rustdoc settings + +

Rustdoc settings

Theme preferences
Use system theme
Preferred dark theme
Preferred light theme
+
Auto-hide item contents for large items.
Auto-hide item methods' documentation
Auto-hide trait implementation documentation
Auto-hide implementors of a trait
Directly go to item in search if there is only one result
Show line numbers on code examples
Disable keyboard shortcuts
+ \ No newline at end of file diff --git a/0.10.1/settings.js b/0.10.1/settings.js new file mode 100644 index 000000000..b4d6fdcd7 --- /dev/null +++ b/0.10.1/settings.js @@ -0,0 +1 @@ +(function(){function changeSetting(settingName,value){updateLocalStorage("rustdoc-"+settingName,value);switch(settingName){case"preferred-dark-theme":case"preferred-light-theme":case"use-system-theme":updateSystemTheme();break}}function handleKey(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey){return}switch(getVirtualKey(ev)){case"Enter":case"Return":case"Space":ev.target.checked=!ev.target.checked;ev.preventDefault();break}}function setEvents(){onEachLazy(document.getElementsByClassName("slider"),function(elem){var toggle=elem.previousElementSibling;var settingId=toggle.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=function(){changeSetting(this.id,this.checked)};toggle.onkeyup=handleKey;toggle.onkeyrelease=handleKey});onEachLazy(document.getElementsByClassName("select-wrapper"),function(elem){var select=elem.getElementsByTagName("select")[0];var settingId=select.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){select.value=settingValue}select.onchange=function(){changeSetting(this.id,this.value)}})}window.addEventListener("DOMContentLoaded",setEvents)})() \ No newline at end of file diff --git a/0.10.1/sidebar-items.js b/0.10.1/sidebar-items.js new file mode 100644 index 000000000..431587a63 --- /dev/null +++ b/0.10.1/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({}) \ No newline at end of file diff --git a/0.10.1/source-files.js b/0.10.1/source-files.js new file mode 100644 index 000000000..c49ec708c --- /dev/null +++ b/0.10.1/source-files.js @@ -0,0 +1,3 @@ +var N = null;var sourcesIndex = {}; +sourcesIndex["chemfiles"] = {"name":"","files":["atom.rs","cell.rs","errors.rs","frame.rs","lib.rs","misc.rs","property.rs","residue.rs","selection.rs","strings.rs","topology.rs","trajectory.rs"]}; +createSourceSidebar(); diff --git a/0.10.1/source-script.js b/0.10.1/source-script.js new file mode 100644 index 000000000..67f62a160 --- /dev/null +++ b/0.10.1/source-script.js @@ -0,0 +1 @@ +function getCurrentFilePath(){var parts=window.location.pathname.split("/");var rootPathParts=window.rootPath.split("/");for(var i=0,len=rootPathParts.length;i"){sidebar.style.left="";this.style.left="";child.innerText="<";updateLocalStorage("rustdoc-source-sidebar-show","true")}else{sidebar.style.left="-300px";this.style.left="0";child.innerText=">";updateLocalStorage("rustdoc-source-sidebar-show","false")}}function createSidebarToggle(){var sidebarToggle=document.createElement("div");sidebarToggle.id="sidebar-toggle";sidebarToggle.onclick=toggleSidebar;var inner1=document.createElement("div");inner1.style.position="relative";var inner2=document.createElement("div");inner2.style.paddingTop="3px";if(getCurrentValue("rustdoc-source-sidebar-show")==="true"){inner2.innerText="<"}else{inner2.innerText=">";sidebarToggle.style.left="0"}inner1.appendChild(inner2);sidebarToggle.appendChild(inner1);return sidebarToggle}function createSourceSidebar(){if(window.rootPath.endsWith("/")===false){window.rootPath+="/"}var main=document.getElementById("main");var sidebarToggle=createSidebarToggle();main.insertBefore(sidebarToggle,main.firstChild);var sidebar=document.createElement("div");sidebar.id="source-sidebar";if(getCurrentValue("rustdoc-source-sidebar-show")!=="true"){sidebar.style.left="-300px"}var currentFile=getCurrentFilePath();var hasFoundFile=false;var title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(function(key){sourcesIndex[key].name=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",currentFile,hasFoundFile)});main.insertBefore(sidebar,main.firstChild);var selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}} \ No newline at end of file diff --git a/0.10.1/src/chemfiles/atom.rs.html b/0.10.1/src/chemfiles/atom.rs.html new file mode 100644 index 000000000..2400e3b01 --- /dev/null +++ b/0.10.1/src/chemfiles/atom.rs.html @@ -0,0 +1,1059 @@ +atom.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null};
+use strings;
+
+use property::{Property, RawProperty, PropertiesIter};
+
+/// An `Atom` is a particle in the current `Frame`. It stores the following
+/// atomic properties:
+///
+/// - atom name;
+/// - atom type;
+/// - atom mass;
+/// - atom charge.
+///
+/// The atom name is usually an unique identifier (`H1`, `C_a`) while the
+/// atom type will be shared between all particles of the same type: `H`,
+/// `Ow`, `CH3`.
+pub struct Atom {
+    handle: *mut CHFL_ATOM,
+}
+
+/// An analog to a reference to an atom (`&Atom`)
+pub struct AtomRef<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a Atom>
+}
+
+impl<'a> Deref for AtomRef<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an atom (`&mut Atom`)
+pub struct AtomMut<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a mut Atom>
+}
+
+impl<'a> Deref for AtomMut<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for AtomMut<'a> {
+    fn deref_mut(&mut self) -> &mut Atom {
+        &mut self.inner
+    }
+}
+
+impl Clone for Atom {
+    fn clone(&self) -> Atom {
+        unsafe {
+            let new_handle = chfl_atom_copy(self.as_ptr());
+            Atom::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Atom {
+    /// Create an owned `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_ATOM) -> Atom {
+        check_not_null(ptr);
+        Atom {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_ATOM) -> AtomRef<'a> {
+        AtomRef {
+            inner: Atom::from_ptr(ptr as *mut CHFL_ATOM),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a mutably borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_ATOM) -> AtomMut<'a> {
+        AtomMut {
+            inner: Atom::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_ATOM {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_ATOM {
+        self.handle
+    }
+
+    /// Create an atom with the given `name`, and set the atom type to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Atom {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_atom(buffer.as_ptr());
+            Atom::from_ptr(handle)
+        }
+    }
+
+    /// Get the atom mass, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.mass(), 4.002602);
+    /// ```
+    pub fn mass(&self) -> f64 {
+        let mut mass = 0.0;
+        unsafe {
+            check_success(chfl_atom_mass(self.as_ptr(), &mut mass));
+        }
+        return mass;
+    }
+
+    /// Set the atom mass to `mass`, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_mass(34.9);
+    /// assert_eq!(atom.mass(), 34.9);
+    /// ```
+    pub fn set_mass(&mut self, mass: f64) {
+        unsafe {
+            check_success(chfl_atom_set_mass(self.as_mut_ptr(), mass));
+        }
+    }
+
+    /// Get the atom charge, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.charge(), 0.0);
+    /// ```
+    pub fn charge(&self) -> f64 {
+        let mut charge = 0.0;
+        unsafe {
+            check_success(chfl_atom_charge(self.as_ptr(), &mut charge));
+        }
+        return charge;
+    }
+
+    /// Set the atom charge to `charge`, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_charge(-2.0);
+    /// assert_eq!(atom.charge(), -2.0);
+    /// ```
+    pub fn set_charge(&mut self, charge: f64) {
+        unsafe {
+            check_success(chfl_atom_set_charge(self.as_mut_ptr(), charge));
+        }
+    }
+
+    /// Get the atom name.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_atom_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_name).expect("getting name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Get the atom type.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.atomic_type(), "He");
+    /// ```
+    pub fn atomic_type(&self) -> String {
+        let get_type = |ptr, len| unsafe { chfl_atom_type(self.as_ptr(), ptr, len) };
+        let buffer = strings::call_autogrow_buffer(10, get_type).expect("getting type failed");
+        return strings::from_c(buffer.as_ptr());
+    }
+
+    /// Set the atom name to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_name("Zn3");
+    /// assert_eq!(atom.name(), "Zn3");
+    /// ```
+    pub fn set_name<'a>(&mut self, name: impl Into<&'a str>) {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            check_success(chfl_atom_set_name(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Set the atom type to `atomic_type`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_atomic_type("F");
+    /// assert_eq!(atom.atomic_type(), "F");
+    /// ```
+    pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>) {
+        let buffer = strings::to_c(atomic_type.into());
+        unsafe {
+            check_success(chfl_atom_set_type(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Try to get the full name of the atom from the atomic type. For example,
+    /// the full name of "He" is "Helium", and so on. If the name can not be
+    /// found, this function returns the empty string.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("Zn");
+    /// assert_eq!(atom.full_name(), "Zinc");
+    /// ```
+    pub fn full_name(&self) -> String {
+        let get_full_name = |ptr, len| unsafe { chfl_atom_full_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_full_name).expect("getting full name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Try to get the Van der Waals radius of the atom from the atomic type.
+    /// If the radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+    /// assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+    /// ```
+    pub fn vdw_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_vdw_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the covalent radius of the atom from the atomic type. If the
+    /// radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+    /// assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+    /// ```
+    pub fn covalent_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_covalent_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the atomic number of the atom from the atomic type. If the
+    /// number can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").atomic_number(), 2);
+    /// assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+    /// ```
+    pub fn atomic_number(&self) -> u64 {
+        let mut number = 0;
+        unsafe {
+            check_success(chfl_atom_atomic_number(self.as_ptr(), &mut number));
+        }
+        return number;
+    }
+
+    /// Add a new `property` with the given `name` to this atom.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("a bool", true);
+    /// atom.set("a string", "test");
+    ///
+    /// assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+    /// assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_atom_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+
+    /// Get a property with the given `name` in this atom, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(atom.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_atom_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                let property = Property::from_raw(raw);
+                Some(property)
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this atom
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    /// atom.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in atom.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_atom_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_atom_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Atom {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+
+        let copy = atom.clone();
+        assert_eq!(copy.name(), "He");
+
+        atom.set_name("Na");
+        assert_eq!(atom.name(), "Na");
+        assert_eq!(copy.name(), "He");
+    }
+
+    #[test]
+    fn mass() {
+        let mut atom = Atom::new("He");
+        assert_ulps_eq!(atom.mass(), 4.002602);
+        atom.set_mass(15.0);
+        assert_eq!(atom.mass(), 15.0);
+    }
+
+    #[test]
+    fn charge() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.charge(), 0.0);
+        atom.set_charge(-1.5);
+        assert_eq!(atom.charge(), -1.5);
+    }
+
+    #[test]
+    fn name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+        atom.set_name("Zn-12");
+        assert_eq!(atom.name(), "Zn-12");
+    }
+
+    #[test]
+    fn atomic_type() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.atomic_type(), "He");
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.atomic_type(), "Zn");
+    }
+
+    #[test]
+    fn full_name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.full_name(), "Helium");
+
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.full_name(), "Zinc");
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.full_name(), "");
+    }
+
+    #[test]
+    fn radii() {
+        let atom = Atom::new("He");
+        assert_ulps_eq!(atom.vdw_radius(), 1.4);
+        assert_ulps_eq!(atom.covalent_radius(), 0.32);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.vdw_radius(), 0.0);
+        assert_eq!(atom.covalent_radius(), 0.0);
+    }
+
+    #[test]
+    fn atomic_number() {
+        let atom = Atom::new("He");
+        assert_eq!(atom.atomic_number(), 2);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.atomic_number(), 0);
+    }
+
+    #[test]
+    fn property() {
+        let mut atom = Atom::new("F");
+
+        atom.set("foo", -22.0);
+        assert_eq!(atom.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(atom.get("bar"), None);
+
+        atom.set("bar", Property::String("here".into()));
+        for (name, property) in atom.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/cell.rs.html b/0.10.1/src/chemfiles/cell.rs.html new file mode 100644 index 000000000..6fb4bb548 --- /dev/null +++ b/0.10.1/src/chemfiles/cell.rs.html @@ -0,0 +1,1107 @@ +cell.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null, check, Error};
+
+/// Available unit cell shapes.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum CellShape {
+    /// Orthorhombic cell, with the three angles equals to 90°.
+    Orthorhombic,
+    /// Triclinic cell, with any values for the angles.
+    Triclinic,
+    /// Infinite cell, to use when there is no cell.
+    Infinite,
+}
+
+impl From<chfl_cellshape> for CellShape {
+    fn from(celltype: chfl_cellshape) -> CellShape {
+        match celltype {
+            chfl_cellshape::CHFL_CELL_ORTHORHOMBIC => CellShape::Orthorhombic,
+            chfl_cellshape::CHFL_CELL_TRICLINIC => CellShape::Triclinic,
+            chfl_cellshape::CHFL_CELL_INFINITE => CellShape::Infinite,
+        }
+    }
+}
+
+impl From<CellShape> for chfl_cellshape {
+    fn from(celltype: CellShape) -> chfl_cellshape {
+        match celltype {
+            CellShape::Orthorhombic => chfl_cellshape::CHFL_CELL_ORTHORHOMBIC,
+            CellShape::Triclinic => chfl_cellshape::CHFL_CELL_TRICLINIC,
+            CellShape::Infinite => chfl_cellshape::CHFL_CELL_INFINITE,
+        }
+    }
+}
+
+/// An `UnitCell` represent the box containing the atoms, and its periodicity.
+///
+/// An unit cell is fully represented by three lengths (a, b, c); and three
+/// angles (alpha, beta, gamma). The angles are stored in degrees, and the
+/// lengths in Angstroms.
+///
+/// A cell also has a matricial representation, by projecting the three base
+/// vector into an orthonormal base. We choose to represent such matrix as an
+/// upper triangular matrix:
+///
+/// ```text
+/// | a_x   b_x   c_x |
+/// |  0    b_y   c_y |
+/// |  0     0    c_z |
+/// ```
+pub struct UnitCell {
+    handle: *mut CHFL_CELL,
+}
+
+/// An analog to a reference to an unit cell (`&UnitCell`)
+pub struct UnitCellRef<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a UnitCell>
+}
+
+impl<'a> Deref for UnitCellRef<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an unit cell (`&mut UnitCell`)
+pub struct UnitCellMut<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a mut UnitCell>
+}
+
+impl<'a> Deref for UnitCellMut<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for UnitCellMut<'a> {
+    fn deref_mut(&mut self) -> &mut UnitCell {
+        &mut self.inner
+    }
+}
+
+impl Clone for UnitCell {
+    fn clone(&self) -> UnitCell {
+        unsafe {
+            let new_handle = chfl_cell_copy(self.as_ptr());
+            UnitCell::from_ptr(new_handle)
+        }
+    }
+}
+
+impl UnitCell {
+    /// Create an owned `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_CELL) -> UnitCell {
+        check_not_null(ptr);
+        UnitCell {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime.
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_CELL) -> UnitCellRef<'a> {
+        UnitCellRef {
+            inner: UnitCell::from_ptr(ptr as *mut CHFL_CELL),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible for
+    /// setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_CELL) -> UnitCellMut<'a> {
+        UnitCellMut {
+            inner: UnitCell::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_CELL {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_CELL {
+        self.handle
+    }
+
+    /// Create an `Orthorhombic` `UnitCell` from the three lengths, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn new(lengths: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), ptr::null());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `Infinite` `UnitCell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::infinite();
+    ///
+    /// assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn infinite() -> UnitCell {
+        let mut cell = UnitCell::new([0.0, 0.0, 0.0]);
+        cell.set_shape(CellShape::Infinite).expect("could not set cell shape");
+        return cell;
+    }
+
+    /// Create an `Triclinic` `UnitCell` from the three lengths (in Angstroms)
+    /// and three angles (in degree). `alpha` is the angle between the vectors
+    /// `b` and `c`; `beta` is the between the vectors `a` and `c` and `gamma`
+    /// is the angle between the vectors `a` and `b`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// assert_eq!(cell.angles()[0], 98.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), angles.as_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `UnitCell` from a cell matrix. If `matrix` contains only
+    /// zeros, then an `Infinite` cell is created. If only the diagonal of the
+    /// matrix is non-zero, then the cell is `Orthorhombic`. Else a
+    /// `Triclinic` cell is created. The matrix entries should be in Angstroms.
+    ///
+    /// # Panics
+    ///
+    /// If the matrix has a negative determinant, or more generally is not
+    /// representing a unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::from_matrix([
+    ///     [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+    /// ]);
+    ///
+    /// assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn from_matrix(mut matrix: [[f64; 3]; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell_from_matrix(matrix.as_mut_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Get the three lengths of the cell, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// ```
+    pub fn lengths(&self) -> [f64; 3] {
+        let mut lengths = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_lengths(self.as_ptr(), lengths.as_mut_ptr()));
+        }
+        return lengths;
+    }
+
+    /// Set the three lengths of the cell, in Angstroms.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is infinite, or if one of the
+    /// lengths is negative.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+    /// assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+    ///
+    /// assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+    /// ```
+    pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_lengths(self.as_mut_ptr(), lengths.as_ptr()))
+        }
+    }
+
+    /// Get the three angles of the cell, in degrees.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([20.0, 20.0, 20.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    ///
+    /// let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// ```
+    pub fn angles(&self) -> [f64; 3] {
+        let mut angles = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_angles(self.as_ptr(), angles.as_mut_ptr()));
+        }
+        return angles;
+    }
+
+    /// Set the three angles of the cell, in degrees.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is not `Triclinic`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    ///
+    /// cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// ```
+    pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_angles(self.as_mut_ptr(), angles.as_ptr()))
+        }
+    }
+
+    /// Get the unit cell matricial representation.
+    ///
+    /// The unit cell representation is obtained by aligning the a vector along
+    /// the *x* axis and putting the b vector in the *xy* plane. This make the
+    /// matrix an upper triangular matrix:
+    ///
+    /// ```text
+    /// | a_x   b_x   c_x |
+    /// |  0    b_y   c_y |
+    /// |  0     0    c_z |
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let matrix = cell.matrix();
+    ///
+    /// assert_eq!(matrix[0][0], 10.0);
+    /// assert_eq!(matrix[1][1], 20.0);
+    /// assert_eq!(matrix[2][2], 30.0);
+    ///
+    /// assert!(matrix[1][2].abs() < 1e-9);
+    /// ```
+    pub fn matrix(&self) -> [[f64; 3]; 3] {
+        let mut matrix = [[0.0; 3]; 3];
+        unsafe {
+            check_success(chfl_cell_matrix(self.as_ptr(), matrix.as_mut_ptr()));
+        }
+        return matrix;
+    }
+
+    /// Get the shape of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn shape(&self) -> CellShape {
+        let mut shape = chfl_cellshape::CHFL_CELL_INFINITE;
+        unsafe {
+            check_success(chfl_cell_shape(self.as_ptr(), &mut shape));
+        }
+        return CellShape::from(shape);
+    }
+
+    /// Set the shape of the unit cell to `shape`.
+    ///
+    /// # Errors
+    ///
+    /// This can fail if the cell length or angles are incompatible with the
+    /// new shape.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    ///
+    /// cell.set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_shape(self.as_mut_ptr(), shape.into()))
+        }
+    }
+
+    /// Get the volume of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+    /// ```
+    pub fn volume(&self) -> f64 {
+        let mut volume = 0.0;
+        unsafe {
+            check_success(chfl_cell_volume(self.as_ptr(), &mut volume));
+        }
+        return volume;
+    }
+
+    /// Wrap a `vector` in this unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let mut vector = [12.0, 5.2, -45.3];
+    /// cell.wrap(&mut vector);
+    /// assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+    /// ```
+    pub fn wrap(&self, vector: &mut [f64; 3]) {
+        unsafe {
+            check_success(chfl_cell_wrap(self.as_ptr(), vector.as_mut_ptr()))
+        }
+    }
+}
+
+impl Drop for UnitCell {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+
+        let copy = cell.clone();
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+    }
+
+    #[test]
+    fn lengths() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+    }
+
+    #[test]
+    fn angles() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        crate::assert_vector3d_eq(&cell.angles(), &[90.0, 90.0, 90.0], 1e-6);
+
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        cell.set_angles([80.0, 89.0, 100.0]).unwrap();
+
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 89.0, 100.0], 1e-6);
+
+        let cell = UnitCell::triclinic([1., 2., 3.], [80., 90., 100.]);
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 90.0, 100.0], 1e-6);
+    }
+
+    #[test]
+    fn volume() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.volume(), 2.0 * 3.0 * 4.0);
+    }
+
+    #[test]
+    fn wrap() {
+        let cell = UnitCell::new([10.0, 20.0, 30.0]);
+        let mut vector = [12.0, 5.2, -45.3];
+        cell.wrap(&mut vector);
+        crate::assert_vector3d_eq(&vector, &[2.0, 5.2, 14.7], 1e-6);
+    }
+
+    #[test]
+    fn matrix() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+
+        let matrix = cell.matrix();
+        let result = [[2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 4.0]];
+
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn from_matrix() {
+        let cell = UnitCell::from_matrix([[10.0, 0.0, 0.0], [0.0, 21.0, 0.0], [0.0, 0.0, 32.0]]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        assert_eq!(cell.lengths(), [10.0, 21.0, 32.0]);
+
+        let result_matrix = [
+            [123.0, 4.08386, 71.7295],
+            [0.0, 233.964, 133.571],
+            [0.0, 0.0, 309.901],
+        ];
+        let cell = UnitCell::from_matrix(result_matrix);
+
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+        for i in 0..3 {
+            assert_ulps_eq!(
+                cell.lengths()[i],
+                [123.0, 234.0, 345.0][i],
+                epsilon = 1e-3
+            );
+            assert_ulps_eq!(cell.angles()[i], [67.0, 78.0, 89.0][i], epsilon = 1e-3);
+        }
+
+        let matrix = cell.matrix();
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result_matrix[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn shape() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+        let cell = UnitCell::infinite();
+        assert_eq!(cell.shape(), CellShape::Infinite);
+
+        let cell = UnitCell::triclinic([1.0, 2.0, 3.0], [80.0, 90.0, 100.0]);
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+
+        let mut cell = UnitCell::new([10.0, 10.0, 10.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/errors.rs.html b/0.10.1/src/chemfiles/errors.rs.html new file mode 100644 index 000000000..7f38ef84a --- /dev/null +++ b/0.10.1/src/chemfiles/errors.rs.html @@ -0,0 +1,461 @@ +errors.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+extern crate libc;
+
+use std::error;
+use std::fmt;
+use std::panic::{self, RefUnwindSafe};
+use std::path::Path;
+
+use self::libc::c_char;
+
+use chemfiles_sys::*;
+use strings;
+
+#[derive(Clone, Debug, PartialEq)]
+/// Error type for Chemfiles.
+pub struct Error {
+    /// The error status code
+    pub status: Status,
+    /// A message describing the error cause
+    pub message: String,
+}
+
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Clone, Debug, PartialEq)]
+/// Possible causes of error in chemfiles
+pub enum Status {
+    /// No error
+    Success = chfl_status::CHFL_SUCCESS as isize,
+    /// Error in memory allocations
+    MemoryError = chfl_status::CHFL_MEMORY_ERROR as isize,
+    /// Error while reading or writing a file
+    FileError = chfl_status::CHFL_FILE_ERROR as isize,
+    /// Error in file formatting, *i.e.* the file is invalid
+    FormatError = chfl_status::CHFL_FORMAT_ERROR as isize,
+    /// Error in selection string syntax
+    SelectionError = chfl_status::CHFL_SELECTION_ERROR as isize,
+    /// Error in configuration files syntax
+    ConfigurationError = chfl_status::CHFL_CONFIGURATION_ERROR as isize,
+    /// Error for out of bounds indexing
+    OutOfBounds = chfl_status::CHFL_OUT_OF_BOUNDS as isize,
+    /// Error related to properties
+    PropertyError = chfl_status::CHFL_PROPERTY_ERROR as isize,
+    /// Exception in the C++ chemfiles library
+    ChemfilesError = chfl_status::CHFL_GENERIC_ERROR as isize,
+    /// Exception in the C++ standard library
+    StdCppError = chfl_status::CHFL_CXX_ERROR as isize,
+    /// The given path is not valid UTF8
+    // TODO: rename this to UTF8Error in the next breaking release
+    UTF8PathError,
+}
+
+impl From<chfl_status> for Error {
+    fn from(status: chfl_status) -> Error {
+        let status = match status {
+            chfl_status::CHFL_SUCCESS => Status::Success,
+            chfl_status::CHFL_CXX_ERROR => Status::StdCppError,
+            chfl_status::CHFL_GENERIC_ERROR => Status::ChemfilesError,
+            chfl_status::CHFL_MEMORY_ERROR => Status::MemoryError,
+            chfl_status::CHFL_FILE_ERROR => Status::FileError,
+            chfl_status::CHFL_FORMAT_ERROR => Status::FormatError,
+            chfl_status::CHFL_SELECTION_ERROR => Status::SelectionError,
+            chfl_status::CHFL_CONFIGURATION_ERROR => Status::ConfigurationError,
+            chfl_status::CHFL_OUT_OF_BOUNDS => Status::OutOfBounds,
+            chfl_status::CHFL_PROPERTY_ERROR => Status::PropertyError,
+        };
+
+        let message = Error::last_error();
+        Error {
+            status,
+            message,
+        }
+    }
+}
+
+impl From<std::str::Utf8Error> for Error {
+    fn from(_: std::str::Utf8Error) -> Self {
+        Error {
+            status: Status::UTF8PathError,
+            message: "failed to convert data to UTF8 string".into(),
+        }
+    }
+}
+
+impl Error {
+    /// Create a new error because the given `path` is invalid UTF-8 data
+    pub(crate) fn utf8_path_error(path: &Path) -> Error {
+        Error {
+            status: Status::UTF8PathError,
+            message: format!("Could not convert '{}' to UTF8", path.display()),
+        }
+    }
+
+    /// Get the last error message from the C++ library.
+    pub fn last_error() -> String {
+        unsafe { strings::from_c(chfl_last_error()) }
+    }
+
+    /// Clear any error from the C++ library
+    pub fn cleanup() {
+        unsafe {
+            check(chfl_clear_errors()).expect("error in chfl_clear_errors. Things went very bad");
+        }
+    }
+}
+
+/// Check return value of a C function, and get the error if needed.
+pub(crate) fn check(status: chfl_status) -> Result<(), Error> {
+    if status == chfl_status::CHFL_SUCCESS {
+        Ok(())
+    } else {
+        Err(Error::from(status))
+    }
+}
+
+/// Check return value of a C function, panic if it failed.
+pub(crate) fn check_success(status: chfl_status) {
+    if status != chfl_status::CHFL_SUCCESS {
+        panic!("unexpected failure: {}", Error::last_error());
+    }
+}
+
+/// Check a pointer for null.
+pub(crate) fn check_not_null<T>(ptr: *const T) {
+    if ptr.is_null() {
+        panic!("unexpected null pointer: {}", Error::last_error());
+    }
+}
+
+pub trait WarningCallback: RefUnwindSafe + Fn(&str) {}
+impl<T> WarningCallback for T
+where
+    T: RefUnwindSafe + Fn(&str),
+{
+}
+
+static mut LOGGING_CALLBACK: Option<*mut dyn WarningCallback<Output = ()>> = None;
+
+extern "C" fn warning_callback(message: *const c_char) {
+    unsafe {
+        let callback = &*LOGGING_CALLBACK.expect("No callback provided, this is an internal bug");
+        // ignore result. If a panic happened, everything is going badly anyway
+        let _result = panic::catch_unwind(|| {
+            callback(&strings::from_c(message));
+        });
+    }
+}
+
+/// Use `callback` for every chemfiles warning. The callback will be passed
+/// the warning message. This will drop any previous warning callback.
+pub fn set_warning_callback<F>(callback: F) where F: WarningCallback + 'static {
+    // box callback to ensure it stays accessible
+    let callback = Box::into_raw(Box::new(callback));
+    unsafe {
+        if let Some(previous) = LOGGING_CALLBACK {
+            // set the LOGGING_CALLBACK to the new one
+            LOGGING_CALLBACK = Some(callback);
+            // drop the previous callback
+            let previous = Box::from_raw(previous);
+            std::mem::drop(previous);
+        } else {
+            // set the LOGGING_CALLBACK
+            LOGGING_CALLBACK = Some(callback);
+            // Tell C code to use Rust-provided callback
+            check_success(chfl_set_warning_callback(warning_callback));
+        }
+    }
+}
+
+
+impl fmt::Display for Error {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        write!(fmt, "{}", self.message)
+    }
+}
+
+impl error::Error for Error {
+    fn description(&self) -> &str {
+        match self.status {
+            Status::Success => "Success",
+            Status::StdCppError => "Exception from the C++ standard library",
+            Status::ChemfilesError => "Exception from the chemfiles library",
+            Status::MemoryError => "Error in memory allocations",
+            Status::FileError => "Error while reading or writing a file",
+            Status::FormatError => "Error in file formatting, i.e. the file is invalid",
+            Status::SelectionError => "Error in selection string syntax",
+            Status::UTF8PathError => "A string is not valid UTF8",
+            Status::ConfigurationError => "Error in configuration files",
+            Status::OutOfBounds => "Out of bounds indexing",
+            Status::PropertyError => "Error in property",
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use Trajectory;
+
+    #[test]
+    fn errors() {
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+        assert!(Trajectory::open("nope", 'r').is_err());
+        assert_eq!(
+            Error::last_error(),
+            "file at \'nope\' does not have an extension, provide a format name to read it"
+        );
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+    }
+
+    #[test]
+    fn codes() {
+        assert_eq!(Error::from(chfl_status::CHFL_SUCCESS).status, Status::Success);
+        assert_eq!(Error::from(chfl_status::CHFL_CXX_ERROR).status, Status::StdCppError);
+        assert_eq!(Error::from(chfl_status::CHFL_GENERIC_ERROR).status, Status::ChemfilesError);
+        assert_eq!(Error::from(chfl_status::CHFL_MEMORY_ERROR).status, Status::MemoryError);
+        assert_eq!(Error::from(chfl_status::CHFL_FILE_ERROR).status, Status::FileError);
+        assert_eq!(Error::from(chfl_status::CHFL_FORMAT_ERROR).status, Status::FormatError);
+        assert_eq!(Error::from(chfl_status::CHFL_SELECTION_ERROR).status, Status::SelectionError);
+        assert_eq!(Error::from(chfl_status::CHFL_OUT_OF_BOUNDS).status, Status::OutOfBounds);
+        assert_eq!(Error::from(chfl_status::CHFL_PROPERTY_ERROR).status, Status::PropertyError);
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/frame.rs.html b/0.10.1/src/chemfiles/frame.rs.html new file mode 100644 index 000000000..edfdc9ffe --- /dev/null +++ b/0.10.1/src/chemfiles/frame.rs.html @@ -0,0 +1,2301 @@ +frame.rs - source + +
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::ptr;
+use std::slice;
+
+use chemfiles_sys::*;
+use strings;
+use errors::{check_not_null, check_success, check, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Topology, TopologyRef, Residue, BondOrder};
+use super::{UnitCell, UnitCellRef, UnitCellMut};
+use property::{Property, RawProperty, PropertiesIter};
+
+/// A `Frame` contains data from one simulation step: the current unit
+/// cell, the topology, the positions, and the velocities of the particles in
+/// the system. If some information is missing (topology or velocity or unit
+/// cell), the corresponding data is filled with a default value.
+pub struct Frame {
+    handle: *mut CHFL_FRAME,
+}
+
+impl Clone for Frame {
+    fn clone(&self) -> Frame {
+        unsafe {
+            let new_handle = chfl_frame_copy(self.as_ptr());
+            Frame::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Frame {
+    /// Create a `Frame` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_FRAME) -> Frame {
+        check_not_null(ptr);
+        Frame {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Create an empty frame. It will be resized by the library as needed.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    ///
+    /// assert_eq!(frame.size(), 0);
+    /// ```
+    pub fn new() -> Frame {
+        unsafe {
+            Frame::from_ptr(chfl_frame())
+        }
+    }
+
+    /// Get a reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// let atom = frame.atom(0);
+    /// assert_eq!(atom.name(), "Zn");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_frame(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// assert_eq!(frame.atom(0).name(), "Zn");
+    ///
+    /// frame.atom_mut(0).set_name("Fe");
+    /// assert_eq!(frame.atom(0).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_frame(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.size(), 0);
+    ///
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_frame_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize the positions and the velocities in this frame, to make space for
+    /// `natoms` atoms. Previous data is conserved, as well as the presence of
+    /// absence of velocities.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_frame_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` and the corresponding position and optionally velocity
+    /// data to this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+    ///
+    /// frame.add_velocities();
+    /// frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+    /// ```
+    pub fn add_atom(
+        &mut self,
+        atom: &Atom,
+        position: [f64; 3],
+        velocity: impl Into<Option<[f64; 3]>>,
+    )
+    {
+        let velocity = velocity.into();
+        let velocity_ptr = match velocity {
+            Some(ref data) => data.as_ptr(),
+            None => ptr::null(),
+        };
+
+        unsafe {
+            check_success(chfl_frame_add_atom(
+                self.as_mut_ptr(),
+                atom.as_ptr(),
+                position.as_ptr(),
+                velocity_ptr
+            ));
+        }
+
+    }
+
+    /// Remove the atom at index `i` in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+    /// assert_eq!(frame.size(), 3);
+    ///
+    /// frame.remove(1);
+    /// assert_eq!(frame.size(), 2);
+    /// assert_eq!(frame.atom(1).name(), "Sn");
+    /// ```
+    pub fn remove(&mut self, i: usize) {
+        unsafe {
+            check_success(chfl_frame_remove(self.as_mut_ptr(), i as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    /// assert_eq!(frame.topology().bonds_count(), 3);
+    ///
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+    /// assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(2);
+    ///
+    /// frame.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_frame_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// the frame.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    ///
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+    ///
+    /// frame.remove_bond(2, 4);
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_remove_bond(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+            ));
+        }
+    }
+
+    /// Add a copy of `residue` to this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue id is already in this frame's
+    /// topology, or if the residue contain atoms that are already in another
+    /// residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Residue};
+    /// let mut frame = Frame::new();
+    ///
+    /// let residue = Residue::new("foo");
+    /// frame.add_residue(&residue).unwrap();
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.residues_count(), 1);
+    /// assert_eq!(topology.residue(0).unwrap().name(), "foo");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Get the distance between the atoms at indexes `i` and `j` in this frame,
+    /// accounting for periodic boundary conditions. The result is expressed in
+    /// Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+    ///
+    /// assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+    /// ```
+    pub fn distance(&self, i: usize, j: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_distance(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get the angle formed by the atoms at indexes `i`, `j` and `k` in this
+    /// frame, accounting for periodic boundary conditions. The result is
+    /// expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+    /// ```
+    pub fn angle(&self, i: usize, j: usize, k: usize) -> f64 {
+        let mut angle = 0.0;
+        unsafe {
+            check_success(chfl_frame_angle(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                &mut angle,
+            ));
+        }
+        return angle;
+    }
+
+    /// Get the dihedral angle formed by the atoms at indexes `i`, `j`, `k` and
+    /// `m` in this frame, accounting for periodic boundary conditions. The
+    /// result is expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+    ///
+    /// assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+    /// ```
+    pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut dihedral = 0.0;
+        unsafe {
+            check_success(chfl_frame_dihedral(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut dihedral,
+            ));
+        }
+        return dihedral;
+    }
+
+    /// Get the out of plane distance formed by the atoms at indexes `i`, `j`,
+    /// `k` and `m` in this frame, accounting for periodic boundary conditions.
+    /// The result is expressed in angstroms.
+    ///
+    /// This is the distance between the atom j and the ikm plane. The j atom
+    /// is the center of the improper dihedral angle formed by i, j, k and m.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+    /// frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+    /// ```
+    pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_out_of_plane(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get a view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions.len(), 67);
+    /// assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn positions(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms
+            ));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// {
+    ///     let positions = frame.positions_mut();
+    ///     assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    ///     positions[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn positions_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Get a view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    ///
+    /// let velocities = frame.velocities();
+    /// assert_eq!(velocities.len(), 67);
+    /// assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn velocities(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    /// {
+    ///     let velocities = frame.velocities_mut();
+    ///     assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    ///     velocities[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let velocities = frame.velocities();
+    /// assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn velocities_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Check if this frame contains velocity data.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn has_velocities(&self) -> bool {
+        let mut res = 0;
+        unsafe {
+            check_success(chfl_frame_has_velocities(self.as_ptr(), &mut res));
+        }
+        return res != 0;
+    }
+
+    /// Add velocity data to this frame. If the frame already have velocities,
+    /// this does nothing.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn add_velocities(&mut self) {
+        unsafe {
+            check_success(chfl_frame_add_velocities(self.as_mut_ptr()));
+        }
+    }
+
+    /// Get a reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let frame = Frame::new();
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn cell(&self) -> UnitCellRef {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW());
+            UnitCell::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// assert_eq!(frame.cell().shape(), CellShape::Infinite);
+    ///
+    /// frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+    /// ```
+    pub fn cell_mut(&mut self) -> UnitCellMut {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr());
+            UnitCell::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Set the `UnitCell` of this frame to `cell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, UnitCell, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_frame_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get a reference to the `Topology` of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(42);
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.size(), 42);
+    /// ```
+    pub fn topology(&self) -> TopologyRef {
+        unsafe {
+            let handle = chfl_topology_from_frame(self.as_ptr());
+            Topology::ref_from_ptr(handle)
+        }
+    }
+
+    /// Set the `Topology` of this frame to `topology`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology contains a different number of atoms
+    /// than this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Topology, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.resize(2);
+    ///
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_bond(0, 1);
+    ///
+    /// frame.set_topology(&topology).unwrap();
+    /// assert_eq!(frame.atom(0).name(), "Cl");
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_set_topology(self.as_mut_ptr(), topology.as_ptr()))
+        }
+    }
+
+    /// Get this frame step, i.e. the frame number in the trajectory
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    /// ```
+    pub fn step(&self) -> usize {
+        let mut step = 0;
+        unsafe {
+            check_success(chfl_frame_step(self.as_ptr(), &mut step));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return step as usize;
+    }
+
+    /// Set this frame step to `step`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    ///
+    /// frame.set_step(10);
+    /// assert_eq!(frame.step(), 10);
+    /// ```
+    pub fn set_step(&mut self, step: usize) {
+        unsafe {
+            check_success(chfl_frame_set_step(self.as_mut_ptr(), step as u64));
+        }
+    }
+
+    /// Guess the bonds, angles and dihedrals in this `frame`.
+    ///
+    /// The bonds are guessed using a distance-based algorithm, and then angles
+    /// and dihedrals are guessed from the bonds.
+    ///
+    /// # Errors
+    ////
+    /// This function can fail if the covalent radius is unknown for some atoms
+    /// in the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    ///
+    /// frame.guess_bonds().unwrap();
+    /// assert_eq!(frame.topology().bonds_count(), 1);
+    /// ```
+    pub fn guess_bonds(&mut self) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_guess_bonds(self.as_mut_ptr()))
+        }
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology of the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, Frame};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(1, 2);
+    ///
+    /// assert_eq!(frame.topology().bonds().len(), 2);
+    /// assert_eq!(frame.topology().angles().len(), 1);
+    ///
+    /// frame.clear_bonds();
+    /// assert!(frame.topology().bonds().is_empty());
+    /// assert!(frame.topology().angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_frame_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a new `property` with the given `name` to this frame.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("a string", "hello");
+    /// frame.set("a double", 4.3);
+    ///
+    /// assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_frame_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(frame.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_frame_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    /// frame.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in frame.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_frame_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_frame_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Frame {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Topology, UnitCell};
+
+    #[test]
+    fn clone() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+        let copy = frame.clone();
+        assert_eq!(copy.size(), 0);
+
+        frame.resize(42);
+        assert_eq!(frame.size(), 42);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+
+        frame.resize(12);
+        assert_eq!(frame.size(), 12);
+    }
+
+    #[test]
+    fn add_atom() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        let positions = &[[1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        frame.add_velocities();
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], [4.0, 3.0, 2.0]);
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+        assert_eq!(frame.atom(1).name(), "F");
+
+        let positions = &[[1.0, 1.0, 2.0], [1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        let velocities = &[[0.0, 0.0, 0.0], [4.0, 3.0, 2.0]];
+        assert_eq!(frame.velocities(), velocities);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_atom() {
+        let mut frame = Frame::new();
+        frame.resize(22);
+        let _atom = frame.atom(23);
+    }
+
+    #[test]
+    fn remove_atom() {
+        let mut frame = Frame::new();
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], None);
+
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        frame.remove(0);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "F");
+    }
+
+    #[test]
+    #[should_panic]
+    fn remove_out_of_bounds() {
+        let mut frame = Frame::new();
+        frame.resize(32);
+
+        frame.remove(100);
+    }
+
+    #[test]
+    fn positions() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.positions_mut().clone_from_slice(expected);
+        assert_eq!(frame.positions(), expected);
+    }
+
+    #[test]
+    fn velocities() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        assert!(!frame.has_velocities());
+        frame.add_velocities();
+        assert!(frame.has_velocities());
+
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.velocities_mut().clone_from_slice(expected);
+        assert_eq!(frame.velocities(), expected);
+    }
+
+    #[test]
+    fn cell() {
+        let mut frame = Frame::new();
+        frame.set_cell(&UnitCell::new([3.0, 4.0, 5.0]));
+        let cell = frame.cell();
+        assert_eq!(cell.lengths(), [3.0, 4.0, 5.0]);
+    }
+
+    #[test]
+    fn topology() {
+        let mut frame = Frame::new();
+        frame.resize(2);
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Zn"));
+        topology.add_atom(&Atom::new("Ar"));
+
+        assert!(frame.set_topology(&topology).is_ok());
+
+        let topology = frame.topology();
+
+        assert_eq!(topology.atom(0).name(), "Zn");
+        assert_eq!(topology.atom(1).name(), "Ar");
+
+        assert_eq!(frame.atom(0).name(), "Zn");
+        assert_eq!(frame.atom(1).name(), "Ar");
+    }
+
+    #[test]
+    fn bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        assert_eq!(frame.topology().bonds_count(), 0);
+
+        frame.add_bond(0, 1);
+        frame.add_bond(9, 2);
+        frame.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(frame.topology().bonds_count(), 3);
+
+        assert_eq!(frame.topology().bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(frame.topology().bond_orders(), expected);
+
+        assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(frame.topology().bond_order(3, 7), BondOrder::Aromatic);
+
+        frame.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        frame.remove_bond(8, 7);
+        assert_eq!(frame.topology().bonds_count(), 2);
+
+        frame.clear_bonds();
+        assert_eq!(frame.topology().bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn residues() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.topology().residues_count(), 0);
+
+        let residue = &Residue::new("foobar");
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+
+        assert_eq!(frame.topology().residues_count(), 3);
+        assert_eq!(frame.topology().residue(0).unwrap().name(), "foobar");
+    }
+
+    #[test]
+    fn step() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.step(), 0);
+        frame.set_step(42);
+        assert_eq!(frame.step(), 42);
+    }
+
+    #[test]
+    fn property() {
+        let mut frame = Frame::new();
+        frame.set("foo", -22.0);
+        assert_eq!(frame.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(frame.get("bar"), None);
+
+        frame.set("bar", Property::String("here".into()));
+        for (name, property) in frame.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+
+    #[test]
+    fn pbc_geometry() {
+        use std::f64::consts::PI;
+
+        let mut frame = Frame::new();
+        let atom = &Atom::new("");
+
+        frame.add_atom(atom, [1.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 1.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 2.0], None);
+
+        assert_eq!(frame.distance(0, 2), f64::sqrt(2.0));
+        assert_eq!(frame.angle(0, 1, 2), PI / 2.0);
+        assert_eq!(frame.dihedral(0, 1, 2, 3), PI / 2.0);
+        assert_eq!(frame.out_of_plane(1, 4, 0, 2), 2.0);
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/lib.rs.html b/0.10.1/src/chemfiles/lib.rs.html new file mode 100644 index 000000000..c3d011020 --- /dev/null +++ b/0.10.1/src/chemfiles/lib.rs.html @@ -0,0 +1,287 @@ +lib.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! Chemfiles is a multi-language library written in modern C++ for reading and
+//! writing from and to molecular trajectory files. These files are created by
+//! your favorite theoretical chemistry program, and contains information about
+//! atomic or residues names and positions. Some format also have additional
+//! information, such as velocities, forces, energy, …
+//!
+//! This crate expose the C API of chemfiles to Rust, and make all the
+//! functionalities accessible. For more information on the C++ library,
+//! please see its [documentation][cxx_doc]. Specifically, the following pages
+//! are worth reading:
+//!
+//! - The [overview][overview] of the classes organization;
+//! - The list of [supported formats][formats];
+//! - The documentation for the [selection language][selections];
+//!
+//! [cxx_doc]: https://chemfiles.org/chemfiles
+//! [overview]: https://chemfiles.org/chemfiles/latest/overview.html
+//! [formats]: https://chemfiles.org/chemfiles/latest/formats.html
+//! [selections]: https://chemfiles.org/chemfiles/latest/selections.html
+
+#![deny(missing_docs)]
+#![warn(trivial_casts, unused_import_braces, variant_size_differences)]
+#![warn(unused_results)]
+// Configuration for clippy lints
+#![warn(clippy::all, clippy::pedantic)]
+#![allow(clippy::needless_return, clippy::module_name_repetitions)]
+#![allow(clippy::must_use_candidate, clippy::wildcard_imports)]
+
+// Allow a few more clippy lints in test mode
+#![cfg_attr(test, allow(clippy::float_cmp, clippy::unreadable_literal, clippy::shadow_unrelated))]
+
+// deny(warnings) in doc tests
+#![doc(test(attr(deny(warnings))))]
+#![doc(test(attr(allow(unused_variables))))]
+
+#[cfg(test)]
+#[macro_use]
+extern crate approx;
+
+extern crate chemfiles_sys;
+use chemfiles_sys::{chfl_add_configuration, chfl_version};
+
+mod strings;
+
+mod errors;
+pub use errors::{Error, Status};
+pub use errors::set_warning_callback;
+
+mod atom;
+pub use atom::Atom;
+pub use atom::AtomRef;
+pub use atom::AtomMut;
+
+mod cell;
+pub use cell::UnitCell;
+pub use cell::UnitCellRef;
+pub use cell::UnitCellMut;
+pub use cell::CellShape;
+
+mod residue;
+pub use residue::Residue;
+pub use residue::ResidueRef;
+
+mod topology;
+pub use topology::Topology;
+pub use topology::TopologyRef;
+pub use topology::BondOrder;
+
+mod frame;
+pub use frame::Frame;
+
+mod trajectory;
+pub use trajectory::Trajectory;
+
+mod selection;
+pub use selection::{Match, Selection};
+
+mod property;
+pub use property::Property;
+pub use property::PropertiesIter;
+
+mod misc;
+pub use misc::{FormatMetadata, formats_list, guess_format};
+
+/// Get the version of the chemfiles library.
+///
+/// # Example
+/// ```
+/// let version = chemfiles::version();
+/// assert!(version.starts_with("0.10"));
+/// ```
+pub fn version() -> String {
+    unsafe { strings::from_c(chfl_version()) }
+}
+
+/// Read configuration data from the file at `path`.
+///
+/// By default, chemfiles reads configuration from any file named
+/// `.chemfiles.toml` in the current directory or any parent directory. This
+/// function can be used to add data from another configuration file. Data from
+/// the new configuration file will overwrite any existing data.
+///
+/// # Errors
+///
+/// This function will fail if there is no file at `path`, or if the file is
+/// incorrectly formatted.
+///
+/// # Example
+/// ```no_run
+/// chemfiles::add_configuration("local-config.toml").unwrap();
+/// // from now on, the data from "local-config.toml" will be used
+/// ```
+pub fn add_configuration<S>(path: S) -> Result<(), Error>
+where
+    S: AsRef<str>,
+{
+    let buffer = strings::to_c(path.as_ref());
+    unsafe {
+        errors::check(chfl_add_configuration(buffer.as_ptr()))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    fn version() {
+        assert!(!crate::version().is_empty());
+        assert!(crate::version().starts_with("0.10"));
+    }
+}
+
+#[cfg(test)]
+fn assert_vector3d_eq(lhs: &[f64; 3], rhs: &[f64; 3], eps: f64) {
+    lhs.iter()
+        .zip(rhs)
+        .for_each(|(l, r)| assert_ulps_eq!(l, r, epsilon = eps));
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/misc.rs.html b/0.10.1/src/chemfiles/misc.rs.html new file mode 100644 index 000000000..37d4322ef --- /dev/null +++ b/0.10.1/src/chemfiles/misc.rs.html @@ -0,0 +1,279 @@ +misc.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2020 Guillaume Fraux -- BSD licensed
+
+use std::convert::TryInto;
+use std::ffi::CStr;
+
+use chemfiles_sys::{chfl_format_metadata, chfl_formats_list, chfl_free, chfl_guess_format};
+use errors::check_success;
+
+/// `FormatMetadata` contains metadata associated with one format.
+#[allow(clippy::struct_excessive_bools)]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct FormatMetadata {
+    /// Name of the format.
+    pub name: &'static str,
+    /// Extension associated with the format.
+    pub extension: Option<&'static str>,
+    /// Extended, user-facing description of the format.
+    pub description: &'static str,
+    /// URL pointing to the format definition/reference.
+    pub reference: &'static str,
+    /// Is reading files in this format implemented?
+    pub read: bool,
+    /// Is writing files in this format implemented?
+    pub write: bool,
+    /// Does this format support in-memory IO?
+    pub memory: bool,
+    /// Does this format support storing atomic positions?
+    pub positions: bool,
+    /// Does this format support storing atomic velocities?
+    pub velocities: bool,
+    /// Does this format support storing unit cell information?
+    pub unit_cell: bool,
+    /// Does this format support storing atom names or types?
+    pub atoms: bool,
+    /// Does this format support storing bonds between atoms?
+    pub bonds: bool,
+    /// Does this format support storing residues?
+    pub residues: bool,
+}
+
+impl FormatMetadata {
+    pub(crate) fn from_raw(raw: &chfl_format_metadata) -> Self {
+        let str_from_ptr = |ptr| unsafe {
+            CStr::from_ptr(ptr)
+                .to_str()
+                .expect("Invalid Rust str from C")
+        };
+        let extension = if raw.extension.is_null() {
+            None
+        } else {
+            Some(str_from_ptr(raw.extension))
+        };
+        Self {
+            name: str_from_ptr(raw.name),
+            extension,
+            description: str_from_ptr(raw.description),
+            reference: str_from_ptr(raw.reference),
+            read: raw.read,
+            write: raw.write,
+            memory: raw.memory,
+            positions: raw.positions,
+            velocities: raw.velocities,
+            unit_cell: raw.unit_cell,
+            atoms: raw.atoms,
+            bonds: raw.bonds,
+            residues: raw.residues,
+        }
+    }
+}
+
+/// Get the list of formats known by chemfiles, as well as all associated metadata.
+///
+/// # Example
+/// ```
+/// let formats = chemfiles::formats_list();
+/// println!("chemfiles supports {} formats:", formats.len());
+/// for format in &formats {
+///     println!(
+///         "   {:<15} {}",
+///         format.name,
+///         format.extension.as_deref().unwrap_or("")
+///     );
+/// }
+/// ```
+#[must_use]
+pub fn formats_list() -> Vec<FormatMetadata> {
+    let mut formats = std::ptr::null_mut();
+    let mut count: u64 = 0;
+    let formats_slice = unsafe {
+        check_success(chfl_formats_list(&mut formats, &mut count));
+        std::slice::from_raw_parts(formats, count.try_into().expect("failed to convert u64 to usize"))
+    };
+    let formats_vec = formats_slice
+        .iter()
+        .map(|fm| FormatMetadata::from_raw(fm))
+        .collect();
+    unsafe {
+        let _ = chfl_free(formats as *const _);
+    }
+    return formats_vec;
+}
+
+#[allow(clippy::doc_markdown)]
+/// Get the format that chemfiles would use to read a file at the given
+/// ``path``.
+///
+/// The format is mostly guessed from the path extension, chemfiles only tries
+/// to read the file to distinguish between CIF and mmCIF files. Opening the
+/// file using the returned format string might still fail. For example, it will
+/// fail if the file is not actually formatted according to the guessed format;
+/// or the format/compression combination is not supported (e.g. `XTC / GZ` will
+/// not work since the XTC reader does not support compressed files).
+///
+/// The returned format is represented in a way compatible with the various
+/// `Trajectory` constructors, i.e. `"<format name> [/ <compression>]"`, where
+/// compression is optional.
+///
+/// # Examples
+/// ```
+/// let format = chemfiles::guess_format("trajectory.xyz.xz");
+/// assert_eq!(format, "XYZ / XZ");
+///
+/// let format = chemfiles::guess_format("trajectory.nc");
+/// assert_eq!(format, "Amber NetCDF");
+/// ```
+pub fn guess_format(path: &str) -> String {
+    let path = crate::strings::to_c(path);
+    let mut buffer = vec![0; 128];
+    unsafe {
+        check_success(chfl_guess_format(
+            path.as_ptr(), buffer.as_mut_ptr(), buffer.len() as u64
+        ));
+    }
+    return crate::strings::from_c(buffer.as_ptr());
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/property.rs.html b/0.10.1/src/chemfiles/property.rs.html new file mode 100644 index 000000000..07027905f --- /dev/null +++ b/0.10.1/src/chemfiles/property.rs.html @@ -0,0 +1,587 @@ +property.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::vec::IntoIter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use strings;
+
+/// A thin wrapper around `CHFL_PROPERTY`
+pub(crate) struct RawProperty {
+    handle: *mut CHFL_PROPERTY,
+}
+
+impl RawProperty {
+    /// Create a `RawProperty` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    pub unsafe fn from_ptr(ptr: *mut CHFL_PROPERTY) -> RawProperty {
+        check_not_null(ptr);
+        RawProperty {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    pub fn as_ptr(&self) -> *const CHFL_PROPERTY {
+        self.handle
+    }
+
+    fn double(value: f64) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_double(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn bool(value: bool) -> RawProperty {
+        let value = if value { 1 } else { 0 };
+        unsafe {
+            let handle = chfl_property_bool(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn vector3d(value: [f64; 3]) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_vector3d(value.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn string(value: &str) -> RawProperty {
+        let buffer = strings::to_c(value);
+        unsafe {
+            let handle = chfl_property_string(buffer.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn get_kind(&self) -> chfl_property_kind {
+        let mut kind = chfl_property_kind::CHFL_PROPERTY_BOOL;
+        unsafe {
+            check_success(chfl_property_get_kind(self.as_ptr(), &mut kind));
+        }
+        return kind;
+    }
+
+    fn get_bool(&self) -> Result<bool, Error> {
+        let mut value = 0;
+        unsafe {
+            check(chfl_property_get_bool(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value != 0);
+    }
+
+    fn get_double(&self) -> Result<f64, Error> {
+        let mut value = 0.0;
+        unsafe {
+            check(chfl_property_get_double(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value);
+    }
+
+    fn get_string(&self) -> Result<String, Error> {
+        let get_string = |ptr, len| unsafe { chfl_property_get_string(self.as_ptr(), ptr, len) };
+        let value = strings::call_autogrow_buffer(64, get_string)?;
+        return Ok(strings::from_c(value.as_ptr()));
+    }
+
+    fn get_vector3d(&self) -> Result<[f64; 3], Error> {
+        let mut value = [0.0; 3];
+        unsafe {
+            check(chfl_property_get_vector3d(self.as_ptr(), value.as_mut_ptr()))?;
+        }
+        return Ok(value);
+    }
+}
+
+impl Drop for RawProperty {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+/// A `Property` is a piece of data that can be associated with an `Atom` or a
+/// `Frame`.
+#[derive(Debug, Clone, PartialEq, PartialOrd)]
+pub enum Property {
+    /// Boolean property
+    Bool(bool),
+    /// Floating point property
+    Double(f64),
+    /// String property
+    String(String),
+    /// 3-dimensional vector property
+    Vector3D([f64; 3]),
+}
+
+impl From<bool> for Property {
+    fn from(value: bool) -> Self {
+        Property::Bool(value)
+    }
+}
+
+impl From<f64> for Property {
+    fn from(value: f64) -> Self {
+        Property::Double(value)
+    }
+}
+
+impl From<String> for Property {
+    fn from(value: String) -> Self {
+        Property::String(value)
+    }
+}
+
+impl<'a> From<&'a str> for Property {
+    fn from(value: &'a str) -> Self {
+        Property::String(value.into())
+    }
+}
+
+impl From<[f64; 3]> for Property {
+    fn from(value: [f64; 3]) -> Self {
+        Property::Vector3D(value)
+    }
+}
+
+impl Property {
+    pub(crate) fn as_raw(&self) -> RawProperty {
+        match *self {
+            Property::Bool(value) => RawProperty::bool(value),
+            Property::Double(value) => RawProperty::double(value),
+            Property::String(ref value) => RawProperty::string(value),
+            Property::Vector3D(value) => RawProperty::vector3d(value),
+        }
+    }
+
+    #[allow(clippy::needless_pass_by_value)]  // raw property
+    pub(crate) fn from_raw(raw: RawProperty) -> Property {
+        match raw.get_kind() {
+            chfl_property_kind::CHFL_PROPERTY_BOOL => {
+                Property::Bool(raw.get_bool().expect("shoudl be a bool"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_DOUBLE => {
+                Property::Double(raw.get_double().expect("should be a double"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_STRING => {
+                Property::String(raw.get_string().expect("should be a string"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_VECTOR3D => {
+                Property::Vector3D(raw.get_vector3d().expect("should be a vector3d"))
+            }
+        }
+    }
+}
+
+/// An iterator over the properties in an atom/frame/residue
+pub struct PropertiesIter<'a> where  {
+    pub(crate) names: IntoIter<String>,
+    pub(crate) getter: Box<dyn Fn(&str) -> Property + 'a>,
+}
+
+impl<'a> Iterator for PropertiesIter<'a> {
+    type Item = (String, Property);
+    fn next(&mut self) -> Option<Self::Item> {
+        self.names.next().map(|name| {
+            let property = (self.getter)(&*name);
+            (name, property)
+        })
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.names.size_hint()
+    }
+
+    fn count(self) -> usize {
+        self.names.count()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    mod raw {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = RawProperty::bool(false);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(property.get_bool(), Ok(false));
+        }
+
+        #[test]
+        fn double() {
+            let property = RawProperty::double(45.0);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(property.get_double(), Ok(45.0));
+        }
+
+        #[test]
+        fn string() {
+            let property = RawProperty::string("test");
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(property.get_string(), Ok("test".into()));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = RawProperty::vector3d([1.2, 3.4, 5.6]);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(property.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+        }
+    }
+
+    mod rust {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = Property::Bool(false);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(raw.get_bool(), Ok(false));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn double() {
+            let property = Property::Double(45.0);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(raw.get_double(), Ok(45.0));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn string() {
+            let property = Property::String("test".into());
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(raw.get_string(), Ok("test".into()));
+
+            assert_eq!(Property::from_raw(raw), property);
+
+            let property = Property::String("long string ".repeat(128));
+            let raw = property.as_raw();
+            assert_eq!(raw.get_string(), Ok("long string ".repeat(128)));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = Property::Vector3D([1.2, 3.4, 5.6]);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(raw.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/residue.rs.html b/0.10.1/src/chemfiles/residue.rs.html new file mode 100644 index 000000000..2ce5d806c --- /dev/null +++ b/0.10.1/src/chemfiles/residue.rs.html @@ -0,0 +1,829 @@ +residue.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_not_null, check_success};
+use property::{Property, RawProperty, PropertiesIter};
+use strings;
+
+/// A `Residue` is a group of atoms belonging to the same logical unit. They
+/// can be small molecules, amino-acids in a protein, monomers in polymers,
+/// *etc.*
+pub struct Residue {
+    handle: *mut CHFL_RESIDUE,
+}
+
+/// An analog to a reference to a residue (`&Residue`)
+pub struct ResidueRef<'a> {
+    inner: Residue,
+    marker: PhantomData<&'a Residue>
+}
+
+impl<'a> Deref for ResidueRef<'a> {
+    type Target = Residue;
+    fn deref(&self) -> &Residue {
+        &self.inner
+    }
+}
+
+impl Clone for Residue {
+    fn clone(&self) -> Residue {
+        unsafe {
+            let new_handle = chfl_residue_copy(self.as_ptr());
+            Residue::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Residue {
+    /// Create a `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_RESIDUE) -> Residue {
+        check_not_null(ptr);
+        Residue {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_RESIDUE) -> ResidueRef<'a> {
+        ResidueRef {
+            inner: Residue::from_ptr(ptr as *mut CHFL_RESIDUE),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Create a new residue with the given `name`
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("ALA");
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), None);
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue(buffer.as_ptr());
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Create a new residue with the given `name` and `id` as identifier.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("ALA", 67);
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), Some(67));
+    /// ```
+    pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue_with_id(buffer.as_ptr(), id);
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Get the number of atoms in this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    ///
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// assert_eq!(residue.size(), 3);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_residue_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the identifier of this residue in the initial topology file.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("", 42);
+    /// assert_eq!(residue.id(), Some(42));
+    /// ```
+    pub fn id(&self) -> Option<i64> {
+        let mut resid = 0;
+        let status = unsafe {
+            chfl_residue_id(self.as_ptr(), &mut resid)
+        };
+
+        if status == chfl_status::CHFL_SUCCESS {
+            return Some(resid);
+        } else if status == chfl_status::CHFL_GENERIC_ERROR {
+            return None;
+        }
+
+        // call check_success to panic in case of error
+        check_success(status);
+        unreachable!();
+    }
+
+    /// Get the name of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("water");
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_residue_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(64, get_name).expect("getting residue name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Add the atom at index `atom` in this residue.
+    ///
+    /// This will fail if the atom is already in the residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// assert_eq!(residue.contains(56), true);
+    ///
+    /// // Adding the same atom twice is fine
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// ```
+    pub fn add_atom(&mut self, atom: usize) {
+        unsafe {
+            check_success(chfl_residue_add_atom(self.as_mut_ptr(), atom as u64));
+        }
+    }
+
+    /// Check if the atom at index `i` is in this residue
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.contains(56), true);
+    /// ```
+    pub fn contains(&self, atom: usize) -> bool {
+        let mut inside = 0;
+        unsafe {
+            check_success(chfl_residue_contains(self.as_ptr(), atom as u64, &mut inside));
+        }
+        return inside != 0;
+    }
+
+    /// Get the list of atoms of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.atoms(), vec![]);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.atoms(), vec![56]);
+    /// ```
+    pub fn atoms(&self) -> Vec<usize> {
+        let size = self.size();
+        let count = size as u64;
+        let mut indices = vec![u64::max_value(); size];
+        unsafe {
+            check_success(chfl_residue_atoms(
+                self.as_ptr(),
+                indices.as_mut_ptr(),
+                count,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return indices.into_iter().map(|idx| idx as usize).collect();
+    }
+
+    /// Add a new `property` with the given `name` to this residue.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("a string", "hello");
+    /// residue.set("a double", 3.2);
+    ///
+    /// assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_residue_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(residue.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_residue_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    /// residue.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in residue.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_residue_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_residue_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Residue {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        let copy = residue.clone();
+        assert_eq!(copy.size(), 0);
+
+        residue.add_atom(3);
+        residue.add_atom(7);
+        assert_eq!(residue.size(), 2);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn name() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.name(), "A");
+    }
+
+    #[test]
+    fn id() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.id(), None);
+
+        let residue = Residue::with_id("A", 42);
+        assert_eq!(residue.id(), Some(42));
+
+        let residue = Residue::with_id("A", -3);
+        assert_eq!(residue.id(), Some(-3));
+    }
+
+    #[test]
+    fn atoms() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        residue.add_atom(0);
+        residue.add_atom(3);
+        residue.add_atom(45);
+        assert_eq!(residue.size(), 3);
+
+        assert!(residue.contains(3));
+        assert!(!residue.contains(5));
+
+        assert_eq!(residue.atoms(), vec![0, 3, 45]);
+    }
+
+    #[test]
+    fn property() {
+        let mut residue = Residue::new("ALA");
+
+        residue.set("foo", -22.0);
+        assert_eq!(residue.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(residue.get("bar"), None);
+
+        residue.set("bar", Property::String("here".into()));
+        for (name, property) in residue.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/selection.rs.html b/0.10.1/src/chemfiles/selection.rs.html new file mode 100644 index 000000000..1d4d5428e --- /dev/null +++ b/0.10.1/src/chemfiles/selection.rs.html @@ -0,0 +1,863 @@ +selection.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Index};
+use std::iter::IntoIterator;
+use std::slice::Iter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error, Status};
+use strings;
+use frame::Frame;
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+/// A `Match` is a set of atomic indexes matching a given selection. It can
+/// mostly be used like a `&[usize]`.
+pub struct Match {
+    size: usize,
+    atoms: [usize; 4],
+}
+
+#[allow(clippy::len_without_is_empty)]
+impl Match {
+    /// Get the length of the Match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// ```
+    pub fn len(&self) -> usize {
+        self.size
+    }
+
+    /// Create a new match containing the atoms in the `atoms` slice.
+    ///
+    /// # Panics
+    ///
+    /// If the slice contains more than 4 elements, which is the maximal size
+    /// of a match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// assert_eq!(atomic_match[0], 3);
+    /// assert_eq!(atomic_match[1], 4);
+    /// assert_eq!(atomic_match[2], 5);
+    /// ```
+    pub fn new(atoms: &[usize]) -> Match {
+        assert!(atoms.len() <= 4);
+        let size = atoms.len();
+        let mut matches = [usize::max_value(); 4];
+        for (i, atom) in atoms.iter().enumerate() {
+            matches[i] = *atom;
+        }
+        Match {
+            size,
+            atoms: matches,
+        }
+    }
+
+    /// Iterate over the atomic indexes in the match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// let mut iter = atomic_match.iter();
+    ///
+    /// assert_eq!(iter.next(), Some(&3));
+    /// assert_eq!(iter.next(), Some(&4));
+    /// assert_eq!(iter.next(), Some(&5));
+    /// assert_eq!(iter.next(), None);
+    /// ```
+    pub fn iter(&self) -> Iter<usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+impl Index<usize> for Match {
+    type Output = usize;
+    fn index(&self, i: usize) -> &Self::Output {
+        assert!(i < self.len());
+        &self.atoms[i]
+    }
+}
+
+impl<'a> IntoIterator for &'a Match {
+    type Item = &'a usize;
+    type IntoIter = Iter<'a, usize>;
+    fn into_iter(self) -> Iter<'a, usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+/// A `Selection` allow to select atoms in a `Frame`, from a selection
+/// language. The selection language is built by combining basic operations.
+/// Each basic operation follows the `<selector>[(<variable>)] <operator>
+/// <value>` structure, where `<operator>` is a comparison operator in
+/// `== != < <= > >=`.
+pub struct Selection {
+    handle: *mut CHFL_SELECTION,
+}
+
+impl Clone for Selection {
+    fn clone(&self) -> Selection {
+        unsafe {
+            let new_handle = chfl_selection_copy(self.as_ptr());
+            Selection::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Drop for Selection {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl Selection {
+    /// Create a `Selection` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_SELECTION) -> Selection {
+        check_not_null(ptr);
+        Selection {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Create a new selection from the given selection string.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the selection string is invalid.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// ```
+    pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error> {
+        let buffer = strings::to_c(selection.into());
+        unsafe {
+            let handle = chfl_selection(buffer.as_ptr());
+            if handle.is_null() {
+                Err(Error {
+                    status: Status::SelectionError,
+                    message: Error::last_error()
+                })
+            } else {
+                Ok(Selection::from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the size of the selection, i.e. the number of atoms we are selecting
+    /// together.
+    ///
+    /// This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond'
+    /// context, 3 for the 'three' and 'angles' context and 4 for the 'four'
+    /// and 'dihedral' context.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// assert_eq!(selection.size(), 2);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_selection_size(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the selection string used to create this selection.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("name H").unwrap();
+    /// assert_eq!(selection.string(), "name H");
+    /// ```
+    pub fn string(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_selection_string(self.as_ptr(), ptr, len) };
+        let selection = strings::call_autogrow_buffer(1024, get_string).expect("failed to get selection string");
+        return strings::from_c(selection.as_ptr());
+    }
+
+    /// Evaluate a selection for a given frame, and return the corresponding
+    /// matches.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// let matches = selection.evaluate(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    ///
+    /// assert_eq!(matches[0].len(), 2);
+    /// assert_eq!(matches[0][0], 0);
+    /// assert_eq!(matches[0][1], 1);
+    ///
+    /// assert_eq!(matches[1].len(), 2);
+    /// assert_eq!(matches[1][0], 2);
+    /// assert_eq!(matches[1][1], 1);
+    /// ```
+    pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match> {
+        #![allow(clippy::cast_possible_truncation)]
+        let mut count = 0;
+        unsafe {
+            check(chfl_selection_evaluate(
+                self.as_mut_ptr(), frame.as_ptr(), &mut count
+            )).expect("failed to evaluate selection");
+        }
+
+        let size = count as usize;
+        let mut chfl_matches = vec![chfl_match { size: 0, atoms: [0; 4] }; size];
+        unsafe {
+            check(chfl_selection_matches(
+                self.handle,
+                chfl_matches.as_mut_ptr(),
+                count
+            )).expect("failed to extract matches");
+        }
+
+        return chfl_matches.into_iter()
+            .map(|chfl_match| Match {
+                size: chfl_match.size as usize,
+                atoms: [
+                    chfl_match.atoms[0] as usize,
+                    chfl_match.atoms[1] as usize,
+                    chfl_match.atoms[2] as usize,
+                    chfl_match.atoms[3] as usize,
+                ],
+            })
+            .collect();
+    }
+
+    /// Evaluates a selection of size 1 on a given `frame`. This function
+    /// returns the list of atomic indexes in the frame matching this selection.
+    ///
+    /// # Panics
+    ///
+    /// If the selection size is not 1
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("name H").unwrap();
+    /// let matches = selection.list(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    /// assert_eq!(matches[0], 0);
+    /// assert_eq!(matches[1], 2);
+    /// ```
+    pub fn list(&mut self, frame: &Frame) -> Vec<usize> {
+        if self.size() != 1 {
+            panic!("can not call `Selection::list` on a multiple selection")
+        }
+        return self.evaluate(frame)
+            .into_iter()
+            .map(|m| m[0] as usize)
+            .collect();
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use Frame;
+    use Topology;
+    use Atom;
+
+    #[test]
+    fn clone() {
+        let selection = Selection::new("name H").unwrap();
+
+        let copy = selection.clone();
+        assert_eq!(selection.size(), 1);
+        assert_eq!(copy.size(), 1);
+    }
+
+    fn testing_frame() -> Frame {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("H"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("H"));
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(2, 3);
+
+        let mut frame = Frame::new();
+        frame.resize(4);
+        frame.set_topology(&topology).unwrap();
+        return frame;
+    }
+
+    mod matches {
+        use super::*;
+
+        #[test]
+        fn index() {
+            let m = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+            assert_eq!(m[2], 3);
+            assert_eq!(m[3], 4);
+
+            let m = Match::new(&[1, 2]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+        }
+
+        #[test]
+        fn iter() {
+            let match_ = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(match_.iter().copied().collect::<Vec<usize>>(), vec![1, 2, 3, 4]);
+
+            let v = vec![1, 2, 3, 4];
+            for (i, &m) in match_.iter().enumerate() {
+                assert_eq!(v[i], m);
+            }
+        }
+
+        #[test]
+        #[should_panic]
+        fn out_of_bound() {
+            let m = Match::new(&[1, 2]);
+            let _ = m[2];
+        }
+
+        #[test]
+        #[should_panic]
+        fn too_big() {
+            let _ = Match::new(&[1, 2, 3, 5, 4]);
+        }
+    }
+
+    #[test]
+    fn size() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.size(), 1);
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 3);
+
+        let selection = Selection::new("four: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 4);
+    }
+
+    #[test]
+    fn string() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.string(), "name H");
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.string(), "angles: name(#1) H");
+    }
+
+    #[test]
+    fn evaluate() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.evaluate(&frame);
+        assert_eq!(res, &[Match::new(&[0]), Match::new(&[3])]);
+
+        let mut selection = Selection::new("angles: all").unwrap();
+        let res = selection.evaluate(&frame);
+        for m in &[Match::new(&[0, 1, 2]), Match::new(&[1, 2, 3])] {
+            assert!(res.iter().any(|r| r == m))
+        }
+    }
+
+    #[test]
+    fn list() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.list(&frame);
+        assert_eq!(res, vec![0, 3]);
+    }
+
+    #[test]
+    #[should_panic = "can not call `Selection::list` on a multiple selection"]
+    fn list_on_size_1_selection() {
+        let frame = testing_frame();
+        let mut selection = Selection::new("pairs: name(#1) H").unwrap();
+        let _list = selection.list(&frame);
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/strings.rs.html b/0.10.1/src/chemfiles/strings.rs.html new file mode 100644 index 000000000..964bc49d7 --- /dev/null +++ b/0.10.1/src/chemfiles/strings.rs.html @@ -0,0 +1,121 @@ +strings.rs - source + +
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! String conversions between C and Rust
+use std::ffi::{CStr, CString};
+
+use chemfiles_sys::chfl_status;
+use errors::{check, Error};
+
+/// Create a Rust string from a C string. Clones all characters in `buffer`.
+pub fn from_c(buffer: *const i8) -> String {
+    unsafe {
+        let rust_str = CStr::from_ptr(buffer)
+            .to_str()
+            .expect("Invalid Rust string from C");
+        return String::from(rust_str);
+    }
+}
+
+/// Create a C string from a Rust string.
+pub fn to_c(string: &str) -> CString {
+    CString::new(string).expect("Invalid C string from Rust")
+}
+
+/// Check if a string buffer was big enough when passed to a C function
+fn buffer_was_big_enough(buffer: &[i8]) -> bool {
+    let len = buffer.len();
+    if len < 2 {
+        false
+    } else {
+        // The C code should always set the last element to 0
+        debug_assert_eq!(buffer[len - 1], 0);
+        buffer[len - 2] == 0
+    }
+}
+
+/// Call `callback` C function with a string buffer and it length, using
+/// `initial` as the buffer initial size. If the buffer was filled and the
+/// result truncated by the C library, grow the buffer and try again until we
+/// get all the data. Then return the filled buffer to the caller.
+pub fn call_autogrow_buffer<F>(initial: usize, callback: F) -> Result<Vec<i8>, Error>
+where
+    F: Fn(*mut i8, u64) -> chfl_status,
+{
+    let mut size = initial;
+    let mut buffer = vec![0; size];
+    check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+
+    while !buffer_was_big_enough(&buffer) {
+        // Grow the buffer and retry
+        size *= 2;
+        buffer.resize(size, 0);
+        check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+    }
+
+    Ok(buffer)
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/topology.rs.html b/0.10.1/src/chemfiles/topology.rs.html new file mode 100644 index 000000000..f64a0c9d5 --- /dev/null +++ b/0.10.1/src/chemfiles/topology.rs.html @@ -0,0 +1,2017 @@ +topology.rs - source + +
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Residue, ResidueRef};
+
+/// Possible bond order associated with bonds
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+pub enum BondOrder {
+    /// Unknown or unspecified bond order
+    Unknown = chfl_bond_order::CHFL_BOND_UNKNOWN as isize,
+    /// Single bond
+    Single = chfl_bond_order::CHFL_BOND_SINGLE as isize,
+    /// Double bond
+    Double = chfl_bond_order::CHFL_BOND_DOUBLE as isize,
+    /// Triple bond
+    Triple = chfl_bond_order::CHFL_BOND_TRIPLE as isize,
+    /// Quadruple bond (present in some metals)
+    Quadruple = chfl_bond_order::CHFL_BOND_QUADRUPLE as isize,
+    /// Quintuplet bond (present in some metals)
+    Quintuplet = chfl_bond_order::CHFL_BOND_QUINTUPLET as isize,
+    /// Amide bond (required by some file formats)
+    Amide = chfl_bond_order::CHFL_BOND_AMIDE as isize,
+    /// Aromatic bond (required by some file formats)
+    Aromatic = chfl_bond_order::CHFL_BOND_AROMATIC as isize,
+}
+
+impl BondOrder {
+    pub(crate) fn as_raw(self) -> chfl_bond_order {
+        match self {
+            BondOrder::Unknown => chfl_bond_order::CHFL_BOND_UNKNOWN,
+            BondOrder::Single => chfl_bond_order::CHFL_BOND_SINGLE,
+            BondOrder::Double => chfl_bond_order::CHFL_BOND_DOUBLE,
+            BondOrder::Triple => chfl_bond_order::CHFL_BOND_TRIPLE,
+            BondOrder::Quadruple => chfl_bond_order::CHFL_BOND_QUADRUPLE,
+            BondOrder::Quintuplet => chfl_bond_order::CHFL_BOND_QUINTUPLET,
+            BondOrder::Amide => chfl_bond_order::CHFL_BOND_AMIDE,
+            BondOrder::Aromatic => chfl_bond_order::CHFL_BOND_AROMATIC,
+        }
+    }
+}
+
+impl From<chfl_bond_order> for BondOrder {
+    fn from(order: chfl_bond_order) -> BondOrder {
+        match order {
+            chfl_bond_order::CHFL_BOND_UNKNOWN => BondOrder::Unknown,
+            chfl_bond_order::CHFL_BOND_SINGLE => BondOrder::Single,
+            chfl_bond_order::CHFL_BOND_DOUBLE => BondOrder::Double,
+            chfl_bond_order::CHFL_BOND_TRIPLE => BondOrder::Triple,
+            chfl_bond_order::CHFL_BOND_QUADRUPLE => BondOrder::Quadruple,
+            chfl_bond_order::CHFL_BOND_QUINTUPLET => BondOrder::Quintuplet,
+            chfl_bond_order::CHFL_BOND_AMIDE => BondOrder::Amide,
+            chfl_bond_order::CHFL_BOND_AROMATIC => BondOrder::Aromatic,
+        }
+    }
+}
+
+/// A `Topology` contains the definition of all the atoms in the system, and
+/// the liaisons between the atoms (bonds, angles, dihedrals, ...). It will
+/// also contain all the residues information if it is available.
+pub struct Topology {
+    handle: *mut CHFL_TOPOLOGY,
+}
+
+/// An analog to a reference to a topology (`&Topology`)
+pub struct TopologyRef<'a> {
+    inner: Topology,
+    marker: PhantomData<&'a Topology>
+}
+
+impl<'a> Deref for TopologyRef<'a> {
+    type Target = Topology;
+    fn deref(&self) -> &Topology {
+        &self.inner
+    }
+}
+
+impl Clone for Topology {
+    fn clone(&self) -> Topology {
+        unsafe {
+            let new_handle = chfl_topology_copy(self.as_ptr());
+            Topology::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Topology {
+    /// Create a `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TOPOLOGY) -> Topology {
+        check_not_null(ptr);
+        Topology {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_TOPOLOGY) -> TopologyRef<'a> {
+        TopologyRef {
+            inner: Topology::from_ptr(ptr as *mut CHFL_TOPOLOGY),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Create a new empty topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    /// ```
+    pub fn new() -> Topology {
+        unsafe {
+            Topology::from_ptr(chfl_topology())
+        }
+    }
+
+    /// Get a reference of the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// let atom = topology.atom(4);
+    /// assert_eq!(atom.name(), "");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// assert_eq!(topology.atom(4).name(), "");
+    ///
+    /// topology.atom_mut(4).set_name("Fe");
+    /// assert_eq!(topology.atom(4).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr(), index as u64
+            );
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_topology_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize this topology to hold `natoms` atoms, inserting dummy atoms if
+    /// the new size if bigger than the old one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_topology_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` at the end of this topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Atom};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Mg"));
+    ///
+    /// let atom = topology.atom(0);
+    /// assert_eq!(atom.name(), "Mg");
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom) {
+        unsafe {
+            check_success(chfl_topology_add_atom(self.as_mut_ptr(), atom.as_ptr()));
+        }
+    }
+
+    /// Remove an `Atom` from this topology by `index`. This modify all the
+    /// other atoms indexes.
+    ///
+    /// # Panics
+    ///
+    /// If the `index` is out of bounds
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(9);
+    /// assert_eq!(topology.size(), 9);
+    ///
+    /// topology.remove(7);
+    /// assert_eq!(topology.size(), 8);
+    /// ```
+    pub fn remove(&mut self, index: usize) {
+        unsafe {
+            check_success(chfl_topology_remove(self.as_mut_ptr(), index as u64));
+        }
+    }
+
+    /// Get the number of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds_count(), 3);
+    /// ```
+    pub fn bonds_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_bonds_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.angles_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles_count(), 2);
+    /// ```
+    pub fn angles_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_angles_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.dihedrals_count(), 1);
+    /// ```
+    pub fn dihedrals_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_dihedrals_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    /// assert_eq!(topology.impropers_count(), 1);
+    /// ```
+    pub fn impropers_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_impropers_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the list of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+    /// ```
+    pub fn bonds(&self) -> Vec<[usize; 2]> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![[u64::max_value(); 2]; size];
+        unsafe {
+            check_success(chfl_topology_bonds(self.as_ptr(), bonds.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return bonds
+            .into_iter()
+            .map(|bond| [bond[0] as usize, bond[1] as usize])
+            .collect();
+    }
+
+    /// Get the list of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+    /// ```
+    pub fn angles(&self) -> Vec<[usize; 3]> {
+        let size = self.angles_count();
+        let count = size as u64;
+        let mut angles = vec![[u64::max_value(); 3]; size];
+        unsafe {
+            check_success(chfl_topology_angles(self.as_ptr(), angles.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return angles
+            .into_iter()
+            .map(|angle| [angle[0] as usize, angle[1] as usize, angle[2] as usize])
+            .collect();
+    }
+
+    /// Get the list of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    ///
+    /// assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+    /// ```
+    pub fn dihedrals(&self) -> Vec<[usize; 4]> {
+        let size = self.dihedrals_count();
+        let count = size as u64;
+        let mut dihedrals = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_dihedrals(
+                self.as_ptr(), dihedrals.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return dihedrals
+            .into_iter()
+            .map(|dihedral| {
+                [
+                    dihedral[0] as usize,
+                    dihedral[1] as usize,
+                    dihedral[2] as usize,
+                    dihedral[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Get the list of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    ///
+    /// assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+    /// ```
+    pub fn impropers(&self) -> Vec<[usize; 4]> {
+        let size = self.impropers_count();
+        let count = size as u64;
+        let mut impropers = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_impropers(
+                self.as_ptr(), impropers.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return impropers
+            .into_iter()
+            .map(|improper| {
+                [
+                    improper[0] as usize,
+                    improper[1] as usize,
+                    improper[2] as usize,
+                    improper[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    /// assert_eq!(topology.angles().len(), 1);
+    ///
+    /// topology.clear_bonds();
+    /// assert!(topology.bonds().is_empty());
+    /// assert!(topology.angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_topology_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_topology_bond_with_order(
+                self.as_mut_ptr(), i as u64, j as u64, order.as_raw()
+            ));
+        }
+    }
+
+    /// Get the bond order for the bond between the atoms at indexes `i` and
+    /// `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn bond_order(&self, i: usize, j: usize) -> BondOrder {
+        let mut order = chfl_bond_order::CHFL_BOND_UNKNOWN;
+        unsafe {
+            check_success(chfl_topology_bond_order(
+                self.as_ptr(), i as u64, j as u64, &mut order
+            ));
+        }
+        return order.into()
+    }
+
+    /// Get the bond order for all the bonds in the topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(3);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// topology.add_bond_with_order(0, 2, BondOrder::Single);
+    ///
+    /// assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+    /// ```
+    pub fn bond_orders(&self) -> Vec<BondOrder> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![BondOrder::Unknown; size];
+        unsafe {
+            check_success(chfl_topology_bond_orders(
+                self.as_ptr(),
+                // Casting BondOrder to chfl_bond_order is safe, as they are
+                // both `repr(C)` enums with the same values.
+                bonds.as_mut_ptr().cast(),
+                count
+            ));
+        }
+        return bonds;
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// this topology.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// topology.remove_bond(0, 1);
+    /// assert_eq!(topology.bonds_count(), 1);
+    ///
+    /// // Removing a bond that does not exists is fine
+    /// topology.remove_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 1);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Get a reference to the residue at index `index` from this topology.
+    ///
+    /// The residue index in the topology is not always the same as the residue
+    /// `id`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn residue(&self, index: u64) -> Option<ResidueRef> {
+        unsafe {
+            let handle = chfl_residue_from_topology(self.as_ptr(), index as u64);
+            if handle.is_null() {
+                None
+            } else {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get a copy of the residue containing the atom at index `index` in this
+    /// topology, if any.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.resize(8);
+    ///
+    /// let mut residue = Residue::new("water");
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// topology.add_residue(&residue).unwrap();
+    ///
+    /// let residue = topology.residue_for_atom(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    ///
+    /// assert!(topology.residue_for_atom(6).is_none());
+    /// ```
+    pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef> {
+        let handle = unsafe {
+            chfl_residue_for_atom(self.as_ptr(), index as u64)
+        };
+        if handle.is_null() {
+            None
+        } else {
+            unsafe {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the number of residues in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.residues_count(), 0);
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    /// assert_eq!(topology.residues_count(), 2);
+    /// ```
+    pub fn residues_count(&self) -> u64 {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_residues_count(self.as_ptr(), &mut count));
+        }
+        return count;
+    }
+
+    /// Add a residue to this topology.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue `id` is not already in the topology,
+    /// or if the residue contains atoms that are already in another residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_topology_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Check if the two residues `first` and `second` from the `topology` are
+    /// linked together, *i.e.* if there is a bond between one atom in the
+    /// first residue and one atom in the second one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    ///
+    /// let first = topology.residue(0).unwrap();
+    /// let second = topology.residue(1).unwrap();
+    /// assert_eq!(topology.are_linked(&first, &second), false);
+    /// ```
+    pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool {
+        let mut linked = 0;
+        unsafe {
+            check_success(chfl_topology_residues_linked(
+                self.as_ptr(),
+                first.as_ptr(),
+                second.as_ptr(),
+                &mut linked
+            ));
+        }
+        return linked != 0;
+    }
+}
+
+impl Drop for Topology {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Residue};
+
+    #[test]
+    fn clone() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        let copy = topology.clone();
+        assert_eq!(copy.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+
+        topology.remove(7);
+        assert_eq!(topology.size(), 9);
+
+        topology.add_atom(&Atom::new("Hg"));
+        assert_eq!(topology.size(), 10);
+    }
+
+    #[test]
+    fn atoms() {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(3).name(), "Fe");
+    }
+
+    #[test]
+    fn remove() {
+        let mut topology = Topology::new();
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "W");
+
+        topology.remove(1);
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "Fe");
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove() {
+        let mut topology = Topology::new();
+        topology.resize(18);
+        topology.remove(33);
+    }
+
+
+    #[test]
+    fn bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.bonds_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(9, 2);
+        topology.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(topology.bonds_count(), 3);
+
+        assert_eq!(topology.bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(topology.bond_orders(), expected);
+
+        assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(topology.bond_order(3, 7), BondOrder::Aromatic);
+
+        topology.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        topology.remove_bond(8, 7);
+        assert_eq!(topology.bonds_count(), 2);
+
+        topology.clear_bonds();
+        assert_eq!(topology.bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn angles() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.angles_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 7);
+        topology.add_bond(3, 5);
+        assert_eq!(topology.angles_count(), 2);
+
+        assert_eq!(topology.angles(), vec![[0, 1, 2], [5, 3, 7]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.angles_count(), 0);
+    }
+
+    #[test]
+    fn dihedrals() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.dihedrals_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 2);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(7, 10);
+        assert_eq!(topology.dihedrals_count(), 2);
+
+        assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3], [5, 4, 7, 10]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.dihedrals_count(), 0);
+    }
+
+    #[test]
+    fn impropers() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.impropers_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(0, 2);
+        topology.add_bond(0, 3);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(4, 8);
+        assert_eq!(topology.impropers_count(), 2);
+
+        assert_eq!(topology.impropers(), vec![[1, 0, 2, 3], [5, 4, 7, 8]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.impropers_count(), 0);
+    }
+
+    #[test]
+    fn residues() {
+        let mut topology = Topology::new();
+        topology.resize(4);
+        assert_eq!(topology.residues_count(), 0);
+
+        let mut residue = Residue::new("Foo");
+        residue.add_atom(0);
+        residue.add_atom(2);
+
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 1);
+
+        assert_eq!(topology.residue(0).unwrap().name(), "Foo");
+        {
+            let residue = topology.residue_for_atom(2).unwrap();
+            assert_eq!(residue.name(), "Foo");
+        }
+
+        let mut residue = Residue::new("Bar");
+        residue.add_atom(3);
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 2);
+
+        let first = topology.residue(0).unwrap();
+        let second = topology.residue(0).unwrap();
+        assert!(topology.are_linked(&first, &second));
+
+        // missing residue
+        assert!(topology.residue_for_atom(1).is_none());
+        // out of bounds
+        assert!(topology.residue_for_atom(67).is_none());
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/src/chemfiles/trajectory.rs.html b/0.10.1/src/chemfiles/trajectory.rs.html new file mode 100644 index 000000000..c1620ba1a --- /dev/null +++ b/0.10.1/src/chemfiles/trajectory.rs.html @@ -0,0 +1,1181 @@ +trajectory.rs - source + +
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+
+// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::convert::TryInto;
+use std::path::Path;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check, check_success, Error, Status};
+use strings;
+
+use {Frame, Topology, UnitCell};
+
+/// The `Trajectory` type is the main entry point when using chemfiles. A
+/// `Trajectory` behave a bit like a file, allowing to read and/or write
+/// `Frame`.
+pub struct Trajectory {
+    handle: *mut CHFL_TRAJECTORY,
+}
+
+impl Trajectory {
+    /// Create a `Trajectory` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TRAJECTORY) -> Result<Trajectory, Error> {
+        if ptr.is_null() {
+            Err(Error {
+                status: Status::FileError,
+                message: Error::last_error()
+            })
+        } else {
+            Ok(Trajectory {
+                handle: ptr
+            })
+        }
+    }
+
+    /// Get the underlying C pointer as a pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Open the file at the given `path` in the given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// ```
+    pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_open(path.as_ptr(), mode as i8);
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Open the file at the given `path` using a specific file `format` and the
+    /// given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// Specifying a format is needed when the file format does not match the
+    /// extension, or when there is not standard extension for this format. If
+    /// `format` is an empty string, the format will be guessed from the
+    /// extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+    /// ```
+    pub fn open_with_format<'a, P, S>(filename: P, mode: char, format: S) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let filename =
+            filename.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(filename.as_ref()))?;
+
+        let filename = strings::to_c(filename);
+        let format = strings::to_c(format.into());
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_with_format(
+                filename.as_ptr(), mode as i8, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read a memory buffer as though it was a formatted file.
+    ///
+    /// The memory buffer used to store the file is given using the `data`
+    /// argument. The `format` parameter is required and should follow the same
+    /// rules as in the main `Trajectory` constructor.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or if the format do not support in-memory readers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+    /// let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+    /// let mut frame = Frame::new();
+    /// trajectory.read(&mut frame).unwrap();
+    /// assert_eq!(frame.size(), 6);
+    /// ```
+    pub fn memory_reader<'a, S>(data: S, format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let data = strings::to_c(data.into());
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_reader(
+                data.as_ptr(), data.as_bytes().len() as u64, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Write to a memory buffer as though it was a formatted file.
+    ///
+    /// The `format` parameter should follow the same rules as in the main
+    /// `Trajectory` constructor, except that compression specification
+    /// is not supported.
+    ///
+    /// The `memory_buffer` function can be used to retrieve the data written
+    /// to memory of the `Trajectory`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the format do not support in-memory writers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Trajectory;
+    /// let trajectory_memory = Trajectory::memory_writer("SMI");
+    ///
+    /// // Binary formats typically do not support this feature
+    /// assert!(Trajectory::memory_writer("XTC").is_err());
+    /// ```
+    pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_writer(format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read the next step of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of atom
+    /// in the next step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read(&mut frame).unwrap();
+    /// ```
+    pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read(self.as_mut_ptr(), frame.as_mut_ptr()))
+        }
+    }
+
+    /// Read a specific `step` of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of
+    /// atom at this step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read_step(10, &mut frame).unwrap();
+    /// ```
+    pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read_step(self.as_mut_ptr(), step as u64, frame.as_mut_ptr()))
+        }
+    }
+
+    /// Write a `frame` to this trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.write(&mut frame).unwrap();
+    /// ```
+    pub fn write(&mut self, frame: &Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_write(self.as_mut_ptr(), frame.as_ptr()))
+        }
+    }
+
+    /// Set the `topology` associated with this trajectory. This topology will
+    /// be used when reading and writing the files, replacing any topology in
+    /// the frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Atom, Topology};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_atom(&Atom::new("O"));
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    ///
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_topology(&topology);
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) {
+        unsafe {
+            check_success(chfl_trajectory_set_topology(self.as_mut_ptr(), topology.as_ptr()));
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in `format`;
+    /// and extracting the topology of this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_file("topology.pdb").unwrap();
+    /// ```
+    pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), ptr::null()))
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in
+    /// `format`; and extracting the topology of this frame.
+    ///
+    /// If `format` is an empty string, the format will be guessed from the
+    /// `path` extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+    /// ```
+    pub fn set_topology_with_format<'a, P, S>(&mut self, path: P, format: S) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let format = strings::to_c(format.into());
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), format.as_ptr()))
+        }
+    }
+
+    /// Set the unit `cell` associated with a trajectory. This cell will be
+    /// used when reading and writing the files, replacing any unit cell in the
+    /// frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, UnitCell};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_trajectory_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get the number of steps (the number of frames) in a trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// println!("This trajectory contains {} steps", trajectory.nsteps());
+    /// ```
+    // FIXME should this take &self instead? The file can be modified by this
+    // function, but the format should reset the state.
+    pub fn nsteps(&mut self) -> usize {
+        let mut res = 0;
+        unsafe {
+            check(chfl_trajectory_nsteps(self.as_mut_ptr(), &mut res)).expect(
+                "failed to get the number of steps in this trajectory"
+            );
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return res as usize;
+    }
+
+    /// Obtain the memory buffer written to by the trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This fails if the trajectory was not opened with
+    /// `Trajectory::memory_writer`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, BondOrder, Frame, Trajectory};
+    /// let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+    ///
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_bond_with_order(0, 1, BondOrder::Single);
+    ///
+    /// trajectory_memory.write(&frame).unwrap();
+    ///
+    /// let result = trajectory_memory.memory_buffer();
+    /// assert_eq!(result.unwrap(), "CC\n");
+    /// ```
+    #[allow(clippy::cast_possible_truncation)]
+    pub fn memory_buffer(&self) -> Result<&str, Error> {
+            let mut ptr: *const i8 = std::ptr::null();
+            let mut count: u64 = 0;
+            let buffer = unsafe {
+                check(chfl_trajectory_memory_buffer(self.as_ptr(), &mut ptr, &mut count))?;
+                 std::slice::from_raw_parts(
+                    ptr.cast(), count.try_into().expect("failed to convert u64 to usize")
+                )
+            };
+
+            let string = std::str::from_utf8(buffer)?;
+            Ok(string)
+    }
+
+    /// Get file path for this trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// assert_eq!(trajectory.path(), "water.xyz");
+    /// ```
+    pub fn path(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_trajectory_path(self.as_ptr(), ptr, len) };
+        let path = strings::call_autogrow_buffer(1024, get_string).expect("failed to get path string");
+        return strings::from_c(path.as_ptr());
+    }
+}
+
+impl Drop for Trajectory {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_trajectory_close(self.as_ptr());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use std::fs;
+    use std::path::Path;
+    use std::io::Read;
+
+    use approx::assert_ulps_eq;
+
+    use {Atom, CellShape, Frame, Topology, UnitCell};
+
+    #[test]
+    fn read() {
+        let root = Path::new(file!()).parent().unwrap().join("..");
+        let filename = root.join("data").join("water.xyz");
+        let mut file = Trajectory::open(filename.to_str().unwrap(), 'r').unwrap();
+
+        if cfg!(target_family = "unix") {
+            assert_eq!(file.path(), "src/../data/water.xyz");
+        } else if cfg!(target_family = "windows") {
+            assert_eq!(file.path(), "src\\..\\data\\water.xyz");
+        } else {
+            panic!("please add test for this OS!");
+        }
+
+        assert_eq!(file.nsteps(), 100);
+
+        let mut frame = Frame::new();
+        assert!(file.read(&mut frame).is_ok());
+
+        assert_eq!(frame.size(), 297);
+        assert_ulps_eq!(frame.positions()[0][0], 0.417219);
+        assert_ulps_eq!(frame.positions()[0][1], 8.303366);
+        assert_ulps_eq!(frame.positions()[0][2], 11.737172);
+        assert_ulps_eq!(frame.positions()[124][0], 5.099554);
+        assert_ulps_eq!(frame.positions()[124][1], -0.045104);
+        assert_ulps_eq!(frame.positions()[124][2], 14.153846);
+
+        assert_eq!(frame.atom(0).name(), "O");
+
+        file.set_cell(&UnitCell::new([30.0, 30.0, 30.0]));
+        assert!(file.read_step(41, &mut frame).is_ok());
+        let cell = frame.cell().clone();
+        assert_eq!(cell.lengths(), [30.0, 30.0, 30.0]);
+
+
+        assert_ulps_eq!(frame.positions()[0][0], 0.761277);
+        assert_ulps_eq!(frame.positions()[0][1], 8.106125);
+        assert_ulps_eq!(frame.positions()[0][2], 10.622949);
+        assert_ulps_eq!(frame.positions()[124][0], 5.13242);
+        assert_ulps_eq!(frame.positions()[124][1], 0.079862);
+        assert_ulps_eq!(frame.positions()[124][2], 14.194161);
+
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 0);
+        }
+
+        assert!(frame.guess_bonds().is_ok());
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 180);
+            assert_eq!(topology.angles_count(), 84);
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("Cs");
+        for _ in 0..297 {
+            topology.add_atom(&atom);
+        }
+
+        file.set_topology(&topology);
+        assert!(file.read_step(10, &mut frame).is_ok());
+        assert_eq!(frame.atom(42).name(), "Cs");
+
+        let filename = root.join("data").join("topology.xyz");
+        assert!(file.set_topology_file(filename.to_str().unwrap()).is_ok());
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.atom(100).name(), "Rd");
+
+        let filename = root.join("data").join("helium.xyz.but.not.really");
+        let filename = filename.to_str().unwrap();
+        let mut file = Trajectory::open_with_format(filename, 'r', "XYZ").unwrap();
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.size(), 125);
+    }
+
+    fn write_file(path: &str) {
+        let mut file = Trajectory::open(path, 'w').unwrap();
+        let mut frame = Frame::new();
+        frame.resize(4);
+
+        for position in frame.positions_mut() {
+            *position = [1.0, 2.0, 3.0];
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("X");
+        for _ in 0..4 {
+            topology.add_atom(&atom);
+        }
+        frame.set_topology(&topology).unwrap();
+        assert!(file.write(&frame).is_ok());
+    }
+
+    #[test]
+    fn write() {
+        let filename = "test-tmp.xyz";
+        write_file(filename);
+
+        let expected_content = "4
+Properties=species:S:1:pos:R:3
+X 1 2 3
+X 1 2 3
+X 1 2 3
+X 1 2 3".lines().collect::<Vec<_>>();
+
+        let mut file = fs::File::open(filename).unwrap();
+        let mut content = String::new();
+        let _ = file.read_to_string(&mut content).unwrap();
+
+        assert_eq!(expected_content, content.lines().collect::<Vec<_>>());
+        fs::remove_file(filename).unwrap();
+    }
+
+    #[test]
+    fn memory() {
+        // formats in decreasing order of their memory buffer length to check null termination
+        for format in &["CSSR", "GRO", "XYZ"] {
+            let mut frame_write = Frame::new();
+            frame_write.add_atom(&Atom::new("H"), [1.5, 3.0, -10.0], None);
+            frame_write.add_atom(&Atom::new("O"), [2.3, -1.4, 50.0], None);
+            frame_write.add_atom(&Atom::new("H"), [-1.5, 10.0, 0.0], None);
+            let cell = UnitCell::new([10.0, 11.0, 12.5]);
+
+            let mut trajectory_write = Trajectory::memory_writer(*format).unwrap();
+            trajectory_write.set_cell(&cell);
+            trajectory_write.write(&frame_write).unwrap();
+
+            let buffer = trajectory_write.memory_buffer().unwrap();
+            let mut trajectory_read = Trajectory::memory_reader(buffer, *format).unwrap();
+            let mut frame_read = Frame::new();
+            trajectory_read.read(&mut frame_read).unwrap();
+
+            assert_eq!(trajectory_read.nsteps(), 1);
+            assert_eq!(frame_read.cell().shape(), CellShape::Orthorhombic);
+            assert_eq!(frame_read.size(), 3);
+            assert_eq!(frame_read.atom(1).name(), "O");
+            crate::assert_vector3d_eq(&frame_read.positions()[2], &[-1.5, 10.0, 0.0], 1e-4);
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.1/storage.js b/0.10.1/storage.js new file mode 100644 index 000000000..9a98fff0c --- /dev/null +++ b/0.10.1/storage.js @@ -0,0 +1 @@ +var resourcesSuffix="";var darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");window.mainTheme=document.getElementById("mainThemeStyle");var settingsDataset=(function(){var settingsElement=document.getElementById("default-settings");if(settingsElement===null){return null}var dataset=settingsElement.dataset;if(dataset===undefined){return null}return dataset})();function getSettingValue(settingName){var current=getCurrentValue('rustdoc-'+settingName);if(current!==null){return current}if(settingsDataset!==null){var def=settingsDataset[settingName.replace(/-/g,'_')];if(def!==undefined){return def}}return null}var localStoredTheme=getSettingValue("theme");var savedHref=[];function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(!elem||!elem.classList){return}elem.classList.add(className)}function removeClass(elem,className){if(!elem||!elem.classList){return}elem.classList.remove(className)}function onEach(arr,func,reversed){if(arr&&arr.length>0&&func){var length=arr.length;var i;if(reversed!==true){for(i=0;i=0;--i){if(func(arr[i])===true){return true}}}}return false}function onEachLazy(lazyArray,func,reversed){return onEach(Array.prototype.slice.call(lazyArray),func,reversed)}function hasOwnProperty(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function updateLocalStorage(name,value){try{window.localStorage.setItem(name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem(name)}catch(e){return null}}function switchTheme(styleElem,mainStyleElem,newTheme,saveTheme){var fullBasicCss="rustdoc"+resourcesSuffix+".css";var fullNewTheme=newTheme+resourcesSuffix+".css";var newHref=mainStyleElem.href.replace(fullBasicCss,fullNewTheme);if(saveTheme===true){updateLocalStorage("rustdoc-theme",newTheme)}if(styleElem.href===newHref){return}var found=false;if(savedHref.length===0){onEachLazy(document.getElementsByTagName("link"),function(el){savedHref.push(el.href)})}onEach(savedHref,function(el){if(el===newHref){found=true;return true}});if(found===true){styleElem.href=newHref}}function useSystemTheme(value){if(value===undefined){value=true}updateLocalStorage("rustdoc-use-system-theme",value);var toggle=document.getElementById("use-system-theme");if(toggle&&toggle instanceof HTMLInputElement){toggle.checked=value}}var updateSystemTheme=(function(){if(!window.matchMedia){return function(){var cssTheme=getComputedStyle(document.documentElement).getPropertyValue('content');switchTheme(window.currentTheme,window.mainTheme,JSON.parse(cssTheme)||"light",true)}}var mql=window.matchMedia("(prefers-color-scheme: dark)");function handlePreferenceChange(mql){if(getSettingValue("use-system-theme")!=="false"){var lightTheme=getSettingValue("preferred-light-theme")||"light";var darkTheme=getSettingValue("preferred-dark-theme")||"dark";if(mql.matches){switchTheme(window.currentTheme,window.mainTheme,darkTheme,true)}else{switchTheme(window.currentTheme,window.mainTheme,lightTheme,true)}}}mql.addListener(handlePreferenceChange);return function(){handlePreferenceChange(mql)}})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("rustdoc-preferred-dark-theme",localStoredTheme)}updateSystemTheme()}else{switchTheme(window.currentTheme,window.mainTheme,getSettingValue("theme")||"light",false)} \ No newline at end of file diff --git a/0.10.1/wheel.svg b/0.10.1/wheel.svg new file mode 100644 index 000000000..01da3b24c --- /dev/null +++ b/0.10.1/wheel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/.lock b/0.10.2/.lock new file mode 100755 index 000000000..e69de29bb diff --git a/0.10.2/COPYRIGHT.txt b/0.10.2/COPYRIGHT.txt new file mode 100644 index 000000000..c2629a83f --- /dev/null +++ b/0.10.2/COPYRIGHT.txt @@ -0,0 +1,50 @@ +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2, + FiraSans-Regular.woff, FiraSans-Medium.woff): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2, + SourceCodePro-Regular.ttf.woff, SourceCodePro-Semibold.ttf.woff, + SourceCodePro-It.ttf.woff): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2, SourceSerif4-Regular.ttf.woff, + SourceSerif4-Bold.ttf.woff, SourceSerif4-It.ttf.woff): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. diff --git a/0.10.2/FiraSans-LICENSE.txt b/0.10.2/FiraSans-LICENSE.txt new file mode 100644 index 000000000..ff9afab06 --- /dev/null +++ b/0.10.2/FiraSans-LICENSE.txt @@ -0,0 +1,94 @@ +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.2/FiraSans-Medium.woff b/0.10.2/FiraSans-Medium.woff new file mode 100644 index 000000000..7d742c5fb Binary files /dev/null and b/0.10.2/FiraSans-Medium.woff differ diff --git a/0.10.2/FiraSans-Medium.woff2 b/0.10.2/FiraSans-Medium.woff2 new file mode 100644 index 000000000..7a1e5fc54 Binary files /dev/null and b/0.10.2/FiraSans-Medium.woff2 differ diff --git a/0.10.2/FiraSans-Regular.woff b/0.10.2/FiraSans-Regular.woff new file mode 100644 index 000000000..d8e0363f4 Binary files /dev/null and b/0.10.2/FiraSans-Regular.woff differ diff --git a/0.10.2/FiraSans-Regular.woff2 b/0.10.2/FiraSans-Regular.woff2 new file mode 100644 index 000000000..e766e06cc Binary files /dev/null and b/0.10.2/FiraSans-Regular.woff2 differ diff --git a/0.10.2/LICENSE-APACHE.txt b/0.10.2/LICENSE-APACHE.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/0.10.2/LICENSE-APACHE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/0.10.2/LICENSE-MIT.txt b/0.10.2/LICENSE-MIT.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/0.10.2/LICENSE-MIT.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/0.10.2/SourceCodePro-It.ttf.woff b/0.10.2/SourceCodePro-It.ttf.woff new file mode 100644 index 000000000..8d68f2feb Binary files /dev/null and b/0.10.2/SourceCodePro-It.ttf.woff differ diff --git a/0.10.2/SourceCodePro-It.ttf.woff2 b/0.10.2/SourceCodePro-It.ttf.woff2 new file mode 100644 index 000000000..462c34efc Binary files /dev/null and b/0.10.2/SourceCodePro-It.ttf.woff2 differ diff --git a/0.10.2/SourceCodePro-LICENSE.txt b/0.10.2/SourceCodePro-LICENSE.txt new file mode 100644 index 000000000..07542572e --- /dev/null +++ b/0.10.2/SourceCodePro-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.2/SourceCodePro-Regular.ttf.woff b/0.10.2/SourceCodePro-Regular.ttf.woff new file mode 100644 index 000000000..7be076e1f Binary files /dev/null and b/0.10.2/SourceCodePro-Regular.ttf.woff differ diff --git a/0.10.2/SourceCodePro-Regular.ttf.woff2 b/0.10.2/SourceCodePro-Regular.ttf.woff2 new file mode 100644 index 000000000..10b558e0b Binary files /dev/null and b/0.10.2/SourceCodePro-Regular.ttf.woff2 differ diff --git a/0.10.2/SourceCodePro-Semibold.ttf.woff b/0.10.2/SourceCodePro-Semibold.ttf.woff new file mode 100644 index 000000000..61bc67b80 Binary files /dev/null and b/0.10.2/SourceCodePro-Semibold.ttf.woff differ diff --git a/0.10.2/SourceCodePro-Semibold.ttf.woff2 b/0.10.2/SourceCodePro-Semibold.ttf.woff2 new file mode 100644 index 000000000..5ec64eef0 Binary files /dev/null and b/0.10.2/SourceCodePro-Semibold.ttf.woff2 differ diff --git a/0.10.2/SourceSerif4-Bold.ttf.woff b/0.10.2/SourceSerif4-Bold.ttf.woff new file mode 100644 index 000000000..8ad41888e Binary files /dev/null and b/0.10.2/SourceSerif4-Bold.ttf.woff differ diff --git a/0.10.2/SourceSerif4-Bold.ttf.woff2 b/0.10.2/SourceSerif4-Bold.ttf.woff2 new file mode 100644 index 000000000..db57d2145 Binary files /dev/null and b/0.10.2/SourceSerif4-Bold.ttf.woff2 differ diff --git a/0.10.2/SourceSerif4-It.ttf.woff b/0.10.2/SourceSerif4-It.ttf.woff new file mode 100644 index 000000000..2a34b5c42 Binary files /dev/null and b/0.10.2/SourceSerif4-It.ttf.woff differ diff --git a/0.10.2/SourceSerif4-It.ttf.woff2 b/0.10.2/SourceSerif4-It.ttf.woff2 new file mode 100644 index 000000000..1cbc021a3 Binary files /dev/null and b/0.10.2/SourceSerif4-It.ttf.woff2 differ diff --git a/0.10.2/SourceSerif4-LICENSE.md b/0.10.2/SourceSerif4-LICENSE.md new file mode 100644 index 000000000..68ea18924 --- /dev/null +++ b/0.10.2/SourceSerif4-LICENSE.md @@ -0,0 +1,93 @@ +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.2/SourceSerif4-Regular.ttf.woff b/0.10.2/SourceSerif4-Regular.ttf.woff new file mode 100644 index 000000000..45a5521ab Binary files /dev/null and b/0.10.2/SourceSerif4-Regular.ttf.woff differ diff --git a/0.10.2/SourceSerif4-Regular.ttf.woff2 b/0.10.2/SourceSerif4-Regular.ttf.woff2 new file mode 100644 index 000000000..2db73fe2b Binary files /dev/null and b/0.10.2/SourceSerif4-Regular.ttf.woff2 differ diff --git a/0.10.2/ayu.css b/0.10.2/ayu.css new file mode 100644 index 000000000..3444ac5f1 --- /dev/null +++ b/0.10.2/ayu.css @@ -0,0 +1 @@ + body{background-color:#0f1419;color:#c5c5c5;}h1,h2,h3,h4{color:white;}h1.fqn{border-bottom-color:#5c6773;}h1.fqn a{color:#fff;}h2,h3,h4{border-bottom-color:#5c6773;}h4{border:none;}.in-band{background-color:#0f1419;}.invisible{background:rgba(0,0,0,0);}.docblock code{color:#ffb454;}.code-header{color:#e6e1cf;}.docblock pre>code,pre>code{color:#e6e1cf;}span code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}.docblock code,.docblock-short code{background-color:#191f26;}pre,.rustdoc.source .example-wrap{color:#e6e1cf;background-color:#191f26;}.sidebar{background-color:#14191f;}.logo-container.rust-logo>img{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}*{scrollbar-color:#5c6773 transparent;}.sidebar{scrollbar-color:#5c6773 transparent;}::-webkit-scrollbar-track{background-color:transparent;}::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar::-webkit-scrollbar-track{background-color:transparent;}.sidebar::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar .current{background-color:transparent;color:#ffb44c;}.source .sidebar{background-color:#0f1419;}.sidebar .location{border-color:#000;background-color:#0f1419;color:#fff;}.sidebar-elems .location{color:#ff7733;}.sidebar-elems .location a{color:#fff;}.sidebar .version{border-bottom-color:#424c57;}.sidebar-title{border-top-color:#5c6773;border-bottom-color:#5c6773;}.block a:hover{background:transparent;color:#ffb44c;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#5c6773;}.docblock table td,.docblock table th{border-color:#5c6773;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#c5c5c5;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#000 !important;background-color:#c6afb3;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.content .item-info::before{color:#ccc;}.content span.foreigntype,.content a.foreigntype{color:#ef57ff;}.content span.union,.content a.union{color:#98a01c;}.content span.constant,.content a.constant,.content span.static,.content a.static{color:#6380a0;}.content span.primitive,.content a.primitive{color:#32889b;}.content span.traitalias,.content a.traitalias{color:#57d399;}.content span.keyword,.content a.keyword{color:#de5249;}.content span.externcrate,.content span.mod,.content a.mod{color:#acccf9;}.content span.struct,.content a.struct{color:#ffa0a5;}.content span.enum,.content a.enum{color:#99e0c9;}.content span.trait,.content a.trait{color:#39AFD7;}.content span.type,.content a.type{color:#cfbcf5;}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod,.content .fnname{color:#fdd687;}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:#a37acc;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}nav:not(.sidebar){border-bottom-color:#424c57;}nav.main .current{border-top-color:#5c6773;border-bottom-color:#5c6773;}nav.main .separator{border:1px solid #5c6773;}a{color:#c5c5c5;}body.source .example-wrap pre.rust a{background:#c5c5c5;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#39AFD7;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search{color:#c5c5c5;background-color:#141920;box-shadow:0 0 0 1px #424c57,0 0 0 2px transparent;border-color:#424c57;}.search-input{color:#ffffff;background-color:#141920;box-shadow:0 0 0 1px #424c57,0 0 0 2px transparent;transition:box-shadow 150ms ease-in-out;}#crate-search+.search-input:focus{box-shadow:0 0 0 1px #148099,0 0 0 2px transparent;}.search-input:disabled{background-color:#3e3e3e;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable,.stab.deprecated,.stab.portability{color:#c5c5c5;background:#314559 !important;border-style:none !important;border-radius:4px;padding:3px 6px 3px 6px;}.stab.portability>code{color:#e6e1cf;background:none;}#help>div{background:#14191f;box-shadow:0px 6px 20px 0px black;border:none;border-radius:4px;}#help>div>span{border-bottom-color:#5c6773;}.since{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .op,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}pre.rust .attribute .ident,pre.rust .attribute .op{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}.toggle-label,.code-attribute{color:#999;}:target,:target>*{background:rgba(255,236,164,0.06);}:target{border-right:3px solid rgba(255,180,76,0.85);}pre.compile_fail{border-left:2px solid rgba(255,0,0,.4);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.4);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#39AFD7;}.tooltip::after{background-color:#314559;color:#c5c5c5;border:1px solid #5c6773;}.tooltip::before{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;border-color:#5c6773;}.notable-traits-tooltiptext .notable{border-bottom-color:#5c6773;}#titles>button.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>button:not(.selected){background-color:transparent !important;border:none;}#titles>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>button>div.count{color:#888;}.search-input:focus{}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{}.content span.struct,.content a.struct,.block a.current.struct{}#titles>button:hover,#titles>button.selected{}.content span.type,.content a.type,.block a.current.type{}.content span.union,.content a.union,.block a.current.union{}pre.rust .lifetime{}.stab.unstable{}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){}.content span.enum,.content a.enum,.block a.current.enum{}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{}.content span.keyword,.content a.keyword,.block a.current.keyword{}pre.rust .comment{}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{}pre.rust .kw{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{}pre.rust .doccomment{}.stab.deprecated{}.content a.attr,.content a.derive,.content a.macro{}.stab.portability{}.content span.primitive,.content a.primitive,.block a.current.primitive{}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{}pre.rust .kw-2,pre.rust .prelude-ty{}.content span.trait,.content a.trait,.block a.current.trait{}.search-results a:focus span{}a.result-trait:focus{}a.result-traitalias:focus{}a.result-mod:focus,a.result-externcrate:focus{}a.result-mod:focus{}a.result-externcrate:focus{}a.result-enum:focus{}a.result-struct:focus{}a.result-union:focus{}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{}a.result-type:focus{}a.result-foreigntype:focus{}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{}a.result-constant:focus,a.result-static:focus{}a.result-primitive:focus{}a.result-keyword:focus{}@media (max-width:700px){.sidebar-menu{background-color:#14191f;border-bottom-color:#5c6773;border-right-color:#5c6773;}.sidebar-elems{background-color:#14191f;border-right-color:#5c6773;}#sidebar-filler{background-color:#14191f;border-bottom-color:#5c6773;}}kbd{color:#c5c5c5;background-color:#314559;border-color:#5c6773;border-bottom-color:#5c6773;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#5c6773;background-color:#0f1419;color:#fff;}#theme-picker>img,#settings-menu>img{filter:invert(100);}#copy-path{color:#fff;}#copy-path>img{filter:invert(70%);}#copy-path:hover>img{filter:invert(100%);}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#e0e0e0;}#theme-choices{border-color:#5c6773;background-color:#0f1419;}#theme-choices>button:not(:first-child){border-top-color:#5c6773;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:rgba(110,110,110,0.33);}@media (max-width:700px){#theme-picker{background:#0f1419;}}#all-types{background-color:#14191f;}#all-types:hover{background-color:rgba(70,70,70,0.33);}.search-results .result-name span.alias{color:#c5c5c5;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#14191f;}#sidebar-toggle:hover{background-color:rgba(70,70,70,0.33);}#source-sidebar{background-color:#14191f;}#source-sidebar>.title{color:#fff;border-bottom-color:#5c6773;}div.files>a:hover,div.name:hover{background-color:#14191f;color:#ffb44c;}div.files>.selected{background-color:#14191f;color:#ffb44c;}.setting-line>.title{border-bottom-color:#5c6773;}input:checked+.slider{background-color:#ffb454 !important;} \ No newline at end of file diff --git a/0.10.2/brush.svg b/0.10.2/brush.svg new file mode 100644 index 000000000..ea266e856 --- /dev/null +++ b/0.10.2/brush.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/chemfiles/all.html b/0.10.2/chemfiles/all.html new file mode 100644 index 000000000..0ddbfd642 --- /dev/null +++ b/0.10.2/chemfiles/all.html @@ -0,0 +1,5 @@ +List of all items in this crate

List of all items[] + +

Structs

Enums

Functions

+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/atom/struct.Atom.html b/0.10.2/chemfiles/atom/struct.Atom.html new file mode 100644 index 000000000..591fac7c9 --- /dev/null +++ b/0.10.2/chemfiles/atom/struct.Atom.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Atom.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/atom/struct.AtomMut.html b/0.10.2/chemfiles/atom/struct.AtomMut.html new file mode 100644 index 000000000..2843d6f36 --- /dev/null +++ b/0.10.2/chemfiles/atom/struct.AtomMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomMut.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/atom/struct.AtomRef.html b/0.10.2/chemfiles/atom/struct.AtomRef.html new file mode 100644 index 000000000..fc21ff8b9 --- /dev/null +++ b/0.10.2/chemfiles/atom/struct.AtomRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomRef.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/cell/enum.CellShape.html b/0.10.2/chemfiles/cell/enum.CellShape.html new file mode 100644 index 000000000..9d3d95dbc --- /dev/null +++ b/0.10.2/chemfiles/cell/enum.CellShape.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.CellShape.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/cell/struct.UnitCell.html b/0.10.2/chemfiles/cell/struct.UnitCell.html new file mode 100644 index 000000000..c199c7635 --- /dev/null +++ b/0.10.2/chemfiles/cell/struct.UnitCell.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCell.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/cell/struct.UnitCellMut.html b/0.10.2/chemfiles/cell/struct.UnitCellMut.html new file mode 100644 index 000000000..a07e76605 --- /dev/null +++ b/0.10.2/chemfiles/cell/struct.UnitCellMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellMut.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/cell/struct.UnitCellRef.html b/0.10.2/chemfiles/cell/struct.UnitCellRef.html new file mode 100644 index 000000000..7455c76ac --- /dev/null +++ b/0.10.2/chemfiles/cell/struct.UnitCellRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellRef.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/enum.BondOrder.html b/0.10.2/chemfiles/enum.BondOrder.html new file mode 100644 index 000000000..29e964670 --- /dev/null +++ b/0.10.2/chemfiles/enum.BondOrder.html @@ -0,0 +1,54 @@ +BondOrder in chemfiles - Rust

Enum chemfiles::BondOrder[][src]

#[repr(C)]
+#[non_exhaustive]
+pub enum BondOrder {
+    Unknown,
+    Single,
+    Double,
+    Triple,
+    Quadruple,
+    Quintuplet,
+    Amide,
+    Aromatic,
+}
Expand description

Possible bond order associated with bonds

+

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unknown

Unknown or unspecified bond order

+
Single

Single bond

+
Double

Double bond

+
Triple

Triple bond

+
Quadruple

Quadruple bond (present in some metals)

+
Quintuplet

Quintuplet bond (present in some metals)

+
Amide

Amide bond (required by some file formats)

+
Aromatic

Aromatic bond (required by some file formats)

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Performs the conversion.

+

This method returns an Ordering between self and other. Read more

+

Compares and returns the maximum of two values. Read more

+

Compares and returns the minimum of two values. Read more

+

Restrict a value to a certain interval. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

This method tests less than (for self and other) and is used by the < operator. Read more

+

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more

+

This method tests greater than (for self and other) and is used by the > operator. Read more

+

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/enum.CellShape.html b/0.10.2/chemfiles/enum.CellShape.html new file mode 100644 index 000000000..658ea9a58 --- /dev/null +++ b/0.10.2/chemfiles/enum.CellShape.html @@ -0,0 +1,32 @@ +CellShape in chemfiles - Rust

Enum chemfiles::CellShape[][src]

pub enum CellShape {
+    Orthorhombic,
+    Triclinic,
+    Infinite,
+}
Expand description

Available unit cell shapes.

+

Variants

Orthorhombic

Orthorhombic cell, with the three angles equals to 90°.

+
Triclinic

Triclinic cell, with any values for the angles.

+
Infinite

Infinite cell, to use when there is no cell.

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Performs the conversion.

+

Performs the conversion.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/enum.Property.html b/0.10.2/chemfiles/enum.Property.html new file mode 100644 index 000000000..a3fee495e --- /dev/null +++ b/0.10.2/chemfiles/enum.Property.html @@ -0,0 +1,45 @@ +Property in chemfiles - Rust

Enum chemfiles::Property[][src]

pub enum Property {
+    Bool(bool),
+    Double(f64),
+    String(String),
+    Vector3D([f64; 3]),
+}
Expand description

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

Variants

Bool(bool)

Boolean property

+

Tuple Fields of Bool

0: bool
Double(f64)

Floating point property

+

Tuple Fields of Double

0: f64
String(String)

String property

+

Tuple Fields of String

0: String
Vector3D([f64; 3])

3-dimensional vector property

+

Tuple Fields of Vector3D

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Performs the conversion.

+

Performs the conversion.

+

Performs the conversion.

+

Performs the conversion.

+

Performs the conversion.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

This method tests less than (for self and other) and is used by the < operator. Read more

+

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more

+

This method tests greater than (for self and other) and is used by the > operator. Read more

+

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/enum.Status.html b/0.10.2/chemfiles/enum.Status.html new file mode 100644 index 000000000..33a3905fb --- /dev/null +++ b/0.10.2/chemfiles/enum.Status.html @@ -0,0 +1,48 @@ +Status in chemfiles - Rust

Enum chemfiles::Status[][src]

#[repr(C)]
+#[non_exhaustive]
+pub enum Status {
+    Success,
+    MemoryError,
+    FileError,
+    FormatError,
+    SelectionError,
+    ConfigurationError,
+    OutOfBounds,
+    PropertyError,
+    ChemfilesError,
+    StdCppError,
+    UTF8PathError,
+}
Expand description

Possible causes of error in chemfiles

+

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Success

No error

+
MemoryError

Error in memory allocations

+
FileError

Error while reading or writing a file

+
FormatError

Error in file formatting, i.e. the file is invalid

+
SelectionError

Error in selection string syntax

+
ConfigurationError

Error in configuration files syntax

+
OutOfBounds

Error for out of bounds indexing

+
PropertyError

Error related to properties

+
ChemfilesError

Exception in the C++ chemfiles library

+
StdCppError

Exception in the C++ standard library

+
UTF8PathError

The given path is not valid UTF8

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/errors/enum.Status.html b/0.10.2/chemfiles/errors/enum.Status.html new file mode 100644 index 000000000..6aa83fd28 --- /dev/null +++ b/0.10.2/chemfiles/errors/enum.Status.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Status.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/errors/fn.set_warning_callback.html b/0.10.2/chemfiles/errors/fn.set_warning_callback.html new file mode 100644 index 000000000..97bc2a1ba --- /dev/null +++ b/0.10.2/chemfiles/errors/fn.set_warning_callback.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.set_warning_callback.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/errors/struct.Error.html b/0.10.2/chemfiles/errors/struct.Error.html new file mode 100644 index 000000000..34339c749 --- /dev/null +++ b/0.10.2/chemfiles/errors/struct.Error.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Error.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/fn.add_configuration.html b/0.10.2/chemfiles/fn.add_configuration.html new file mode 100644 index 000000000..20795ff00 --- /dev/null +++ b/0.10.2/chemfiles/fn.add_configuration.html @@ -0,0 +1,14 @@ +add_configuration in chemfiles - Rust

Function chemfiles::add_configuration[][src]

pub fn add_configuration<S>(path: S) -> Result<(), Error> where
    S: AsRef<str>, 
Expand description

Read configuration data from the file at path.

+

By default, chemfiles reads configuration from any file named +.chemfiles.toml in the current directory or any parent directory. This +function can be used to add data from another configuration file. Data from +the new configuration file will overwrite any existing data.

+

Errors

+

This function will fail if there is no file at path, or if the file is +incorrectly formatted.

+

Example

+
chemfiles::add_configuration("local-config.toml").unwrap();
+// from now on, the data from "local-config.toml" will be used
+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/fn.formats_list.html b/0.10.2/chemfiles/fn.formats_list.html new file mode 100644 index 000000000..a2b0fb5d5 --- /dev/null +++ b/0.10.2/chemfiles/fn.formats_list.html @@ -0,0 +1,14 @@ +formats_list in chemfiles - Rust

Function chemfiles::formats_list[][src]

pub fn formats_list() -> Vec<FormatMetadata>
Expand description

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Example

+
let formats = chemfiles::formats_list();
+println!("chemfiles supports {} formats:", formats.len());
+for format in &formats {
+    println!(
+        "   {:<15} {}",
+        format.name,
+        format.extension.as_deref().unwrap_or("")
+    );
+}
+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/fn.guess_format.html b/0.10.2/chemfiles/fn.guess_format.html new file mode 100644 index 000000000..b6175eff0 --- /dev/null +++ b/0.10.2/chemfiles/fn.guess_format.html @@ -0,0 +1,20 @@ +guess_format in chemfiles - Rust

Function chemfiles::guess_format[][src]

pub fn guess_format(path: &str) -> String
Expand description

Get the format that chemfiles would use to read a file at the given +path.

+

The format is mostly guessed from the path extension, chemfiles only tries +to read the file to distinguish between CIF and mmCIF files. Opening the +file using the returned format string might still fail. For example, it will +fail if the file is not actually formatted according to the guessed format; +or the format/compression combination is not supported (e.g. XTC / GZ will +not work since the XTC reader does not support compressed files).

+

The returned format is represented in a way compatible with the various +Trajectory constructors, i.e. "<format name> [/ <compression>]", where +compression is optional.

+

Examples

+
let format = chemfiles::guess_format("trajectory.xyz.xz");
+assert_eq!(format, "XYZ / XZ");
+
+let format = chemfiles::guess_format("trajectory.nc");
+assert_eq!(format, "Amber NetCDF");
+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/fn.set_warning_callback.html b/0.10.2/chemfiles/fn.set_warning_callback.html new file mode 100644 index 000000000..f65578abe --- /dev/null +++ b/0.10.2/chemfiles/fn.set_warning_callback.html @@ -0,0 +1,5 @@ +set_warning_callback in chemfiles - Rust

Function chemfiles::set_warning_callback[][src]

pub fn set_warning_callback<F>(callback: F) where
    F: WarningCallback + 'static, 
Expand description

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/fn.version.html b/0.10.2/chemfiles/fn.version.html new file mode 100644 index 000000000..45c813b5e --- /dev/null +++ b/0.10.2/chemfiles/fn.version.html @@ -0,0 +1,7 @@ +version in chemfiles - Rust

Function chemfiles::version[][src]

pub fn version() -> String
Expand description

Get the version of the chemfiles library.

+

Example

+
let version = chemfiles::version();
+assert!(version.starts_with("0.10"));
+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/frame/struct.Frame.html b/0.10.2/chemfiles/frame/struct.Frame.html new file mode 100644 index 000000000..32b972752 --- /dev/null +++ b/0.10.2/chemfiles/frame/struct.Frame.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Frame.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/index.html b/0.10.2/chemfiles/index.html new file mode 100644 index 000000000..72a761b21 --- /dev/null +++ b/0.10.2/chemfiles/index.html @@ -0,0 +1,63 @@ +chemfiles - Rust

Crate chemfiles[][src]

Expand description

Chemfiles is a multi-language library written in modern C++ for reading and +writing from and to molecular trajectory files. These files are created by +your favorite theoretical chemistry program, and contains information about +atomic or residues names and positions. Some format also have additional +information, such as velocities, forces, energy, …

+

This crate expose the C API of chemfiles to Rust, and make all the +functionalities accessible. For more information on the C++ library, +please see its documentation. Specifically, the following pages +are worth reading:

+ +

Structs

+

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+

An analog to a mutable reference to an atom (&mut Atom)

+

An analog to a reference to an atom (&Atom)

+

Error type for Chemfiles.

+

FormatMetadata contains metadata associated with one format.

+

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

An iterator over the properties in an atom/frame/residue

+

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

An analog to a reference to a residue (&Residue)

+

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

An analog to a reference to a topology (&Topology)

+

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

An UnitCell represent the box containing the atoms, and its periodicity.

+

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

An analog to a reference to an unit cell (&UnitCell)

+

Enums

+

Possible bond order associated with bonds

+

Available unit cell shapes.

+

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

Possible causes of error in chemfiles

+

Functions

+

Read configuration data from the file at path.

+

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Get the format that chemfiles would use to read a file at the given +path.

+

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+

Get the version of the chemfiles library.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/misc/fn.formats_list.html b/0.10.2/chemfiles/misc/fn.formats_list.html new file mode 100644 index 000000000..481646355 --- /dev/null +++ b/0.10.2/chemfiles/misc/fn.formats_list.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.formats_list.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/misc/fn.guess_format.html b/0.10.2/chemfiles/misc/fn.guess_format.html new file mode 100644 index 000000000..681a66ce5 --- /dev/null +++ b/0.10.2/chemfiles/misc/fn.guess_format.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.guess_format.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/misc/struct.FormatMetadata.html b/0.10.2/chemfiles/misc/struct.FormatMetadata.html new file mode 100644 index 000000000..10fda814b --- /dev/null +++ b/0.10.2/chemfiles/misc/struct.FormatMetadata.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.FormatMetadata.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/property/enum.Property.html b/0.10.2/chemfiles/property/enum.Property.html new file mode 100644 index 000000000..87bfc97da --- /dev/null +++ b/0.10.2/chemfiles/property/enum.Property.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Property.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/property/struct.PropertiesIter.html b/0.10.2/chemfiles/property/struct.PropertiesIter.html new file mode 100644 index 000000000..2faef8a54 --- /dev/null +++ b/0.10.2/chemfiles/property/struct.PropertiesIter.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.PropertiesIter.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/residue/struct.Residue.html b/0.10.2/chemfiles/residue/struct.Residue.html new file mode 100644 index 000000000..e8f25ad8a --- /dev/null +++ b/0.10.2/chemfiles/residue/struct.Residue.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Residue.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/residue/struct.ResidueRef.html b/0.10.2/chemfiles/residue/struct.ResidueRef.html new file mode 100644 index 000000000..9d26d5daa --- /dev/null +++ b/0.10.2/chemfiles/residue/struct.ResidueRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.ResidueRef.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/selection/struct.Match.html b/0.10.2/chemfiles/selection/struct.Match.html new file mode 100644 index 000000000..3c7b0b709 --- /dev/null +++ b/0.10.2/chemfiles/selection/struct.Match.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Match.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/selection/struct.Selection.html b/0.10.2/chemfiles/selection/struct.Selection.html new file mode 100644 index 000000000..8ed2b5d77 --- /dev/null +++ b/0.10.2/chemfiles/selection/struct.Selection.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Selection.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/sidebar-items.js b/0.10.2/chemfiles/sidebar-items.js new file mode 100644 index 000000000..dc3572b15 --- /dev/null +++ b/0.10.2/chemfiles/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["BondOrder","Possible bond order associated with bonds"],["CellShape","Available unit cell shapes."],["Property","A `Property` is a piece of data that can be associated with an `Atom` or a `Frame`."],["Status","Possible causes of error in chemfiles"]],"fn":[["add_configuration","Read configuration data from the file at `path`."],["formats_list","Get the list of formats known by chemfiles, as well as all associated metadata."],["guess_format","Get the format that chemfiles would use to read a file at the given `path`."],["set_warning_callback","Use `callback` for every chemfiles warning. The callback will be passed the warning message. This will drop any previous warning callback."],["version","Get the version of the chemfiles library."]],"struct":[["Atom","An `Atom` is a particle in the current `Frame`. It stores the following atomic properties:"],["AtomMut","An analog to a mutable reference to an atom (`&mut Atom`)"],["AtomRef","An analog to a reference to an atom (`&Atom`)"],["Error","Error type for Chemfiles."],["FormatMetadata","`FormatMetadata` contains metadata associated with one format."],["Frame","A `Frame` contains data from one simulation step: the current unit cell, the topology, the positions, and the velocities of the particles in the system. If some information is missing (topology or velocity or unit cell), the corresponding data is filled with a default value."],["Match","A `Match` is a set of atomic indexes matching a given selection. It can mostly be used like a `&[usize]`."],["PropertiesIter","An iterator over the properties in an atom/frame/residue"],["Residue","A `Residue` is a group of atoms belonging to the same logical unit. They can be small molecules, amino-acids in a protein, monomers in polymers, etc."],["ResidueRef","An analog to a reference to a residue (`&Residue`)"],["Selection","A `Selection` allow to select atoms in a `Frame`, from a selection language. The selection language is built by combining basic operations. Each basic operation follows the `[()] ` structure, where `` is a comparison operator in `== != < <= > >=`."],["Topology","A `Topology` contains the definition of all the atoms in the system, and the liaisons between the atoms (bonds, angles, dihedrals, …). It will also contain all the residues information if it is available."],["TopologyRef","An analog to a reference to a topology (`&Topology`)"],["Trajectory","The `Trajectory` type is the main entry point when using chemfiles. A `Trajectory` behave a bit like a file, allowing to read and/or write `Frame`."],["UnitCell","An `UnitCell` represent the box containing the atoms, and its periodicity."],["UnitCellMut","An analog to a mutable reference to an unit cell (`&mut UnitCell`)"],["UnitCellRef","An analog to a reference to an unit cell (`&UnitCell`)"]]}); \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.Atom.html b/0.10.2/chemfiles/struct.Atom.html new file mode 100644 index 000000000..4d64e4d9d --- /dev/null +++ b/0.10.2/chemfiles/struct.Atom.html @@ -0,0 +1,125 @@ +Atom in chemfiles - Rust

Struct chemfiles::Atom[][src]

pub struct Atom { /* fields omitted */ }
Expand description

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
    +
  • atom name;
  • +
  • atom type;
  • +
  • atom mass;
  • +
  • atom charge.
  • +
+

The atom name is usually an unique identifier (H1, C_a) while the +atom type will be shared between all particles of the same type: H, +Ow, CH3.

+

Implementations

Create an atom with the given name, and set the atom type to name.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom mass, in atomic mass units.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Set the atom mass to mass, in atomic mass units.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

Get the atom charge, in number of the electron charge e.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Set the atom charge to charge, in number of the electron charge e.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

Get the atom name.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Set the atom name to name.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

Set the atom type to atomic_type.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

Get a property with the given name in this atom, if it exist.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.AtomMut.html b/0.10.2/chemfiles/struct.AtomMut.html new file mode 100644 index 000000000..e3ae244db --- /dev/null +++ b/0.10.2/chemfiles/struct.AtomMut.html @@ -0,0 +1,107 @@ +AtomMut in chemfiles - Rust

Struct chemfiles::AtomMut[][src]

pub struct AtomMut<'a> { /* fields omitted */ }
Expand description

An analog to a mutable reference to an atom (&mut Atom)

+

Methods from Deref<Target = Atom>

Get the atom mass, in atomic mass units.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Set the atom mass to mass, in atomic mass units.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

Get the atom charge, in number of the electron charge e.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Set the atom charge to charge, in number of the electron charge e.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

Get the atom name.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Set the atom name to name.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

Set the atom type to atomic_type.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

Get a property with the given name in this atom, if it exist.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Mutably dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.AtomRef.html b/0.10.2/chemfiles/struct.AtomRef.html new file mode 100644 index 000000000..075f68480 --- /dev/null +++ b/0.10.2/chemfiles/struct.AtomRef.html @@ -0,0 +1,72 @@ +AtomRef in chemfiles - Rust

Struct chemfiles::AtomRef[][src]

pub struct AtomRef<'a> { /* fields omitted */ }
Expand description

An analog to a reference to an atom (&Atom)

+

Methods from Deref<Target = Atom>

Get the atom mass, in atomic mass units.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Get the atom charge, in number of the electron charge e.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Get the atom name.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Get a property with the given name in this atom, if it exist.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.Error.html b/0.10.2/chemfiles/struct.Error.html new file mode 100644 index 000000000..ae475ad85 --- /dev/null +++ b/0.10.2/chemfiles/struct.Error.html @@ -0,0 +1,38 @@ +Error in chemfiles - Rust

Struct chemfiles::Error[][src]

pub struct Error {
+    pub status: Status,
+    pub message: String,
+}
Expand description

Error type for Chemfiles.

+

Fields

status: Status

The error status code

+
message: String

A message describing the error cause

+

Implementations

Get the last error message from the C++ library.

+

Clear any error from the C++ library

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Formats the value using the given formatter. Read more

+
👎 Deprecated since 1.42.0:

use the Display impl or to_string()

+

The lower-level source of this error, if any. Read more

+
🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

+
👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

+

Performs the conversion.

+

Performs the conversion.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

Converts the given value to a String. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.FormatMetadata.html b/0.10.2/chemfiles/struct.FormatMetadata.html new file mode 100644 index 000000000..574aceec6 --- /dev/null +++ b/0.10.2/chemfiles/struct.FormatMetadata.html @@ -0,0 +1,50 @@ +FormatMetadata in chemfiles - Rust

Struct chemfiles::FormatMetadata[][src]

pub struct FormatMetadata {
Show 13 fields + pub name: &'static str, + pub extension: Option<&'static str>, + pub description: &'static str, + pub reference: &'static str, + pub read: bool, + pub write: bool, + pub memory: bool, + pub positions: bool, + pub velocities: bool, + pub unit_cell: bool, + pub atoms: bool, + pub bonds: bool, + pub residues: bool, +
}
Expand description

FormatMetadata contains metadata associated with one format.

+

Fields

name: &'static str

Name of the format.

+
extension: Option<&'static str>

Extension associated with the format.

+
description: &'static str

Extended, user-facing description of the format.

+
reference: &'static str

URL pointing to the format definition/reference.

+
read: bool

Is reading files in this format implemented?

+
write: bool

Is writing files in this format implemented?

+
memory: bool

Does this format support in-memory IO?

+
positions: bool

Does this format support storing atomic positions?

+
velocities: bool

Does this format support storing atomic velocities?

+
unit_cell: bool

Does this format support storing unit cell information?

+
atoms: bool

Does this format support storing atom names or types?

+
bonds: bool

Does this format support storing bonds between atoms?

+
residues: bool

Does this format support storing residues?

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.Frame.html b/0.10.2/chemfiles/struct.Frame.html new file mode 100644 index 000000000..1a67e3b58 --- /dev/null +++ b/0.10.2/chemfiles/struct.Frame.html @@ -0,0 +1,353 @@ +Frame in chemfiles - Rust

Struct chemfiles::Frame[][src]

pub struct Frame { /* fields omitted */ }
Expand description

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

Implementations

Create an empty frame. It will be resized by the library as needed.

+

Example

+
let frame = Frame::new();
+
+assert_eq!(frame.size(), 0);
+

Get a reference to the atom at the given index in this frame.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+let atom = frame.atom(0);
+assert_eq!(atom.name(), "Zn");
+

Get a mutable reference to the atom at the given index in this frame.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+assert_eq!(frame.atom(0).name(), "Zn");
+
+frame.atom_mut(0).set_name("Fe");
+assert_eq!(frame.atom(0).name(), "Fe");
+

Get the current number of atoms in this frame.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.size(), 0);
+
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

Resize the positions and the velocities in this frame, to make space for +natoms atoms. Previous data is conserved, as well as the presence of +absence of velocities.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

Add an Atom and the corresponding position and optionally velocity +data to this frame.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+
+frame.add_velocities();
+frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+

Remove the atom at index i in this frame.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+assert_eq!(frame.size(), 3);
+
+frame.remove(1);
+assert_eq!(frame.size(), 2);
+assert_eq!(frame.atom(1).name(), "Sn");
+

Add a bond between the atoms at indexes i and j in the frame.

+

The bond order is set to BondOrder::Unknown.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+assert_eq!(frame.topology().bonds_count(), 3);
+
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+

Add a bond between the atoms at indexes i and j in the frame +with the given bond order.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(2);
+
+frame.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+

Remove any existing bond between the atoms at indexes i and j in +the frame.

+

This function does nothing if there is no bond between i and j.

+

Example

+
let mut frame = Frame::new();
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+
+frame.remove_bond(2, 4);
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+

Add a copy of residue to this frame.

+

Errors

+

This function fails is the residue id is already in this frame’s +topology, or if the residue contain atoms that are already in another +residue.

+

Example

+
let mut frame = Frame::new();
+
+let residue = Residue::new("foo");
+frame.add_residue(&residue).unwrap();
+
+let topology = frame.topology();
+assert_eq!(topology.residues_count(), 1);
+assert_eq!(topology.residue(0).unwrap().name(), "foo");
+

Get the distance between the atoms at indexes i and j in this frame, +accounting for periodic boundary conditions. The result is expressed in +Angstroms.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+
+assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+

Get the angle formed by the atoms at indexes i, j and k in this +frame, accounting for periodic boundary conditions. The result is +expressed in radians.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+

Get the dihedral angle formed by the atoms at indexes i, j, k and +m in this frame, accounting for periodic boundary conditions. The +result is expressed in radians.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+
+assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+

Get the out of plane distance formed by the atoms at indexes i, j, +k and m in this frame, accounting for periodic boundary conditions. +The result is expressed in angstroms.

+

This is the distance between the atom j and the ikm plane. The j atom +is the center of the improper dihedral angle formed by i, j, k and m.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+

Get a view into the positions of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+
+let positions = frame.positions();
+assert_eq!(positions.len(), 67);
+assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+

Get a mutable view into the positions of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+{
+    let positions = frame.positions_mut();
+    assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    positions[0] = [1.0, 2.0, 3.0];
+}
+
+let positions = frame.positions();
+assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+

Get a view into the velocities of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+
+let velocities = frame.velocities();
+assert_eq!(velocities.len(), 67);
+assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+

Get a mutable view into the velocities of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+{
+    let velocities = frame.velocities_mut();
+    assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    velocities[0] = [1.0, 2.0, 3.0];
+}
+
+let velocities = frame.velocities();
+assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+

Check if this frame contains velocity data.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

Add velocity data to this frame. If the frame already have velocities, +this does nothing.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

Get a reference to the UnitCell from this frame.

+

Example

+
let frame = Frame::new();
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Infinite);
+

Get a mutable reference to the UnitCell from this frame.

+

Example

+
let mut frame = Frame::new();
+
+assert_eq!(frame.cell().shape(), CellShape::Infinite);
+
+frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+

Set the UnitCell of this frame to cell.

+

Example

+
let mut frame = Frame::new();
+
+frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+

Get a reference to the Topology of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(42);
+
+let topology = frame.topology();
+assert_eq!(topology.size(), 42);
+

Set the Topology of this frame to topology.

+

Errors

+

This function fails if the topology contains a different number of atoms +than this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(2);
+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Cl"));
+topology.add_atom(&Atom::new("Cl"));
+topology.add_bond(0, 1);
+
+frame.set_topology(&topology).unwrap();
+assert_eq!(frame.atom(0).name(), "Cl");
+

Get this frame step, i.e. the frame number in the trajectory

+

Example

+
let frame = Frame::new();
+assert_eq!(frame.step(), 0);
+

Set this frame step to step.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
+frame.set_step(10);
+assert_eq!(frame.step(), 10);
+

Guess the bonds, angles and dihedrals in this frame.

+

The bonds are guessed using a distance-based algorithm, and then angles +and dihedrals are guessed from the bonds.

+

Errors

+

This function can fail if the covalent radius is unknown for some atoms +in the frame.

+

Example

+
let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+assert_eq!(frame.topology().bonds_count(), 0);
+
+frame.guess_bonds().unwrap();
+assert_eq!(frame.topology().bonds_count(), 1);
+

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology of the frame.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+
+frame.add_bond(0, 1);
+frame.add_bond(1, 2);
+
+assert_eq!(frame.topology().bonds().len(), 2);
+assert_eq!(frame.topology().angles().len(), 1);
+
+frame.clear_bonds();
+assert!(frame.topology().bonds().is_empty());
+assert!(frame.topology().angles().is_empty());
+

Add a new property with the given name to this frame.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
let mut frame = Frame::new();
+frame.set("a string", "hello");
+frame.set("a double", 4.3);
+
+assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+

Get a property with the given name in this frame, if it exist.

+

Examples

+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+
+assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(frame.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+frame.set("bar", Property::Bool(false));
+
+for (name, property) in frame.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.Match.html b/0.10.2/chemfiles/struct.Match.html new file mode 100644 index 000000000..6dee5dc91 --- /dev/null +++ b/0.10.2/chemfiles/struct.Match.html @@ -0,0 +1,52 @@ +Match in chemfiles - Rust

Struct chemfiles::Match[][src]

pub struct Match { /* fields omitted */ }
Expand description

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

Implementations

Get the length of the Match.

+

Example

+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+

Create a new match containing the atoms in the atoms slice.

+

Panics

+

If the slice contains more than 4 elements, which is the maximal size +of a match.

+

Example

+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+assert_eq!(atomic_match[0], 3);
+assert_eq!(atomic_match[1], 4);
+assert_eq!(atomic_match[2], 5);
+

Iterate over the atomic indexes in the match.

+

Example

+
let atomic_match = Match::new(&[3, 4, 5]);
+let mut iter = atomic_match.iter();
+
+assert_eq!(iter.next(), Some(&3));
+assert_eq!(iter.next(), Some(&4));
+assert_eq!(iter.next(), Some(&5));
+assert_eq!(iter.next(), None);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

The returned type after indexing.

+

Performs the indexing (container[index]) operation. Read more

+

The type of the elements being iterated over.

+

Which kind of iterator are we turning this into?

+

Creates an iterator from a value. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.PropertiesIter.html b/0.10.2/chemfiles/struct.PropertiesIter.html new file mode 100644 index 000000000..e2844f344 --- /dev/null +++ b/0.10.2/chemfiles/struct.PropertiesIter.html @@ -0,0 +1,133 @@ +PropertiesIter in chemfiles - Rust

Struct chemfiles::PropertiesIter[][src]

pub struct PropertiesIter<'a> { /* fields omitted */ }
Expand description

An iterator over the properties in an atom/frame/residue

+

Trait Implementations

The type of the elements being iterated over.

+

Advances the iterator and returns the next value. Read more

+

Returns the bounds on the remaining length of the iterator. Read more

+

Consumes the iterator, counting the number of iterations and returning it. Read more

+

Consumes the iterator, returning the last element. Read more

+
🔬 This is a nightly-only experimental API. (iter_advance_by)

recently added

+

Advances the iterator by n elements. Read more

+

Returns the nth element of the iterator. Read more

+

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more

+

Takes two iterators and creates a new iterator over both in sequence. Read more

+

‘Zips up’ two iterators into a single iterator of pairs. Read more

+
🔬 This is a nightly-only experimental API. (iter_intersperse)

recently added

+

Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more

+
🔬 This is a nightly-only experimental API. (iter_intersperse)

recently added

+

Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more

+

Takes a closure and creates an iterator which calls that closure on each +element. Read more

+

Calls a closure on each element of an iterator. Read more

+

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more

+

Creates an iterator that both filters and maps. Read more

+

Creates an iterator which gives the current iteration count as well as +the next value. Read more

+

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more

+

Creates an iterator that skips elements based on a predicate. Read more

+

Creates an iterator that yields elements based on a predicate. Read more

+
🔬 This is a nightly-only experimental API. (iter_map_while)

recently added

+

Creates an iterator that both yields elements based on a predicate and maps. Read more

+

Creates an iterator that skips the first n elements. Read more

+

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more

+

An iterator adapter similar to fold that holds internal state and +produces a new iterator. Read more

+

Creates an iterator that works like map, but flattens nested structure. Read more

+

Creates an iterator that flattens nested structure. Read more

+

Creates an iterator which ends after the first None. Read more

+

Does something with each element of an iterator, passing the value on. Read more

+

Borrows an iterator, rather than consuming it. Read more

+

Transforms an iterator into a collection. Read more

+

Consumes an iterator, creating two collections from it. Read more

+
🔬 This is a nightly-only experimental API. (iter_partition_in_place)

new API

+

Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more

+
🔬 This is a nightly-only experimental API. (iter_is_partitioned)

new API

+

Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more

+

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more

+

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more

+

Folds every element into an accumulator by applying an operation, +returning the final result. Read more

+

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more

+

Tests if every element of the iterator matches a predicate. Read more

+

Tests if any element of the iterator matches a predicate. Read more

+

Searches for an element of an iterator that satisfies a predicate. Read more

+

Applies function to the elements of iterator and returns +the first non-none result. Read more

+
🔬 This is a nightly-only experimental API. (try_find)

new API

+

Applies function to the elements of iterator and returns +the first true result or the first error. Read more

+

Searches for an element in an iterator, returning its index. Read more

+

Searches for an element in an iterator from the right, returning its +index. Read more

+

Returns the maximum element of an iterator. Read more

+

Returns the minimum element of an iterator. Read more

+

Returns the element that gives the maximum value from the +specified function. Read more

+

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more

+

Returns the element that gives the minimum value from the +specified function. Read more

+

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more

+

Reverses an iterator’s direction. Read more

+

Converts an iterator of pairs into a pair of containers. Read more

+

Creates an iterator which copies all of its elements. Read more

+

Creates an iterator which clones all of its elements. Read more

+

Repeats an iterator endlessly. Read more

+

Sums the elements of an iterator. Read more

+

Iterates over the entire iterator, multiplying all the elements Read more

+

Lexicographically compares the elements of this Iterator with those +of another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more

+

Lexicographically compares the elements of this Iterator with those +of another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more

+

Determines if the elements of this Iterator are equal to those of +another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more

+

Determines if the elements of this Iterator are unequal to those of +another. Read more

+

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

new API

+

Checks if the elements of this iterator are sorted. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

new API

+

Checks if the elements of this iterator are sorted using the given comparator function. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

new API

+

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type of the elements being iterated over.

+

Which kind of iterator are we turning this into?

+

Creates an iterator from a value. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.Residue.html b/0.10.2/chemfiles/struct.Residue.html new file mode 100644 index 000000000..aca09c5ab --- /dev/null +++ b/0.10.2/chemfiles/struct.Residue.html @@ -0,0 +1,107 @@ +Residue in chemfiles - Rust

Struct chemfiles::Residue[][src]

pub struct Residue { /* fields omitted */ }
Expand description

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

Implementations

Create a new residue with the given name

+

Example

+
let residue = Residue::new("ALA");
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), None);
+

Create a new residue with the given name and id as identifier.

+

Example

+
let residue = Residue::with_id("ALA", 67);
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), Some(67));
+

Get the number of atoms in this residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

Get the identifier of this residue in the initial topology file.

+

Example

+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

Get the name of this residue.

+

Example

+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

Add the atom at index atom in this residue.

+

This will fail if the atom is already in the residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+assert_eq!(residue.contains(56), true);
+
+// Adding the same atom twice is fine
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+

Check if the atom at index i is in this residue

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

Get the list of atoms of this residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

Add a new property with the given name to this residue.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("a string", "hello");
+residue.set("a double", 3.2);
+
+assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+

Get a property with the given name in this frame, if it exist.

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.ResidueRef.html b/0.10.2/chemfiles/struct.ResidueRef.html new file mode 100644 index 000000000..0d21a4029 --- /dev/null +++ b/0.10.2/chemfiles/struct.ResidueRef.html @@ -0,0 +1,66 @@ +ResidueRef in chemfiles - Rust

Struct chemfiles::ResidueRef[][src]

pub struct ResidueRef<'a> { /* fields omitted */ }
Expand description

An analog to a reference to a residue (&Residue)

+

Methods from Deref<Target = Residue>

Get the number of atoms in this residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

Get the identifier of this residue in the initial topology file.

+

Example

+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

Get the name of this residue.

+

Example

+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

Check if the atom at index i is in this residue

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

Get the list of atoms of this residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

Get a property with the given name in this frame, if it exist.

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.Selection.html b/0.10.2/chemfiles/struct.Selection.html new file mode 100644 index 000000000..c1f315915 --- /dev/null +++ b/0.10.2/chemfiles/struct.Selection.html @@ -0,0 +1,76 @@ +Selection in chemfiles - Rust

Struct chemfiles::Selection[][src]

pub struct Selection { /* fields omitted */ }
Expand description

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

Implementations

Create a new selection from the given selection string.

+

Errors

+

This function fails if the selection string is invalid.

+

Example

+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+

Get the size of the selection, i.e. the number of atoms we are selecting +together.

+

This value is 1 for the ‘atom’ context, 2 for the ‘pair’ and ‘bond’ +context, 3 for the ‘three’ and ‘angles’ context and 4 for the ‘four’ +and ‘dihedral’ context.

+

Example

+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+assert_eq!(selection.size(), 2);
+

Get the selection string used to create this selection.

+

Example

+
let selection = Selection::new("name H").unwrap();
+assert_eq!(selection.string(), "name H");
+

Evaluate a selection for a given frame, and return the corresponding +matches.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+let matches = selection.evaluate(&frame);
+
+assert_eq!(matches.len(), 2);
+
+assert_eq!(matches[0].len(), 2);
+assert_eq!(matches[0][0], 0);
+assert_eq!(matches[0][1], 1);
+
+assert_eq!(matches[1].len(), 2);
+assert_eq!(matches[1][0], 2);
+assert_eq!(matches[1][1], 1);
+

Evaluates a selection of size 1 on a given frame. This function +returns the list of atomic indexes in the frame matching this selection.

+

Panics

+

If the selection size is not 1

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("name H").unwrap();
+let matches = selection.list(&frame);
+
+assert_eq!(matches.len(), 2);
+assert_eq!(matches[0], 0);
+assert_eq!(matches[1], 2);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.Topology.html b/0.10.2/chemfiles/struct.Topology.html new file mode 100644 index 000000000..92a50e365 --- /dev/null +++ b/0.10.2/chemfiles/struct.Topology.html @@ -0,0 +1,284 @@ +Topology in chemfiles - Rust

Struct chemfiles::Topology[][src]

pub struct Topology { /* fields omitted */ }
Expand description

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

Implementations

Create a new empty topology.

+

Example

+
let topology = Topology::new();
+assert_eq!(topology.size(), 0);
+

Get a reference of the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

Get a mutable reference to the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut topology = Topology::new();
+topology.resize(6);
+
+assert_eq!(topology.atom(4).name(), "");
+
+topology.atom_mut(4).set_name("Fe");
+assert_eq!(topology.atom(4).name(), "Fe");
+

Get the current number of atoms in this topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Resize this topology to hold natoms atoms, inserting dummy atoms if +the new size if bigger than the old one.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Add an Atom at the end of this topology

+

Example

+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Mg"));
+
+let atom = topology.atom(0);
+assert_eq!(atom.name(), "Mg");
+

Remove an Atom from this topology by index. This modify all the +other atoms indexes.

+

Panics

+

If the index is out of bounds

+

Example

+
let mut topology = Topology::new();
+topology.resize(9);
+assert_eq!(topology.size(), 9);
+
+topology.remove(7);
+assert_eq!(topology.size(), 8);
+

Get the number of bonds in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

Get the number of angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

Get the number of dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

Get the number of improper dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

Get the list of bonds in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

Get the list of angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

Get the list of dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

Get the list of improper dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+assert_eq!(topology.angles().len(), 1);
+
+topology.clear_bonds();
+assert!(topology.bonds().is_empty());
+assert!(topology.angles().is_empty());
+

Add a bond between the atoms at indexes i and j in the topology.

+

The bond order is set to BondOrder::Unknown.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+

Add a bond between the atoms at indexes i and j in the topology +with the given bond order.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for the bond between the atoms at indexes i and +j.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for all the bonds in the topology

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

Remove any existing bond between the atoms at indexes i and j in +this topology.

+

This function does nothing if there is no bond between i and j.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+topology.remove_bond(0, 1);
+assert_eq!(topology.bonds_count(), 1);
+
+// Removing a bond that does not exists is fine
+topology.remove_bond(0, 2);
+assert_eq!(topology.bonds_count(), 1);
+

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+

Example

+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Get a copy of the residue containing the atom at index index in this +topology, if any.

+

Example

+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

Get the number of residues in this topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

Add a residue to this topology.

+

Errors

+

This function fails is the residue id is not already in the topology, +or if the residue contains atoms that are already in another residue.

+

Example

+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+

Example

+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.TopologyRef.html b/0.10.2/chemfiles/struct.TopologyRef.html new file mode 100644 index 000000000..033891ec7 --- /dev/null +++ b/0.10.2/chemfiles/struct.TopologyRef.html @@ -0,0 +1,173 @@ +TopologyRef in chemfiles - Rust

Struct chemfiles::TopologyRef[][src]

pub struct TopologyRef<'a> { /* fields omitted */ }
Expand description

An analog to a reference to a topology (&Topology)

+

Methods from Deref<Target = Topology>

Get a reference of the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

Get the current number of atoms in this topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Get the number of bonds in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

Get the number of angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

Get the number of dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

Get the number of improper dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

Get the list of bonds in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

Get the list of angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

Get the list of dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

Get the list of improper dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

Get the bond order for the bond between the atoms at indexes i and +j.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for all the bonds in the topology

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+

Example

+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Get a copy of the residue containing the atom at index index in this +topology, if any.

+

Example

+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

Get the number of residues in this topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+

Example

+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.Trajectory.html b/0.10.2/chemfiles/struct.Trajectory.html new file mode 100644 index 000000000..96ccc06b7 --- /dev/null +++ b/0.10.2/chemfiles/struct.Trajectory.html @@ -0,0 +1,159 @@ +Trajectory in chemfiles - Rust

Struct chemfiles::Trajectory[][src]

pub struct Trajectory { /* fields omitted */ }
Expand description

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

Implementations

Open the file at the given path in the given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Errors

+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+

Example

+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+

Open the file at the given path using a specific file format and the +given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Specifying a format is needed when the file format does not match the +extension, or when there is not standard extension for this format. If +format is an empty string, the format will be guessed from the +extension.

+

Errors

+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+

Example

+
let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+

Read a memory buffer as though it was a formatted file.

+

The memory buffer used to store the file is given using the data +argument. The format parameter is required and should follow the same +rules as in the main Trajectory constructor.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format, or if the format do not support in-memory readers.

+

Example

+
let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+let mut frame = Frame::new();
+trajectory.read(&mut frame).unwrap();
+assert_eq!(frame.size(), 6);
+

Write to a memory buffer as though it was a formatted file.

+

The format parameter should follow the same rules as in the main +Trajectory constructor, except that compression specification +is not supported.

+

The memory_buffer function can be used to retrieve the data written +to memory of the Trajectory.

+

Errors

+

This function fails if the format do not support in-memory writers.

+

Example

+
let trajectory_memory = Trajectory::memory_writer("SMI");
+
+// Binary formats typically do not support this feature
+assert!(Trajectory::memory_writer("XTC").is_err());
+

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+

Example

+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format.

+

Example

+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+

Write a frame to this trajectory.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format.

+

Example

+
let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+

Example

+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+

Errors

+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+

Example

+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+

Errors

+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+

Example

+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+

Example

+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+

Get the number of steps (the number of frames) in a trajectory.

+

Example

+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+

Obtain the memory buffer written to by the trajectory.

+

Errors

+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+

Example

+
let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+

Get file path for this trajectory.

+

Example

+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.UnitCell.html b/0.10.2/chemfiles/struct.UnitCell.html new file mode 100644 index 000000000..2cf643e5e --- /dev/null +++ b/0.10.2/chemfiles/struct.UnitCell.html @@ -0,0 +1,148 @@ +UnitCell in chemfiles - Rust

Struct chemfiles::UnitCell[][src]

pub struct UnitCell { /* fields omitted */ }
Expand description

An UnitCell represent the box containing the atoms, and its periodicity.

+

An unit cell is fully represented by three lengths (a, b, c); and three +angles (alpha, beta, gamma). The angles are stored in degrees, and the +lengths in Angstroms.

+

A cell also has a matricial representation, by projecting the three base +vector into an orthonormal base. We choose to represent such matrix as an +upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Implementations

Create an Orthorhombic UnitCell from the three lengths, in Angstroms.

+

Example

+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Create an Infinite UnitCell.

+

Example

+
let cell = UnitCell::infinite();
+
+assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Infinite);
+

Create an Triclinic UnitCell from the three lengths (in Angstroms) +and three angles (in degree). alpha is the angle between the vectors +b and c; beta is the between the vectors a and c and gamma +is the angle between the vectors a and b.

+

Example

+
let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+assert_eq!(cell.angles()[0], 98.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Create an UnitCell from a cell matrix. If matrix contains only +zeros, then an Infinite cell is created. If only the diagonal of the +matrix is non-zero, then the cell is Orthorhombic. Else a +Triclinic cell is created. The matrix entries should be in Angstroms.

+

Panics

+

If the matrix has a negative determinant, or more generally is not +representing a unit cell.

+

Example

+
let cell = UnitCell::from_matrix([
+    [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+]);
+
+assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Get the three lengths of the cell, in Angstroms.

+

Example

+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Set the three lengths of the cell, in Angstroms.

+

Errors

+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+

Example

+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

Get the three angles of the cell, in degrees.

+

Example

+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Set the three angles of the cell, in degrees.

+

Errors

+

This function fails if the unit cell is not Triclinic.

+

Example

+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Set the shape of the unit cell to shape.

+

Errors

+

This can fail if the cell length or angles are incompatible with the +new shape.

+

Example

+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Get the volume of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.UnitCellMut.html b/0.10.2/chemfiles/struct.UnitCellMut.html new file mode 100644 index 000000000..b1def6d7c --- /dev/null +++ b/0.10.2/chemfiles/struct.UnitCellMut.html @@ -0,0 +1,94 @@ +UnitCellMut in chemfiles - Rust

Struct chemfiles::UnitCellMut[][src]

pub struct UnitCellMut<'a> { /* fields omitted */ }
Expand description

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

Methods from Deref<Target = UnitCell>

Get the three lengths of the cell, in Angstroms.

+

Example

+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Set the three lengths of the cell, in Angstroms.

+

Errors

+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+

Example

+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

Get the three angles of the cell, in degrees.

+

Example

+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Set the three angles of the cell, in degrees.

+

Errors

+

This function fails if the unit cell is not Triclinic.

+

Example

+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Set the shape of the unit cell to shape.

+

Errors

+

This can fail if the cell length or angles are incompatible with the +new shape.

+

Example

+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Get the volume of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Mutably dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/struct.UnitCellRef.html b/0.10.2/chemfiles/struct.UnitCellRef.html new file mode 100644 index 000000000..4a921ab63 --- /dev/null +++ b/0.10.2/chemfiles/struct.UnitCellRef.html @@ -0,0 +1,60 @@ +UnitCellRef in chemfiles - Rust

Struct chemfiles::UnitCellRef[][src]

pub struct UnitCellRef<'a> { /* fields omitted */ }
Expand description

An analog to a reference to an unit cell (&UnitCell)

+

Methods from Deref<Target = UnitCell>

Get the three lengths of the cell, in Angstroms.

+

Example

+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Get the three angles of the cell, in degrees.

+

Example

+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Get the volume of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/chemfiles/topology/enum.BondOrder.html b/0.10.2/chemfiles/topology/enum.BondOrder.html new file mode 100644 index 000000000..14589bc12 --- /dev/null +++ b/0.10.2/chemfiles/topology/enum.BondOrder.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.BondOrder.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/topology/struct.Topology.html b/0.10.2/chemfiles/topology/struct.Topology.html new file mode 100644 index 000000000..1215dacfd --- /dev/null +++ b/0.10.2/chemfiles/topology/struct.Topology.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Topology.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/topology/struct.TopologyRef.html b/0.10.2/chemfiles/topology/struct.TopologyRef.html new file mode 100644 index 000000000..7cdec6164 --- /dev/null +++ b/0.10.2/chemfiles/topology/struct.TopologyRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.TopologyRef.html...

+ + + \ No newline at end of file diff --git a/0.10.2/chemfiles/trajectory/struct.Trajectory.html b/0.10.2/chemfiles/trajectory/struct.Trajectory.html new file mode 100644 index 000000000..bab83ffc9 --- /dev/null +++ b/0.10.2/chemfiles/trajectory/struct.Trajectory.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Trajectory.html...

+ + + \ No newline at end of file diff --git a/0.10.2/clipboard.svg b/0.10.2/clipboard.svg new file mode 100644 index 000000000..8adbd9963 --- /dev/null +++ b/0.10.2/clipboard.svg @@ -0,0 +1 @@ + diff --git a/0.10.2/crates.js b/0.10.2/crates.js new file mode 100644 index 000000000..833ec8f70 --- /dev/null +++ b/0.10.2/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["chemfiles"]; \ No newline at end of file diff --git a/0.10.2/dark.css b/0.10.2/dark.css new file mode 100644 index 000000000..5787fd1ce --- /dev/null +++ b/0.10.2/dark.css @@ -0,0 +1 @@ +body{background-color:#353535;color:#ddd;}h1,h2,h3,h4{color:#ddd;}h1.fqn{border-bottom-color:#d2d2d2;}h2,h3,h4{border-bottom-color:#d2d2d2;}.in-band{background-color:#353535;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#2A2A2A;}pre,.rustdoc.source .example-wrap{background-color:#2A2A2A;}.sidebar{background-color:#505050;}.logo-container.rust-logo>img{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}*{scrollbar-color:rgb(64,65,67) #717171;}.sidebar{scrollbar-color:rgba(32,34,37,.6) transparent;}::-webkit-scrollbar-track{background-color:#717171;}::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar::-webkit-scrollbar-track{background-color:#717171;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar .current{background-color:#333;}.source .sidebar{background-color:#353535;}.sidebar .location{border-color:#fff;background:#575757;color:#DDD;}.sidebar .version{border-bottom-color:#DDD;}.sidebar-title{border-top-color:#777;border-bottom-color:#777;}.block a:hover{background:#444;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#DDD;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#ddd;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#eee !important;background-color:#616161;}.search-results a:focus span{color:#eee !important;}a.result-trait:focus{background-color:#013191;}a.result-traitalias:focus{background-color:#013191;}a.result-mod:focus,a.result-externcrate:focus{background-color:#afc6e4;}a.result-mod:focus{background-color:#803a1b;}a.result-externcrate:focus{background-color:#396bac;}a.result-enum:focus{background-color:#5b4e68;}a.result-struct:focus{background-color:#194e9f;}a.result-union:focus{background-color:#b7bd49;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#4950ed;}a.result-type:focus{background-color:#38902c;}a.result-foreigntype:focus{background-color:#b200d6;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#217d1c;}a.result-constant:focus,a.result-static:focus{background-color:#0063cc;}a.result-primitive:focus{background-color:#00708a;}a.result-keyword:focus{background-color:#884719;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#82b089;}.content span.struct,.content a.struct,.block a.current.struct{color:#2dbfb8;}.content span.type,.content a.type,.block a.current.type{color:#ff7f00;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#dd7de8;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#09bd00;}.content span.union,.content a.union,.block a.current.union{color:#a6ae37;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#82a5c9;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#43aec7;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#bda000;}.content span.trait,.content a.trait,.block a.current.trait{color:#b78cf2;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#b397da;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#2BAB63;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#de5249;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}nav:not(.sidebar){border-bottom-color:#4e4e4e;}nav.main .current{border-top-color:#eee;border-bottom-color:#eee;}nav.main .separator{border-color:#eee;}a{color:#ddd;}body.source .example-wrap pre.rust a{background:#333;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#D2991D;}a.test-arrow{color:#dedede;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search{color:#111;background-color:#f0f0f0;border-color:#000;box-shadow:0 0 0 1px #000,0 0 0 2px transparent;}.search-input{color:#111;background-color:#f0f0f0;box-shadow:0 0 0 1px #000,0 0 0 2px transparent;}.search-input:focus{border-color:#008dfd;}.search-input:disabled{background-color:#c5c4c4;}#crate-search+.search-input:focus{box-shadow:0 0 8px 4px #078dd8;}.module-item .stab,.import-item .stab{color:#ddd;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;color:#2f2f2f;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;color:#2f2f2f;}.stab.portability>code{background:none;}#help>div{background:#4d4d4d;border-color:#bfbfbf;}#help>div>span{border-bottom-color:#bfbfbf;}#help dt{border-color:#bfbfbf;background:rgba(0,0,0,0);}.since{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#ddd;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target,:target>*{background-color:#494a3d;}:target{border-right:3px solid #bb7410;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.8);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.8);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.8);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.8);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;border-color:#000;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;border-color:#777;}.notable-traits-tooltiptext .notable{border-bottom-color:#d2d2d2;}#titles>button:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>button:hover,#titles>button.selected{border-top-color:#0089ff;background-color:#353535;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#505050;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#505050;border-right-color:#000;}#sidebar-filler{background-color:#505050;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#e0e0e0;background:#f0f0f0;color:#000;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#ffb900;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(65%);}#theme-choices{border-color:#e0e0e0;background-color:#353535;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#4e4e4e;}@media (max-width:700px){#theme-picker{background:#f0f0f0;}}#all-types{background-color:#505050;}#all-types:hover{background-color:#606060;}.search-results .result-name span.alias{color:#fff;}.search-results .result-name span.grey{color:#ccc;}#sidebar-toggle{background-color:#565656;}#sidebar-toggle:hover{background-color:#676767;}#source-sidebar{background-color:#565656;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#444;}div.files>.selected{background-color:#333;}.setting-line>.title{border-bottom-color:#ddd;} \ No newline at end of file diff --git a/0.10.2/doc/.lock b/0.10.2/doc/.lock new file mode 100755 index 000000000..e69de29bb diff --git a/0.10.2/doc/COPYRIGHT.txt b/0.10.2/doc/COPYRIGHT.txt new file mode 100644 index 000000000..c2629a83f --- /dev/null +++ b/0.10.2/doc/COPYRIGHT.txt @@ -0,0 +1,50 @@ +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2, + FiraSans-Regular.woff, FiraSans-Medium.woff): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2, + SourceCodePro-Regular.ttf.woff, SourceCodePro-Semibold.ttf.woff, + SourceCodePro-It.ttf.woff): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2, SourceSerif4-Regular.ttf.woff, + SourceSerif4-Bold.ttf.woff, SourceSerif4-It.ttf.woff): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. diff --git a/0.10.2/doc/FiraSans-LICENSE.txt b/0.10.2/doc/FiraSans-LICENSE.txt new file mode 100644 index 000000000..ff9afab06 --- /dev/null +++ b/0.10.2/doc/FiraSans-LICENSE.txt @@ -0,0 +1,94 @@ +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.2/doc/FiraSans-Medium.woff b/0.10.2/doc/FiraSans-Medium.woff new file mode 100644 index 000000000..7d742c5fb Binary files /dev/null and b/0.10.2/doc/FiraSans-Medium.woff differ diff --git a/0.10.2/doc/FiraSans-Medium.woff2 b/0.10.2/doc/FiraSans-Medium.woff2 new file mode 100644 index 000000000..7a1e5fc54 Binary files /dev/null and b/0.10.2/doc/FiraSans-Medium.woff2 differ diff --git a/0.10.2/doc/FiraSans-Regular.woff b/0.10.2/doc/FiraSans-Regular.woff new file mode 100644 index 000000000..d8e0363f4 Binary files /dev/null and b/0.10.2/doc/FiraSans-Regular.woff differ diff --git a/0.10.2/doc/FiraSans-Regular.woff2 b/0.10.2/doc/FiraSans-Regular.woff2 new file mode 100644 index 000000000..e766e06cc Binary files /dev/null and b/0.10.2/doc/FiraSans-Regular.woff2 differ diff --git a/0.10.2/doc/LICENSE-APACHE.txt b/0.10.2/doc/LICENSE-APACHE.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/0.10.2/doc/LICENSE-APACHE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/0.10.2/doc/LICENSE-MIT.txt b/0.10.2/doc/LICENSE-MIT.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/0.10.2/doc/LICENSE-MIT.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/0.10.2/doc/SourceCodePro-It.ttf.woff b/0.10.2/doc/SourceCodePro-It.ttf.woff new file mode 100644 index 000000000..8d68f2feb Binary files /dev/null and b/0.10.2/doc/SourceCodePro-It.ttf.woff differ diff --git a/0.10.2/doc/SourceCodePro-It.ttf.woff2 b/0.10.2/doc/SourceCodePro-It.ttf.woff2 new file mode 100644 index 000000000..462c34efc Binary files /dev/null and b/0.10.2/doc/SourceCodePro-It.ttf.woff2 differ diff --git a/0.10.2/doc/SourceCodePro-LICENSE.txt b/0.10.2/doc/SourceCodePro-LICENSE.txt new file mode 100644 index 000000000..07542572e --- /dev/null +++ b/0.10.2/doc/SourceCodePro-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.2/doc/SourceCodePro-Regular.ttf.woff b/0.10.2/doc/SourceCodePro-Regular.ttf.woff new file mode 100644 index 000000000..7be076e1f Binary files /dev/null and b/0.10.2/doc/SourceCodePro-Regular.ttf.woff differ diff --git a/0.10.2/doc/SourceCodePro-Regular.ttf.woff2 b/0.10.2/doc/SourceCodePro-Regular.ttf.woff2 new file mode 100644 index 000000000..10b558e0b Binary files /dev/null and b/0.10.2/doc/SourceCodePro-Regular.ttf.woff2 differ diff --git a/0.10.2/doc/SourceCodePro-Semibold.ttf.woff b/0.10.2/doc/SourceCodePro-Semibold.ttf.woff new file mode 100644 index 000000000..61bc67b80 Binary files /dev/null and b/0.10.2/doc/SourceCodePro-Semibold.ttf.woff differ diff --git a/0.10.2/doc/SourceCodePro-Semibold.ttf.woff2 b/0.10.2/doc/SourceCodePro-Semibold.ttf.woff2 new file mode 100644 index 000000000..5ec64eef0 Binary files /dev/null and b/0.10.2/doc/SourceCodePro-Semibold.ttf.woff2 differ diff --git a/0.10.2/doc/SourceSerif4-Bold.ttf.woff b/0.10.2/doc/SourceSerif4-Bold.ttf.woff new file mode 100644 index 000000000..8ad41888e Binary files /dev/null and b/0.10.2/doc/SourceSerif4-Bold.ttf.woff differ diff --git a/0.10.2/doc/SourceSerif4-Bold.ttf.woff2 b/0.10.2/doc/SourceSerif4-Bold.ttf.woff2 new file mode 100644 index 000000000..db57d2145 Binary files /dev/null and b/0.10.2/doc/SourceSerif4-Bold.ttf.woff2 differ diff --git a/0.10.2/doc/SourceSerif4-It.ttf.woff b/0.10.2/doc/SourceSerif4-It.ttf.woff new file mode 100644 index 000000000..2a34b5c42 Binary files /dev/null and b/0.10.2/doc/SourceSerif4-It.ttf.woff differ diff --git a/0.10.2/doc/SourceSerif4-It.ttf.woff2 b/0.10.2/doc/SourceSerif4-It.ttf.woff2 new file mode 100644 index 000000000..1cbc021a3 Binary files /dev/null and b/0.10.2/doc/SourceSerif4-It.ttf.woff2 differ diff --git a/0.10.2/doc/SourceSerif4-LICENSE.md b/0.10.2/doc/SourceSerif4-LICENSE.md new file mode 100644 index 000000000..68ea18924 --- /dev/null +++ b/0.10.2/doc/SourceSerif4-LICENSE.md @@ -0,0 +1,93 @@ +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.2/doc/SourceSerif4-Regular.ttf.woff b/0.10.2/doc/SourceSerif4-Regular.ttf.woff new file mode 100644 index 000000000..45a5521ab Binary files /dev/null and b/0.10.2/doc/SourceSerif4-Regular.ttf.woff differ diff --git a/0.10.2/doc/SourceSerif4-Regular.ttf.woff2 b/0.10.2/doc/SourceSerif4-Regular.ttf.woff2 new file mode 100644 index 000000000..2db73fe2b Binary files /dev/null and b/0.10.2/doc/SourceSerif4-Regular.ttf.woff2 differ diff --git a/0.10.2/doc/ayu.css b/0.10.2/doc/ayu.css new file mode 100644 index 000000000..3444ac5f1 --- /dev/null +++ b/0.10.2/doc/ayu.css @@ -0,0 +1 @@ + body{background-color:#0f1419;color:#c5c5c5;}h1,h2,h3,h4{color:white;}h1.fqn{border-bottom-color:#5c6773;}h1.fqn a{color:#fff;}h2,h3,h4{border-bottom-color:#5c6773;}h4{border:none;}.in-band{background-color:#0f1419;}.invisible{background:rgba(0,0,0,0);}.docblock code{color:#ffb454;}.code-header{color:#e6e1cf;}.docblock pre>code,pre>code{color:#e6e1cf;}span code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}.docblock code,.docblock-short code{background-color:#191f26;}pre,.rustdoc.source .example-wrap{color:#e6e1cf;background-color:#191f26;}.sidebar{background-color:#14191f;}.logo-container.rust-logo>img{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}*{scrollbar-color:#5c6773 transparent;}.sidebar{scrollbar-color:#5c6773 transparent;}::-webkit-scrollbar-track{background-color:transparent;}::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar::-webkit-scrollbar-track{background-color:transparent;}.sidebar::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar .current{background-color:transparent;color:#ffb44c;}.source .sidebar{background-color:#0f1419;}.sidebar .location{border-color:#000;background-color:#0f1419;color:#fff;}.sidebar-elems .location{color:#ff7733;}.sidebar-elems .location a{color:#fff;}.sidebar .version{border-bottom-color:#424c57;}.sidebar-title{border-top-color:#5c6773;border-bottom-color:#5c6773;}.block a:hover{background:transparent;color:#ffb44c;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#5c6773;}.docblock table td,.docblock table th{border-color:#5c6773;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#c5c5c5;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#000 !important;background-color:#c6afb3;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.content .item-info::before{color:#ccc;}.content span.foreigntype,.content a.foreigntype{color:#ef57ff;}.content span.union,.content a.union{color:#98a01c;}.content span.constant,.content a.constant,.content span.static,.content a.static{color:#6380a0;}.content span.primitive,.content a.primitive{color:#32889b;}.content span.traitalias,.content a.traitalias{color:#57d399;}.content span.keyword,.content a.keyword{color:#de5249;}.content span.externcrate,.content span.mod,.content a.mod{color:#acccf9;}.content span.struct,.content a.struct{color:#ffa0a5;}.content span.enum,.content a.enum{color:#99e0c9;}.content span.trait,.content a.trait{color:#39AFD7;}.content span.type,.content a.type{color:#cfbcf5;}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod,.content .fnname{color:#fdd687;}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:#a37acc;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}nav:not(.sidebar){border-bottom-color:#424c57;}nav.main .current{border-top-color:#5c6773;border-bottom-color:#5c6773;}nav.main .separator{border:1px solid #5c6773;}a{color:#c5c5c5;}body.source .example-wrap pre.rust a{background:#c5c5c5;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#39AFD7;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search{color:#c5c5c5;background-color:#141920;box-shadow:0 0 0 1px #424c57,0 0 0 2px transparent;border-color:#424c57;}.search-input{color:#ffffff;background-color:#141920;box-shadow:0 0 0 1px #424c57,0 0 0 2px transparent;transition:box-shadow 150ms ease-in-out;}#crate-search+.search-input:focus{box-shadow:0 0 0 1px #148099,0 0 0 2px transparent;}.search-input:disabled{background-color:#3e3e3e;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable,.stab.deprecated,.stab.portability{color:#c5c5c5;background:#314559 !important;border-style:none !important;border-radius:4px;padding:3px 6px 3px 6px;}.stab.portability>code{color:#e6e1cf;background:none;}#help>div{background:#14191f;box-shadow:0px 6px 20px 0px black;border:none;border-radius:4px;}#help>div>span{border-bottom-color:#5c6773;}.since{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .op,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}pre.rust .attribute .ident,pre.rust .attribute .op{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}.toggle-label,.code-attribute{color:#999;}:target,:target>*{background:rgba(255,236,164,0.06);}:target{border-right:3px solid rgba(255,180,76,0.85);}pre.compile_fail{border-left:2px solid rgba(255,0,0,.4);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.4);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#39AFD7;}.tooltip::after{background-color:#314559;color:#c5c5c5;border:1px solid #5c6773;}.tooltip::before{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;border-color:#5c6773;}.notable-traits-tooltiptext .notable{border-bottom-color:#5c6773;}#titles>button.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>button:not(.selected){background-color:transparent !important;border:none;}#titles>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>button>div.count{color:#888;}.search-input:focus{}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{}.content span.struct,.content a.struct,.block a.current.struct{}#titles>button:hover,#titles>button.selected{}.content span.type,.content a.type,.block a.current.type{}.content span.union,.content a.union,.block a.current.union{}pre.rust .lifetime{}.stab.unstable{}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){}.content span.enum,.content a.enum,.block a.current.enum{}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{}.content span.keyword,.content a.keyword,.block a.current.keyword{}pre.rust .comment{}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{}pre.rust .kw{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{}pre.rust .doccomment{}.stab.deprecated{}.content a.attr,.content a.derive,.content a.macro{}.stab.portability{}.content span.primitive,.content a.primitive,.block a.current.primitive{}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{}pre.rust .kw-2,pre.rust .prelude-ty{}.content span.trait,.content a.trait,.block a.current.trait{}.search-results a:focus span{}a.result-trait:focus{}a.result-traitalias:focus{}a.result-mod:focus,a.result-externcrate:focus{}a.result-mod:focus{}a.result-externcrate:focus{}a.result-enum:focus{}a.result-struct:focus{}a.result-union:focus{}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{}a.result-type:focus{}a.result-foreigntype:focus{}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{}a.result-constant:focus,a.result-static:focus{}a.result-primitive:focus{}a.result-keyword:focus{}@media (max-width:700px){.sidebar-menu{background-color:#14191f;border-bottom-color:#5c6773;border-right-color:#5c6773;}.sidebar-elems{background-color:#14191f;border-right-color:#5c6773;}#sidebar-filler{background-color:#14191f;border-bottom-color:#5c6773;}}kbd{color:#c5c5c5;background-color:#314559;border-color:#5c6773;border-bottom-color:#5c6773;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#5c6773;background-color:#0f1419;color:#fff;}#theme-picker>img,#settings-menu>img{filter:invert(100);}#copy-path{color:#fff;}#copy-path>img{filter:invert(70%);}#copy-path:hover>img{filter:invert(100%);}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#e0e0e0;}#theme-choices{border-color:#5c6773;background-color:#0f1419;}#theme-choices>button:not(:first-child){border-top-color:#5c6773;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:rgba(110,110,110,0.33);}@media (max-width:700px){#theme-picker{background:#0f1419;}}#all-types{background-color:#14191f;}#all-types:hover{background-color:rgba(70,70,70,0.33);}.search-results .result-name span.alias{color:#c5c5c5;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#14191f;}#sidebar-toggle:hover{background-color:rgba(70,70,70,0.33);}#source-sidebar{background-color:#14191f;}#source-sidebar>.title{color:#fff;border-bottom-color:#5c6773;}div.files>a:hover,div.name:hover{background-color:#14191f;color:#ffb44c;}div.files>.selected{background-color:#14191f;color:#ffb44c;}.setting-line>.title{border-bottom-color:#5c6773;}input:checked+.slider{background-color:#ffb454 !important;} \ No newline at end of file diff --git a/0.10.2/doc/brush.svg b/0.10.2/doc/brush.svg new file mode 100644 index 000000000..ea266e856 --- /dev/null +++ b/0.10.2/doc/brush.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/all.html b/0.10.2/doc/chemfiles/all.html new file mode 100644 index 000000000..0ddbfd642 --- /dev/null +++ b/0.10.2/doc/chemfiles/all.html @@ -0,0 +1,5 @@ +List of all items in this crate

List of all items[] + +

Structs

Enums

Functions

+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/atom/struct.Atom.html b/0.10.2/doc/chemfiles/atom/struct.Atom.html new file mode 100644 index 000000000..591fac7c9 --- /dev/null +++ b/0.10.2/doc/chemfiles/atom/struct.Atom.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Atom.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/atom/struct.AtomMut.html b/0.10.2/doc/chemfiles/atom/struct.AtomMut.html new file mode 100644 index 000000000..2843d6f36 --- /dev/null +++ b/0.10.2/doc/chemfiles/atom/struct.AtomMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomMut.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/atom/struct.AtomRef.html b/0.10.2/doc/chemfiles/atom/struct.AtomRef.html new file mode 100644 index 000000000..fc21ff8b9 --- /dev/null +++ b/0.10.2/doc/chemfiles/atom/struct.AtomRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomRef.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/cell/enum.CellShape.html b/0.10.2/doc/chemfiles/cell/enum.CellShape.html new file mode 100644 index 000000000..9d3d95dbc --- /dev/null +++ b/0.10.2/doc/chemfiles/cell/enum.CellShape.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.CellShape.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/cell/struct.UnitCell.html b/0.10.2/doc/chemfiles/cell/struct.UnitCell.html new file mode 100644 index 000000000..c199c7635 --- /dev/null +++ b/0.10.2/doc/chemfiles/cell/struct.UnitCell.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCell.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/cell/struct.UnitCellMut.html b/0.10.2/doc/chemfiles/cell/struct.UnitCellMut.html new file mode 100644 index 000000000..a07e76605 --- /dev/null +++ b/0.10.2/doc/chemfiles/cell/struct.UnitCellMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellMut.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/cell/struct.UnitCellRef.html b/0.10.2/doc/chemfiles/cell/struct.UnitCellRef.html new file mode 100644 index 000000000..7455c76ac --- /dev/null +++ b/0.10.2/doc/chemfiles/cell/struct.UnitCellRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellRef.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/enum.BondOrder.html b/0.10.2/doc/chemfiles/enum.BondOrder.html new file mode 100644 index 000000000..29e964670 --- /dev/null +++ b/0.10.2/doc/chemfiles/enum.BondOrder.html @@ -0,0 +1,54 @@ +BondOrder in chemfiles - Rust

Enum chemfiles::BondOrder[][src]

#[repr(C)]
+#[non_exhaustive]
+pub enum BondOrder {
+    Unknown,
+    Single,
+    Double,
+    Triple,
+    Quadruple,
+    Quintuplet,
+    Amide,
+    Aromatic,
+}
Expand description

Possible bond order associated with bonds

+

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Unknown

Unknown or unspecified bond order

+
Single

Single bond

+
Double

Double bond

+
Triple

Triple bond

+
Quadruple

Quadruple bond (present in some metals)

+
Quintuplet

Quintuplet bond (present in some metals)

+
Amide

Amide bond (required by some file formats)

+
Aromatic

Aromatic bond (required by some file formats)

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Performs the conversion.

+

This method returns an Ordering between self and other. Read more

+

Compares and returns the maximum of two values. Read more

+

Compares and returns the minimum of two values. Read more

+

Restrict a value to a certain interval. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

This method tests less than (for self and other) and is used by the < operator. Read more

+

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more

+

This method tests greater than (for self and other) and is used by the > operator. Read more

+

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/enum.CellShape.html b/0.10.2/doc/chemfiles/enum.CellShape.html new file mode 100644 index 000000000..658ea9a58 --- /dev/null +++ b/0.10.2/doc/chemfiles/enum.CellShape.html @@ -0,0 +1,32 @@ +CellShape in chemfiles - Rust

Enum chemfiles::CellShape[][src]

pub enum CellShape {
+    Orthorhombic,
+    Triclinic,
+    Infinite,
+}
Expand description

Available unit cell shapes.

+

Variants

Orthorhombic

Orthorhombic cell, with the three angles equals to 90°.

+
Triclinic

Triclinic cell, with any values for the angles.

+
Infinite

Infinite cell, to use when there is no cell.

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Performs the conversion.

+

Performs the conversion.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/enum.Property.html b/0.10.2/doc/chemfiles/enum.Property.html new file mode 100644 index 000000000..a3fee495e --- /dev/null +++ b/0.10.2/doc/chemfiles/enum.Property.html @@ -0,0 +1,45 @@ +Property in chemfiles - Rust

Enum chemfiles::Property[][src]

pub enum Property {
+    Bool(bool),
+    Double(f64),
+    String(String),
+    Vector3D([f64; 3]),
+}
Expand description

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

Variants

Bool(bool)

Boolean property

+

Tuple Fields of Bool

0: bool
Double(f64)

Floating point property

+

Tuple Fields of Double

0: f64
String(String)

String property

+

Tuple Fields of String

0: String
Vector3D([f64; 3])

3-dimensional vector property

+

Tuple Fields of Vector3D

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Performs the conversion.

+

Performs the conversion.

+

Performs the conversion.

+

Performs the conversion.

+

Performs the conversion.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

This method tests less than (for self and other) and is used by the < operator. Read more

+

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more

+

This method tests greater than (for self and other) and is used by the > operator. Read more

+

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/enum.Status.html b/0.10.2/doc/chemfiles/enum.Status.html new file mode 100644 index 000000000..33a3905fb --- /dev/null +++ b/0.10.2/doc/chemfiles/enum.Status.html @@ -0,0 +1,48 @@ +Status in chemfiles - Rust

Enum chemfiles::Status[][src]

#[repr(C)]
+#[non_exhaustive]
+pub enum Status {
+    Success,
+    MemoryError,
+    FileError,
+    FormatError,
+    SelectionError,
+    ConfigurationError,
+    OutOfBounds,
+    PropertyError,
+    ChemfilesError,
+    StdCppError,
+    UTF8PathError,
+}
Expand description

Possible causes of error in chemfiles

+

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Success

No error

+
MemoryError

Error in memory allocations

+
FileError

Error while reading or writing a file

+
FormatError

Error in file formatting, i.e. the file is invalid

+
SelectionError

Error in selection string syntax

+
ConfigurationError

Error in configuration files syntax

+
OutOfBounds

Error for out of bounds indexing

+
PropertyError

Error related to properties

+
ChemfilesError

Exception in the C++ chemfiles library

+
StdCppError

Exception in the C++ standard library

+
UTF8PathError

The given path is not valid UTF8

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/errors/enum.Status.html b/0.10.2/doc/chemfiles/errors/enum.Status.html new file mode 100644 index 000000000..6aa83fd28 --- /dev/null +++ b/0.10.2/doc/chemfiles/errors/enum.Status.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Status.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/errors/fn.set_warning_callback.html b/0.10.2/doc/chemfiles/errors/fn.set_warning_callback.html new file mode 100644 index 000000000..97bc2a1ba --- /dev/null +++ b/0.10.2/doc/chemfiles/errors/fn.set_warning_callback.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.set_warning_callback.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/errors/struct.Error.html b/0.10.2/doc/chemfiles/errors/struct.Error.html new file mode 100644 index 000000000..34339c749 --- /dev/null +++ b/0.10.2/doc/chemfiles/errors/struct.Error.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Error.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/fn.add_configuration.html b/0.10.2/doc/chemfiles/fn.add_configuration.html new file mode 100644 index 000000000..20795ff00 --- /dev/null +++ b/0.10.2/doc/chemfiles/fn.add_configuration.html @@ -0,0 +1,14 @@ +add_configuration in chemfiles - Rust

Function chemfiles::add_configuration[][src]

pub fn add_configuration<S>(path: S) -> Result<(), Error> where
    S: AsRef<str>, 
Expand description

Read configuration data from the file at path.

+

By default, chemfiles reads configuration from any file named +.chemfiles.toml in the current directory or any parent directory. This +function can be used to add data from another configuration file. Data from +the new configuration file will overwrite any existing data.

+

Errors

+

This function will fail if there is no file at path, or if the file is +incorrectly formatted.

+

Example

+
chemfiles::add_configuration("local-config.toml").unwrap();
+// from now on, the data from "local-config.toml" will be used
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/fn.formats_list.html b/0.10.2/doc/chemfiles/fn.formats_list.html new file mode 100644 index 000000000..a2b0fb5d5 --- /dev/null +++ b/0.10.2/doc/chemfiles/fn.formats_list.html @@ -0,0 +1,14 @@ +formats_list in chemfiles - Rust

Function chemfiles::formats_list[][src]

pub fn formats_list() -> Vec<FormatMetadata>
Expand description

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Example

+
let formats = chemfiles::formats_list();
+println!("chemfiles supports {} formats:", formats.len());
+for format in &formats {
+    println!(
+        "   {:<15} {}",
+        format.name,
+        format.extension.as_deref().unwrap_or("")
+    );
+}
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/fn.guess_format.html b/0.10.2/doc/chemfiles/fn.guess_format.html new file mode 100644 index 000000000..b6175eff0 --- /dev/null +++ b/0.10.2/doc/chemfiles/fn.guess_format.html @@ -0,0 +1,20 @@ +guess_format in chemfiles - Rust

Function chemfiles::guess_format[][src]

pub fn guess_format(path: &str) -> String
Expand description

Get the format that chemfiles would use to read a file at the given +path.

+

The format is mostly guessed from the path extension, chemfiles only tries +to read the file to distinguish between CIF and mmCIF files. Opening the +file using the returned format string might still fail. For example, it will +fail if the file is not actually formatted according to the guessed format; +or the format/compression combination is not supported (e.g. XTC / GZ will +not work since the XTC reader does not support compressed files).

+

The returned format is represented in a way compatible with the various +Trajectory constructors, i.e. "<format name> [/ <compression>]", where +compression is optional.

+

Examples

+
let format = chemfiles::guess_format("trajectory.xyz.xz");
+assert_eq!(format, "XYZ / XZ");
+
+let format = chemfiles::guess_format("trajectory.nc");
+assert_eq!(format, "Amber NetCDF");
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/fn.set_warning_callback.html b/0.10.2/doc/chemfiles/fn.set_warning_callback.html new file mode 100644 index 000000000..f65578abe --- /dev/null +++ b/0.10.2/doc/chemfiles/fn.set_warning_callback.html @@ -0,0 +1,5 @@ +set_warning_callback in chemfiles - Rust

Function chemfiles::set_warning_callback[][src]

pub fn set_warning_callback<F>(callback: F) where
    F: WarningCallback + 'static, 
Expand description

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/fn.version.html b/0.10.2/doc/chemfiles/fn.version.html new file mode 100644 index 000000000..45c813b5e --- /dev/null +++ b/0.10.2/doc/chemfiles/fn.version.html @@ -0,0 +1,7 @@ +version in chemfiles - Rust

Function chemfiles::version[][src]

pub fn version() -> String
Expand description

Get the version of the chemfiles library.

+

Example

+
let version = chemfiles::version();
+assert!(version.starts_with("0.10"));
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/frame/struct.Frame.html b/0.10.2/doc/chemfiles/frame/struct.Frame.html new file mode 100644 index 000000000..32b972752 --- /dev/null +++ b/0.10.2/doc/chemfiles/frame/struct.Frame.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Frame.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/index.html b/0.10.2/doc/chemfiles/index.html new file mode 100644 index 000000000..72a761b21 --- /dev/null +++ b/0.10.2/doc/chemfiles/index.html @@ -0,0 +1,63 @@ +chemfiles - Rust

Crate chemfiles[][src]

Expand description

Chemfiles is a multi-language library written in modern C++ for reading and +writing from and to molecular trajectory files. These files are created by +your favorite theoretical chemistry program, and contains information about +atomic or residues names and positions. Some format also have additional +information, such as velocities, forces, energy, …

+

This crate expose the C API of chemfiles to Rust, and make all the +functionalities accessible. For more information on the C++ library, +please see its documentation. Specifically, the following pages +are worth reading:

+ +

Structs

+

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+

An analog to a mutable reference to an atom (&mut Atom)

+

An analog to a reference to an atom (&Atom)

+

Error type for Chemfiles.

+

FormatMetadata contains metadata associated with one format.

+

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

An iterator over the properties in an atom/frame/residue

+

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

An analog to a reference to a residue (&Residue)

+

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

An analog to a reference to a topology (&Topology)

+

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

An UnitCell represent the box containing the atoms, and its periodicity.

+

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

An analog to a reference to an unit cell (&UnitCell)

+

Enums

+

Possible bond order associated with bonds

+

Available unit cell shapes.

+

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

Possible causes of error in chemfiles

+

Functions

+

Read configuration data from the file at path.

+

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Get the format that chemfiles would use to read a file at the given +path.

+

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+

Get the version of the chemfiles library.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/misc/fn.formats_list.html b/0.10.2/doc/chemfiles/misc/fn.formats_list.html new file mode 100644 index 000000000..481646355 --- /dev/null +++ b/0.10.2/doc/chemfiles/misc/fn.formats_list.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.formats_list.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/misc/fn.guess_format.html b/0.10.2/doc/chemfiles/misc/fn.guess_format.html new file mode 100644 index 000000000..681a66ce5 --- /dev/null +++ b/0.10.2/doc/chemfiles/misc/fn.guess_format.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.guess_format.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/misc/struct.FormatMetadata.html b/0.10.2/doc/chemfiles/misc/struct.FormatMetadata.html new file mode 100644 index 000000000..10fda814b --- /dev/null +++ b/0.10.2/doc/chemfiles/misc/struct.FormatMetadata.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.FormatMetadata.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/property/enum.Property.html b/0.10.2/doc/chemfiles/property/enum.Property.html new file mode 100644 index 000000000..87bfc97da --- /dev/null +++ b/0.10.2/doc/chemfiles/property/enum.Property.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Property.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/property/struct.PropertiesIter.html b/0.10.2/doc/chemfiles/property/struct.PropertiesIter.html new file mode 100644 index 000000000..2faef8a54 --- /dev/null +++ b/0.10.2/doc/chemfiles/property/struct.PropertiesIter.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.PropertiesIter.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/residue/struct.Residue.html b/0.10.2/doc/chemfiles/residue/struct.Residue.html new file mode 100644 index 000000000..e8f25ad8a --- /dev/null +++ b/0.10.2/doc/chemfiles/residue/struct.Residue.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Residue.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/residue/struct.ResidueRef.html b/0.10.2/doc/chemfiles/residue/struct.ResidueRef.html new file mode 100644 index 000000000..9d26d5daa --- /dev/null +++ b/0.10.2/doc/chemfiles/residue/struct.ResidueRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.ResidueRef.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/selection/struct.Match.html b/0.10.2/doc/chemfiles/selection/struct.Match.html new file mode 100644 index 000000000..3c7b0b709 --- /dev/null +++ b/0.10.2/doc/chemfiles/selection/struct.Match.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Match.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/selection/struct.Selection.html b/0.10.2/doc/chemfiles/selection/struct.Selection.html new file mode 100644 index 000000000..8ed2b5d77 --- /dev/null +++ b/0.10.2/doc/chemfiles/selection/struct.Selection.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Selection.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/sidebar-items.js b/0.10.2/doc/chemfiles/sidebar-items.js new file mode 100644 index 000000000..dc3572b15 --- /dev/null +++ b/0.10.2/doc/chemfiles/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["BondOrder","Possible bond order associated with bonds"],["CellShape","Available unit cell shapes."],["Property","A `Property` is a piece of data that can be associated with an `Atom` or a `Frame`."],["Status","Possible causes of error in chemfiles"]],"fn":[["add_configuration","Read configuration data from the file at `path`."],["formats_list","Get the list of formats known by chemfiles, as well as all associated metadata."],["guess_format","Get the format that chemfiles would use to read a file at the given `path`."],["set_warning_callback","Use `callback` for every chemfiles warning. The callback will be passed the warning message. This will drop any previous warning callback."],["version","Get the version of the chemfiles library."]],"struct":[["Atom","An `Atom` is a particle in the current `Frame`. It stores the following atomic properties:"],["AtomMut","An analog to a mutable reference to an atom (`&mut Atom`)"],["AtomRef","An analog to a reference to an atom (`&Atom`)"],["Error","Error type for Chemfiles."],["FormatMetadata","`FormatMetadata` contains metadata associated with one format."],["Frame","A `Frame` contains data from one simulation step: the current unit cell, the topology, the positions, and the velocities of the particles in the system. If some information is missing (topology or velocity or unit cell), the corresponding data is filled with a default value."],["Match","A `Match` is a set of atomic indexes matching a given selection. It can mostly be used like a `&[usize]`."],["PropertiesIter","An iterator over the properties in an atom/frame/residue"],["Residue","A `Residue` is a group of atoms belonging to the same logical unit. They can be small molecules, amino-acids in a protein, monomers in polymers, etc."],["ResidueRef","An analog to a reference to a residue (`&Residue`)"],["Selection","A `Selection` allow to select atoms in a `Frame`, from a selection language. The selection language is built by combining basic operations. Each basic operation follows the `[()] ` structure, where `` is a comparison operator in `== != < <= > >=`."],["Topology","A `Topology` contains the definition of all the atoms in the system, and the liaisons between the atoms (bonds, angles, dihedrals, …). It will also contain all the residues information if it is available."],["TopologyRef","An analog to a reference to a topology (`&Topology`)"],["Trajectory","The `Trajectory` type is the main entry point when using chemfiles. A `Trajectory` behave a bit like a file, allowing to read and/or write `Frame`."],["UnitCell","An `UnitCell` represent the box containing the atoms, and its periodicity."],["UnitCellMut","An analog to a mutable reference to an unit cell (`&mut UnitCell`)"],["UnitCellRef","An analog to a reference to an unit cell (`&UnitCell`)"]]}); \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.Atom.html b/0.10.2/doc/chemfiles/struct.Atom.html new file mode 100644 index 000000000..4d64e4d9d --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.Atom.html @@ -0,0 +1,125 @@ +Atom in chemfiles - Rust

Struct chemfiles::Atom[][src]

pub struct Atom { /* fields omitted */ }
Expand description

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
    +
  • atom name;
  • +
  • atom type;
  • +
  • atom mass;
  • +
  • atom charge.
  • +
+

The atom name is usually an unique identifier (H1, C_a) while the +atom type will be shared between all particles of the same type: H, +Ow, CH3.

+

Implementations

Create an atom with the given name, and set the atom type to name.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom mass, in atomic mass units.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Set the atom mass to mass, in atomic mass units.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

Get the atom charge, in number of the electron charge e.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Set the atom charge to charge, in number of the electron charge e.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

Get the atom name.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Set the atom name to name.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

Set the atom type to atomic_type.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

Get a property with the given name in this atom, if it exist.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.AtomMut.html b/0.10.2/doc/chemfiles/struct.AtomMut.html new file mode 100644 index 000000000..e3ae244db --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.AtomMut.html @@ -0,0 +1,107 @@ +AtomMut in chemfiles - Rust

Struct chemfiles::AtomMut[][src]

pub struct AtomMut<'a> { /* fields omitted */ }
Expand description

An analog to a mutable reference to an atom (&mut Atom)

+

Methods from Deref<Target = Atom>

Get the atom mass, in atomic mass units.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Set the atom mass to mass, in atomic mass units.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

Get the atom charge, in number of the electron charge e.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Set the atom charge to charge, in number of the electron charge e.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

Get the atom name.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Set the atom name to name.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

Set the atom type to atomic_type.

+

Example

+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

Get a property with the given name in this atom, if it exist.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Mutably dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.AtomRef.html b/0.10.2/doc/chemfiles/struct.AtomRef.html new file mode 100644 index 000000000..075f68480 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.AtomRef.html @@ -0,0 +1,72 @@ +AtomRef in chemfiles - Rust

Struct chemfiles::AtomRef[][src]

pub struct AtomRef<'a> { /* fields omitted */ }
Expand description

An analog to a reference to an atom (&Atom)

+

Methods from Deref<Target = Atom>

Get the atom mass, in atomic mass units.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Get the atom charge, in number of the electron charge e.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Get the atom name.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+

Example

+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+

Example

+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+

Example

+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Get a property with the given name in this atom, if it exist.

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+

Examples

+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.Error.html b/0.10.2/doc/chemfiles/struct.Error.html new file mode 100644 index 000000000..ae475ad85 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.Error.html @@ -0,0 +1,38 @@ +Error in chemfiles - Rust

Struct chemfiles::Error[][src]

pub struct Error {
+    pub status: Status,
+    pub message: String,
+}
Expand description

Error type for Chemfiles.

+

Fields

status: Status

The error status code

+
message: String

A message describing the error cause

+

Implementations

Get the last error message from the C++ library.

+

Clear any error from the C++ library

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Formats the value using the given formatter. Read more

+
👎 Deprecated since 1.42.0:

use the Display impl or to_string()

+

The lower-level source of this error, if any. Read more

+
🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

+
👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

+

Performs the conversion.

+

Performs the conversion.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

Converts the given value to a String. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.FormatMetadata.html b/0.10.2/doc/chemfiles/struct.FormatMetadata.html new file mode 100644 index 000000000..574aceec6 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.FormatMetadata.html @@ -0,0 +1,50 @@ +FormatMetadata in chemfiles - Rust

Struct chemfiles::FormatMetadata[][src]

pub struct FormatMetadata {
Show 13 fields + pub name: &'static str, + pub extension: Option<&'static str>, + pub description: &'static str, + pub reference: &'static str, + pub read: bool, + pub write: bool, + pub memory: bool, + pub positions: bool, + pub velocities: bool, + pub unit_cell: bool, + pub atoms: bool, + pub bonds: bool, + pub residues: bool, +
}
Expand description

FormatMetadata contains metadata associated with one format.

+

Fields

name: &'static str

Name of the format.

+
extension: Option<&'static str>

Extension associated with the format.

+
description: &'static str

Extended, user-facing description of the format.

+
reference: &'static str

URL pointing to the format definition/reference.

+
read: bool

Is reading files in this format implemented?

+
write: bool

Is writing files in this format implemented?

+
memory: bool

Does this format support in-memory IO?

+
positions: bool

Does this format support storing atomic positions?

+
velocities: bool

Does this format support storing atomic velocities?

+
unit_cell: bool

Does this format support storing unit cell information?

+
atoms: bool

Does this format support storing atom names or types?

+
bonds: bool

Does this format support storing bonds between atoms?

+
residues: bool

Does this format support storing residues?

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.Frame.html b/0.10.2/doc/chemfiles/struct.Frame.html new file mode 100644 index 000000000..1a67e3b58 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.Frame.html @@ -0,0 +1,353 @@ +Frame in chemfiles - Rust

Struct chemfiles::Frame[][src]

pub struct Frame { /* fields omitted */ }
Expand description

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

Implementations

Create an empty frame. It will be resized by the library as needed.

+

Example

+
let frame = Frame::new();
+
+assert_eq!(frame.size(), 0);
+

Get a reference to the atom at the given index in this frame.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+let atom = frame.atom(0);
+assert_eq!(atom.name(), "Zn");
+

Get a mutable reference to the atom at the given index in this frame.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+assert_eq!(frame.atom(0).name(), "Zn");
+
+frame.atom_mut(0).set_name("Fe");
+assert_eq!(frame.atom(0).name(), "Fe");
+

Get the current number of atoms in this frame.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.size(), 0);
+
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

Resize the positions and the velocities in this frame, to make space for +natoms atoms. Previous data is conserved, as well as the presence of +absence of velocities.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

Add an Atom and the corresponding position and optionally velocity +data to this frame.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+
+frame.add_velocities();
+frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+

Remove the atom at index i in this frame.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+assert_eq!(frame.size(), 3);
+
+frame.remove(1);
+assert_eq!(frame.size(), 2);
+assert_eq!(frame.atom(1).name(), "Sn");
+

Add a bond between the atoms at indexes i and j in the frame.

+

The bond order is set to BondOrder::Unknown.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+assert_eq!(frame.topology().bonds_count(), 3);
+
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+

Add a bond between the atoms at indexes i and j in the frame +with the given bond order.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(2);
+
+frame.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+

Remove any existing bond between the atoms at indexes i and j in +the frame.

+

This function does nothing if there is no bond between i and j.

+

Example

+
let mut frame = Frame::new();
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+
+frame.remove_bond(2, 4);
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+

Add a copy of residue to this frame.

+

Errors

+

This function fails is the residue id is already in this frame’s +topology, or if the residue contain atoms that are already in another +residue.

+

Example

+
let mut frame = Frame::new();
+
+let residue = Residue::new("foo");
+frame.add_residue(&residue).unwrap();
+
+let topology = frame.topology();
+assert_eq!(topology.residues_count(), 1);
+assert_eq!(topology.residue(0).unwrap().name(), "foo");
+

Get the distance between the atoms at indexes i and j in this frame, +accounting for periodic boundary conditions. The result is expressed in +Angstroms.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+
+assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+

Get the angle formed by the atoms at indexes i, j and k in this +frame, accounting for periodic boundary conditions. The result is +expressed in radians.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+

Get the dihedral angle formed by the atoms at indexes i, j, k and +m in this frame, accounting for periodic boundary conditions. The +result is expressed in radians.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+
+assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+

Get the out of plane distance formed by the atoms at indexes i, j, +k and m in this frame, accounting for periodic boundary conditions. +The result is expressed in angstroms.

+

This is the distance between the atom j and the ikm plane. The j atom +is the center of the improper dihedral angle formed by i, j, k and m.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+

Get a view into the positions of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+
+let positions = frame.positions();
+assert_eq!(positions.len(), 67);
+assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+

Get a mutable view into the positions of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+{
+    let positions = frame.positions_mut();
+    assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    positions[0] = [1.0, 2.0, 3.0];
+}
+
+let positions = frame.positions();
+assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+

Get a view into the velocities of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+
+let velocities = frame.velocities();
+assert_eq!(velocities.len(), 67);
+assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+

Get a mutable view into the velocities of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+{
+    let velocities = frame.velocities_mut();
+    assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    velocities[0] = [1.0, 2.0, 3.0];
+}
+
+let velocities = frame.velocities();
+assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+

Check if this frame contains velocity data.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

Add velocity data to this frame. If the frame already have velocities, +this does nothing.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

Get a reference to the UnitCell from this frame.

+

Example

+
let frame = Frame::new();
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Infinite);
+

Get a mutable reference to the UnitCell from this frame.

+

Example

+
let mut frame = Frame::new();
+
+assert_eq!(frame.cell().shape(), CellShape::Infinite);
+
+frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+

Set the UnitCell of this frame to cell.

+

Example

+
let mut frame = Frame::new();
+
+frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+

Get a reference to the Topology of this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(42);
+
+let topology = frame.topology();
+assert_eq!(topology.size(), 42);
+

Set the Topology of this frame to topology.

+

Errors

+

This function fails if the topology contains a different number of atoms +than this frame.

+

Example

+
let mut frame = Frame::new();
+frame.resize(2);
+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Cl"));
+topology.add_atom(&Atom::new("Cl"));
+topology.add_bond(0, 1);
+
+frame.set_topology(&topology).unwrap();
+assert_eq!(frame.atom(0).name(), "Cl");
+

Get this frame step, i.e. the frame number in the trajectory

+

Example

+
let frame = Frame::new();
+assert_eq!(frame.step(), 0);
+

Set this frame step to step.

+

Example

+
let mut frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
+frame.set_step(10);
+assert_eq!(frame.step(), 10);
+

Guess the bonds, angles and dihedrals in this frame.

+

The bonds are guessed using a distance-based algorithm, and then angles +and dihedrals are guessed from the bonds.

+

Errors

+

This function can fail if the covalent radius is unknown for some atoms +in the frame.

+

Example

+
let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+assert_eq!(frame.topology().bonds_count(), 0);
+
+frame.guess_bonds().unwrap();
+assert_eq!(frame.topology().bonds_count(), 1);
+

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology of the frame.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+
+frame.add_bond(0, 1);
+frame.add_bond(1, 2);
+
+assert_eq!(frame.topology().bonds().len(), 2);
+assert_eq!(frame.topology().angles().len(), 1);
+
+frame.clear_bonds();
+assert!(frame.topology().bonds().is_empty());
+assert!(frame.topology().angles().is_empty());
+

Add a new property with the given name to this frame.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
let mut frame = Frame::new();
+frame.set("a string", "hello");
+frame.set("a double", 4.3);
+
+assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+

Get a property with the given name in this frame, if it exist.

+

Examples

+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+
+assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(frame.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+frame.set("bar", Property::Bool(false));
+
+for (name, property) in frame.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.Match.html b/0.10.2/doc/chemfiles/struct.Match.html new file mode 100644 index 000000000..6dee5dc91 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.Match.html @@ -0,0 +1,52 @@ +Match in chemfiles - Rust

Struct chemfiles::Match[][src]

pub struct Match { /* fields omitted */ }
Expand description

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

Implementations

Get the length of the Match.

+

Example

+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+

Create a new match containing the atoms in the atoms slice.

+

Panics

+

If the slice contains more than 4 elements, which is the maximal size +of a match.

+

Example

+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+assert_eq!(atomic_match[0], 3);
+assert_eq!(atomic_match[1], 4);
+assert_eq!(atomic_match[2], 5);
+

Iterate over the atomic indexes in the match.

+

Example

+
let atomic_match = Match::new(&[3, 4, 5]);
+let mut iter = atomic_match.iter();
+
+assert_eq!(iter.next(), Some(&3));
+assert_eq!(iter.next(), Some(&4));
+assert_eq!(iter.next(), Some(&5));
+assert_eq!(iter.next(), None);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

The returned type after indexing.

+

Performs the indexing (container[index]) operation. Read more

+

The type of the elements being iterated over.

+

Which kind of iterator are we turning this into?

+

Creates an iterator from a value. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.PropertiesIter.html b/0.10.2/doc/chemfiles/struct.PropertiesIter.html new file mode 100644 index 000000000..e2844f344 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.PropertiesIter.html @@ -0,0 +1,133 @@ +PropertiesIter in chemfiles - Rust

Struct chemfiles::PropertiesIter[][src]

pub struct PropertiesIter<'a> { /* fields omitted */ }
Expand description

An iterator over the properties in an atom/frame/residue

+

Trait Implementations

The type of the elements being iterated over.

+

Advances the iterator and returns the next value. Read more

+

Returns the bounds on the remaining length of the iterator. Read more

+

Consumes the iterator, counting the number of iterations and returning it. Read more

+

Consumes the iterator, returning the last element. Read more

+
🔬 This is a nightly-only experimental API. (iter_advance_by)

recently added

+

Advances the iterator by n elements. Read more

+

Returns the nth element of the iterator. Read more

+

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more

+

Takes two iterators and creates a new iterator over both in sequence. Read more

+

‘Zips up’ two iterators into a single iterator of pairs. Read more

+
🔬 This is a nightly-only experimental API. (iter_intersperse)

recently added

+

Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more

+
🔬 This is a nightly-only experimental API. (iter_intersperse)

recently added

+

Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more

+

Takes a closure and creates an iterator which calls that closure on each +element. Read more

+

Calls a closure on each element of an iterator. Read more

+

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more

+

Creates an iterator that both filters and maps. Read more

+

Creates an iterator which gives the current iteration count as well as +the next value. Read more

+

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more

+

Creates an iterator that skips elements based on a predicate. Read more

+

Creates an iterator that yields elements based on a predicate. Read more

+
🔬 This is a nightly-only experimental API. (iter_map_while)

recently added

+

Creates an iterator that both yields elements based on a predicate and maps. Read more

+

Creates an iterator that skips the first n elements. Read more

+

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more

+

An iterator adapter similar to fold that holds internal state and +produces a new iterator. Read more

+

Creates an iterator that works like map, but flattens nested structure. Read more

+

Creates an iterator that flattens nested structure. Read more

+

Creates an iterator which ends after the first None. Read more

+

Does something with each element of an iterator, passing the value on. Read more

+

Borrows an iterator, rather than consuming it. Read more

+

Transforms an iterator into a collection. Read more

+

Consumes an iterator, creating two collections from it. Read more

+
🔬 This is a nightly-only experimental API. (iter_partition_in_place)

new API

+

Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more

+
🔬 This is a nightly-only experimental API. (iter_is_partitioned)

new API

+

Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more

+

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more

+

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more

+

Folds every element into an accumulator by applying an operation, +returning the final result. Read more

+

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more

+

Tests if every element of the iterator matches a predicate. Read more

+

Tests if any element of the iterator matches a predicate. Read more

+

Searches for an element of an iterator that satisfies a predicate. Read more

+

Applies function to the elements of iterator and returns +the first non-none result. Read more

+
🔬 This is a nightly-only experimental API. (try_find)

new API

+

Applies function to the elements of iterator and returns +the first true result or the first error. Read more

+

Searches for an element in an iterator, returning its index. Read more

+

Searches for an element in an iterator from the right, returning its +index. Read more

+

Returns the maximum element of an iterator. Read more

+

Returns the minimum element of an iterator. Read more

+

Returns the element that gives the maximum value from the +specified function. Read more

+

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more

+

Returns the element that gives the minimum value from the +specified function. Read more

+

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more

+

Reverses an iterator’s direction. Read more

+

Converts an iterator of pairs into a pair of containers. Read more

+

Creates an iterator which copies all of its elements. Read more

+

Creates an iterator which clones all of its elements. Read more

+

Repeats an iterator endlessly. Read more

+

Sums the elements of an iterator. Read more

+

Iterates over the entire iterator, multiplying all the elements Read more

+

Lexicographically compares the elements of this Iterator with those +of another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more

+

Lexicographically compares the elements of this Iterator with those +of another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more

+

Determines if the elements of this Iterator are equal to those of +another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more

+

Determines if the elements of this Iterator are unequal to those of +another. Read more

+

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

new API

+

Checks if the elements of this iterator are sorted. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

new API

+

Checks if the elements of this iterator are sorted using the given comparator function. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

new API

+

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type of the elements being iterated over.

+

Which kind of iterator are we turning this into?

+

Creates an iterator from a value. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.Residue.html b/0.10.2/doc/chemfiles/struct.Residue.html new file mode 100644 index 000000000..aca09c5ab --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.Residue.html @@ -0,0 +1,107 @@ +Residue in chemfiles - Rust

Struct chemfiles::Residue[][src]

pub struct Residue { /* fields omitted */ }
Expand description

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

Implementations

Create a new residue with the given name

+

Example

+
let residue = Residue::new("ALA");
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), None);
+

Create a new residue with the given name and id as identifier.

+

Example

+
let residue = Residue::with_id("ALA", 67);
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), Some(67));
+

Get the number of atoms in this residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

Get the identifier of this residue in the initial topology file.

+

Example

+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

Get the name of this residue.

+

Example

+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

Add the atom at index atom in this residue.

+

This will fail if the atom is already in the residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+assert_eq!(residue.contains(56), true);
+
+// Adding the same atom twice is fine
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+

Check if the atom at index i is in this residue

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

Get the list of atoms of this residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

Add a new property with the given name to this residue.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("a string", "hello");
+residue.set("a double", 3.2);
+
+assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+

Get a property with the given name in this frame, if it exist.

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.ResidueRef.html b/0.10.2/doc/chemfiles/struct.ResidueRef.html new file mode 100644 index 000000000..0d21a4029 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.ResidueRef.html @@ -0,0 +1,66 @@ +ResidueRef in chemfiles - Rust

Struct chemfiles::ResidueRef[][src]

pub struct ResidueRef<'a> { /* fields omitted */ }
Expand description

An analog to a reference to a residue (&Residue)

+

Methods from Deref<Target = Residue>

Get the number of atoms in this residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

Get the identifier of this residue in the initial topology file.

+

Example

+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

Get the name of this residue.

+

Example

+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

Check if the atom at index i is in this residue

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

Get the list of atoms of this residue.

+

Example

+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

Get a property with the given name in this frame, if it exist.

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+

Examples

+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.Selection.html b/0.10.2/doc/chemfiles/struct.Selection.html new file mode 100644 index 000000000..c1f315915 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.Selection.html @@ -0,0 +1,76 @@ +Selection in chemfiles - Rust

Struct chemfiles::Selection[][src]

pub struct Selection { /* fields omitted */ }
Expand description

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

Implementations

Create a new selection from the given selection string.

+

Errors

+

This function fails if the selection string is invalid.

+

Example

+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+

Get the size of the selection, i.e. the number of atoms we are selecting +together.

+

This value is 1 for the ‘atom’ context, 2 for the ‘pair’ and ‘bond’ +context, 3 for the ‘three’ and ‘angles’ context and 4 for the ‘four’ +and ‘dihedral’ context.

+

Example

+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+assert_eq!(selection.size(), 2);
+

Get the selection string used to create this selection.

+

Example

+
let selection = Selection::new("name H").unwrap();
+assert_eq!(selection.string(), "name H");
+

Evaluate a selection for a given frame, and return the corresponding +matches.

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+let matches = selection.evaluate(&frame);
+
+assert_eq!(matches.len(), 2);
+
+assert_eq!(matches[0].len(), 2);
+assert_eq!(matches[0][0], 0);
+assert_eq!(matches[0][1], 1);
+
+assert_eq!(matches[1].len(), 2);
+assert_eq!(matches[1][0], 2);
+assert_eq!(matches[1][1], 1);
+

Evaluates a selection of size 1 on a given frame. This function +returns the list of atomic indexes in the frame matching this selection.

+

Panics

+

If the selection size is not 1

+

Example

+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("name H").unwrap();
+let matches = selection.list(&frame);
+
+assert_eq!(matches.len(), 2);
+assert_eq!(matches[0], 0);
+assert_eq!(matches[1], 2);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.Topology.html b/0.10.2/doc/chemfiles/struct.Topology.html new file mode 100644 index 000000000..92a50e365 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.Topology.html @@ -0,0 +1,284 @@ +Topology in chemfiles - Rust

Struct chemfiles::Topology[][src]

pub struct Topology { /* fields omitted */ }
Expand description

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

Implementations

Create a new empty topology.

+

Example

+
let topology = Topology::new();
+assert_eq!(topology.size(), 0);
+

Get a reference of the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

Get a mutable reference to the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut topology = Topology::new();
+topology.resize(6);
+
+assert_eq!(topology.atom(4).name(), "");
+
+topology.atom_mut(4).set_name("Fe");
+assert_eq!(topology.atom(4).name(), "Fe");
+

Get the current number of atoms in this topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Resize this topology to hold natoms atoms, inserting dummy atoms if +the new size if bigger than the old one.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Add an Atom at the end of this topology

+

Example

+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Mg"));
+
+let atom = topology.atom(0);
+assert_eq!(atom.name(), "Mg");
+

Remove an Atom from this topology by index. This modify all the +other atoms indexes.

+

Panics

+

If the index is out of bounds

+

Example

+
let mut topology = Topology::new();
+topology.resize(9);
+assert_eq!(topology.size(), 9);
+
+topology.remove(7);
+assert_eq!(topology.size(), 8);
+

Get the number of bonds in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

Get the number of angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

Get the number of dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

Get the number of improper dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

Get the list of bonds in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

Get the list of angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

Get the list of dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

Get the list of improper dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+assert_eq!(topology.angles().len(), 1);
+
+topology.clear_bonds();
+assert!(topology.bonds().is_empty());
+assert!(topology.angles().is_empty());
+

Add a bond between the atoms at indexes i and j in the topology.

+

The bond order is set to BondOrder::Unknown.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+

Add a bond between the atoms at indexes i and j in the topology +with the given bond order.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for the bond between the atoms at indexes i and +j.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for all the bonds in the topology

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

Remove any existing bond between the atoms at indexes i and j in +this topology.

+

This function does nothing if there is no bond between i and j.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+topology.remove_bond(0, 1);
+assert_eq!(topology.bonds_count(), 1);
+
+// Removing a bond that does not exists is fine
+topology.remove_bond(0, 2);
+assert_eq!(topology.bonds_count(), 1);
+

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+

Example

+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Get a copy of the residue containing the atom at index index in this +topology, if any.

+

Example

+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

Get the number of residues in this topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

Add a residue to this topology.

+

Errors

+

This function fails is the residue id is not already in the topology, +or if the residue contains atoms that are already in another residue.

+

Example

+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+

Example

+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.TopologyRef.html b/0.10.2/doc/chemfiles/struct.TopologyRef.html new file mode 100644 index 000000000..033891ec7 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.TopologyRef.html @@ -0,0 +1,173 @@ +TopologyRef in chemfiles - Rust

Struct chemfiles::TopologyRef[][src]

pub struct TopologyRef<'a> { /* fields omitted */ }
Expand description

An analog to a reference to a topology (&Topology)

+

Methods from Deref<Target = Topology>

Get a reference of the atom at the given index in this topology.

+

Panics

+

If index is out of bounds.

+

Example

+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

Get the current number of atoms in this topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Get the number of bonds in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

Get the number of angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

Get the number of dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

Get the number of improper dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

Get the list of bonds in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

Get the list of angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

Get the list of dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

Get the list of improper dihedral angles in the topology.

+

Example

+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

Get the bond order for the bond between the atoms at indexes i and +j.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for all the bonds in the topology

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+

Example

+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Get a copy of the residue containing the atom at index index in this +topology, if any.

+

Example

+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

Get the number of residues in this topology.

+

Example

+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+

Example

+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.Trajectory.html b/0.10.2/doc/chemfiles/struct.Trajectory.html new file mode 100644 index 000000000..96ccc06b7 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.Trajectory.html @@ -0,0 +1,159 @@ +Trajectory in chemfiles - Rust

Struct chemfiles::Trajectory[][src]

pub struct Trajectory { /* fields omitted */ }
Expand description

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

Implementations

Open the file at the given path in the given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Errors

+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+

Example

+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+

Open the file at the given path using a specific file format and the +given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Specifying a format is needed when the file format does not match the +extension, or when there is not standard extension for this format. If +format is an empty string, the format will be guessed from the +extension.

+

Errors

+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+

Example

+
let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+

Read a memory buffer as though it was a formatted file.

+

The memory buffer used to store the file is given using the data +argument. The format parameter is required and should follow the same +rules as in the main Trajectory constructor.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format, or if the format do not support in-memory readers.

+

Example

+
let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+let mut frame = Frame::new();
+trajectory.read(&mut frame).unwrap();
+assert_eq!(frame.size(), 6);
+

Write to a memory buffer as though it was a formatted file.

+

The format parameter should follow the same rules as in the main +Trajectory constructor, except that compression specification +is not supported.

+

The memory_buffer function can be used to retrieve the data written +to memory of the Trajectory.

+

Errors

+

This function fails if the format do not support in-memory writers.

+

Example

+
let trajectory_memory = Trajectory::memory_writer("SMI");
+
+// Binary formats typically do not support this feature
+assert!(Trajectory::memory_writer("XTC").is_err());
+

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+

Example

+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format.

+

Example

+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+

Write a frame to this trajectory.

+

Errors

+

This function fails if the data is incorrectly formatted for the +corresponding format.

+

Example

+
let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+

Example

+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+

Errors

+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+

Example

+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+

Errors

+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+

Example

+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+

Example

+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+

Get the number of steps (the number of frames) in a trajectory.

+

Example

+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+

Obtain the memory buffer written to by the trajectory.

+

Errors

+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+

Example

+
let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+

Get file path for this trajectory.

+

Example

+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.UnitCell.html b/0.10.2/doc/chemfiles/struct.UnitCell.html new file mode 100644 index 000000000..2cf643e5e --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.UnitCell.html @@ -0,0 +1,148 @@ +UnitCell in chemfiles - Rust

Struct chemfiles::UnitCell[][src]

pub struct UnitCell { /* fields omitted */ }
Expand description

An UnitCell represent the box containing the atoms, and its periodicity.

+

An unit cell is fully represented by three lengths (a, b, c); and three +angles (alpha, beta, gamma). The angles are stored in degrees, and the +lengths in Angstroms.

+

A cell also has a matricial representation, by projecting the three base +vector into an orthonormal base. We choose to represent such matrix as an +upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Implementations

Create an Orthorhombic UnitCell from the three lengths, in Angstroms.

+

Example

+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Create an Infinite UnitCell.

+

Example

+
let cell = UnitCell::infinite();
+
+assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Infinite);
+

Create an Triclinic UnitCell from the three lengths (in Angstroms) +and three angles (in degree). alpha is the angle between the vectors +b and c; beta is the between the vectors a and c and gamma +is the angle between the vectors a and b.

+

Example

+
let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+assert_eq!(cell.angles()[0], 98.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Create an UnitCell from a cell matrix. If matrix contains only +zeros, then an Infinite cell is created. If only the diagonal of the +matrix is non-zero, then the cell is Orthorhombic. Else a +Triclinic cell is created. The matrix entries should be in Angstroms.

+

Panics

+

If the matrix has a negative determinant, or more generally is not +representing a unit cell.

+

Example

+
let cell = UnitCell::from_matrix([
+    [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+]);
+
+assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Get the three lengths of the cell, in Angstroms.

+

Example

+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Set the three lengths of the cell, in Angstroms.

+

Errors

+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+

Example

+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

Get the three angles of the cell, in degrees.

+

Example

+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Set the three angles of the cell, in degrees.

+

Errors

+

This function fails if the unit cell is not Triclinic.

+

Example

+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Set the shape of the unit cell to shape.

+

Errors

+

This can fail if the cell length or angles are incompatible with the +new shape.

+

Example

+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Get the volume of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+
🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.UnitCellMut.html b/0.10.2/doc/chemfiles/struct.UnitCellMut.html new file mode 100644 index 000000000..b1def6d7c --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.UnitCellMut.html @@ -0,0 +1,94 @@ +UnitCellMut in chemfiles - Rust

Struct chemfiles::UnitCellMut[][src]

pub struct UnitCellMut<'a> { /* fields omitted */ }
Expand description

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

Methods from Deref<Target = UnitCell>

Get the three lengths of the cell, in Angstroms.

+

Example

+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Set the three lengths of the cell, in Angstroms.

+

Errors

+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+

Example

+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

Get the three angles of the cell, in degrees.

+

Example

+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Set the three angles of the cell, in degrees.

+

Errors

+

This function fails if the unit cell is not Triclinic.

+

Example

+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Set the shape of the unit cell to shape.

+

Errors

+

This can fail if the cell length or angles are incompatible with the +new shape.

+

Example

+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Get the volume of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Mutably dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/struct.UnitCellRef.html b/0.10.2/doc/chemfiles/struct.UnitCellRef.html new file mode 100644 index 000000000..4a921ab63 --- /dev/null +++ b/0.10.2/doc/chemfiles/struct.UnitCellRef.html @@ -0,0 +1,60 @@ +UnitCellRef in chemfiles - Rust

Struct chemfiles::UnitCellRef[][src]

pub struct UnitCellRef<'a> { /* fields omitted */ }
Expand description

An analog to a reference to an unit cell (&UnitCell)

+

Methods from Deref<Target = UnitCell>

Get the three lengths of the cell, in Angstroms.

+

Example

+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Get the three angles of the cell, in degrees.

+

Example

+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Get the volume of the unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+

Example

+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Performs the conversion.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/topology/enum.BondOrder.html b/0.10.2/doc/chemfiles/topology/enum.BondOrder.html new file mode 100644 index 000000000..14589bc12 --- /dev/null +++ b/0.10.2/doc/chemfiles/topology/enum.BondOrder.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.BondOrder.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/topology/struct.Topology.html b/0.10.2/doc/chemfiles/topology/struct.Topology.html new file mode 100644 index 000000000..1215dacfd --- /dev/null +++ b/0.10.2/doc/chemfiles/topology/struct.Topology.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Topology.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/topology/struct.TopologyRef.html b/0.10.2/doc/chemfiles/topology/struct.TopologyRef.html new file mode 100644 index 000000000..7cdec6164 --- /dev/null +++ b/0.10.2/doc/chemfiles/topology/struct.TopologyRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.TopologyRef.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/chemfiles/trajectory/struct.Trajectory.html b/0.10.2/doc/chemfiles/trajectory/struct.Trajectory.html new file mode 100644 index 000000000..bab83ffc9 --- /dev/null +++ b/0.10.2/doc/chemfiles/trajectory/struct.Trajectory.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Trajectory.html...

+ + + \ No newline at end of file diff --git a/0.10.2/doc/clipboard.svg b/0.10.2/doc/clipboard.svg new file mode 100644 index 000000000..8adbd9963 --- /dev/null +++ b/0.10.2/doc/clipboard.svg @@ -0,0 +1 @@ + diff --git a/0.10.2/doc/crates.js b/0.10.2/doc/crates.js new file mode 100644 index 000000000..833ec8f70 --- /dev/null +++ b/0.10.2/doc/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["chemfiles"]; \ No newline at end of file diff --git a/0.10.2/doc/dark.css b/0.10.2/doc/dark.css new file mode 100644 index 000000000..5787fd1ce --- /dev/null +++ b/0.10.2/doc/dark.css @@ -0,0 +1 @@ +body{background-color:#353535;color:#ddd;}h1,h2,h3,h4{color:#ddd;}h1.fqn{border-bottom-color:#d2d2d2;}h2,h3,h4{border-bottom-color:#d2d2d2;}.in-band{background-color:#353535;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#2A2A2A;}pre,.rustdoc.source .example-wrap{background-color:#2A2A2A;}.sidebar{background-color:#505050;}.logo-container.rust-logo>img{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}*{scrollbar-color:rgb(64,65,67) #717171;}.sidebar{scrollbar-color:rgba(32,34,37,.6) transparent;}::-webkit-scrollbar-track{background-color:#717171;}::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar::-webkit-scrollbar-track{background-color:#717171;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar .current{background-color:#333;}.source .sidebar{background-color:#353535;}.sidebar .location{border-color:#fff;background:#575757;color:#DDD;}.sidebar .version{border-bottom-color:#DDD;}.sidebar-title{border-top-color:#777;border-bottom-color:#777;}.block a:hover{background:#444;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#DDD;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#ddd;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#eee !important;background-color:#616161;}.search-results a:focus span{color:#eee !important;}a.result-trait:focus{background-color:#013191;}a.result-traitalias:focus{background-color:#013191;}a.result-mod:focus,a.result-externcrate:focus{background-color:#afc6e4;}a.result-mod:focus{background-color:#803a1b;}a.result-externcrate:focus{background-color:#396bac;}a.result-enum:focus{background-color:#5b4e68;}a.result-struct:focus{background-color:#194e9f;}a.result-union:focus{background-color:#b7bd49;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#4950ed;}a.result-type:focus{background-color:#38902c;}a.result-foreigntype:focus{background-color:#b200d6;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#217d1c;}a.result-constant:focus,a.result-static:focus{background-color:#0063cc;}a.result-primitive:focus{background-color:#00708a;}a.result-keyword:focus{background-color:#884719;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#82b089;}.content span.struct,.content a.struct,.block a.current.struct{color:#2dbfb8;}.content span.type,.content a.type,.block a.current.type{color:#ff7f00;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#dd7de8;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#09bd00;}.content span.union,.content a.union,.block a.current.union{color:#a6ae37;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#82a5c9;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#43aec7;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#bda000;}.content span.trait,.content a.trait,.block a.current.trait{color:#b78cf2;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#b397da;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#2BAB63;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#de5249;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}nav:not(.sidebar){border-bottom-color:#4e4e4e;}nav.main .current{border-top-color:#eee;border-bottom-color:#eee;}nav.main .separator{border-color:#eee;}a{color:#ddd;}body.source .example-wrap pre.rust a{background:#333;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#D2991D;}a.test-arrow{color:#dedede;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search{color:#111;background-color:#f0f0f0;border-color:#000;box-shadow:0 0 0 1px #000,0 0 0 2px transparent;}.search-input{color:#111;background-color:#f0f0f0;box-shadow:0 0 0 1px #000,0 0 0 2px transparent;}.search-input:focus{border-color:#008dfd;}.search-input:disabled{background-color:#c5c4c4;}#crate-search+.search-input:focus{box-shadow:0 0 8px 4px #078dd8;}.module-item .stab,.import-item .stab{color:#ddd;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;color:#2f2f2f;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;color:#2f2f2f;}.stab.portability>code{background:none;}#help>div{background:#4d4d4d;border-color:#bfbfbf;}#help>div>span{border-bottom-color:#bfbfbf;}#help dt{border-color:#bfbfbf;background:rgba(0,0,0,0);}.since{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#ddd;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target,:target>*{background-color:#494a3d;}:target{border-right:3px solid #bb7410;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.8);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.8);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.8);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.8);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;border-color:#000;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;border-color:#777;}.notable-traits-tooltiptext .notable{border-bottom-color:#d2d2d2;}#titles>button:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>button:hover,#titles>button.selected{border-top-color:#0089ff;background-color:#353535;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#505050;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#505050;border-right-color:#000;}#sidebar-filler{background-color:#505050;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#e0e0e0;background:#f0f0f0;color:#000;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#ffb900;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(65%);}#theme-choices{border-color:#e0e0e0;background-color:#353535;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#4e4e4e;}@media (max-width:700px){#theme-picker{background:#f0f0f0;}}#all-types{background-color:#505050;}#all-types:hover{background-color:#606060;}.search-results .result-name span.alias{color:#fff;}.search-results .result-name span.grey{color:#ccc;}#sidebar-toggle{background-color:#565656;}#sidebar-toggle:hover{background-color:#676767;}#source-sidebar{background-color:#565656;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#444;}div.files>.selected{background-color:#333;}.setting-line>.title{border-bottom-color:#ddd;} \ No newline at end of file diff --git a/0.10.2/doc/down-arrow.svg b/0.10.2/doc/down-arrow.svg new file mode 100644 index 000000000..35437e77a --- /dev/null +++ b/0.10.2/doc/down-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/doc/favicon-16x16.png b/0.10.2/doc/favicon-16x16.png new file mode 100644 index 000000000..7cfe6c135 Binary files /dev/null and b/0.10.2/doc/favicon-16x16.png differ diff --git a/0.10.2/doc/favicon-32x32.png b/0.10.2/doc/favicon-32x32.png new file mode 100644 index 000000000..5109c1de8 Binary files /dev/null and b/0.10.2/doc/favicon-32x32.png differ diff --git a/0.10.2/doc/favicon.svg b/0.10.2/doc/favicon.svg new file mode 100644 index 000000000..8b34b5119 --- /dev/null +++ b/0.10.2/doc/favicon.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/0.10.2/doc/implementors/core/clone/trait.Clone.js b/0.10.2/doc/implementors/core/clone/trait.Clone.js new file mode 100644 index 000000000..f29cb2061 --- /dev/null +++ b/0.10.2/doc/implementors/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Clone for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Clone for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Clone for Atom","synthetic":false,"types":["chemfiles::atom::Atom"]},{"text":"impl Clone for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Clone for UnitCell","synthetic":false,"types":["chemfiles::cell::UnitCell"]},{"text":"impl Clone for Residue","synthetic":false,"types":["chemfiles::residue::Residue"]},{"text":"impl Clone for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Clone for Topology","synthetic":false,"types":["chemfiles::topology::Topology"]},{"text":"impl Clone for Frame","synthetic":false,"types":["chemfiles::frame::Frame"]},{"text":"impl Clone for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Clone for Selection","synthetic":false,"types":["chemfiles::selection::Selection"]},{"text":"impl Clone for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl Clone for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/cmp/trait.Eq.js b/0.10.2/doc/implementors/core/cmp/trait.Eq.js new file mode 100644 index 000000000..991ad22a1 --- /dev/null +++ b/0.10.2/doc/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Eq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Eq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Eq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Eq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/cmp/trait.Ord.js b/0.10.2/doc/implementors/core/cmp/trait.Ord.js new file mode 100644 index 000000000..0784ba4cb --- /dev/null +++ b/0.10.2/doc/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Ord for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/cmp/trait.PartialEq.js b/0.10.2/doc/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..b88724be9 --- /dev/null +++ b/0.10.2/doc/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialEq<Error> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl PartialEq<Status> for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl PartialEq<CellShape> for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl PartialEq<BondOrder> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl PartialEq<Match> for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl PartialEq<Property> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl PartialEq<FormatMetadata> for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/cmp/trait.PartialOrd.js b/0.10.2/doc/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..d0dc2d685 --- /dev/null +++ b/0.10.2/doc/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialOrd<BondOrder> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl PartialOrd<Property> for Property","synthetic":false,"types":["chemfiles::property::Property"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/convert/trait.From.js b/0.10.2/doc/implementors/core/convert/trait.From.js new file mode 100644 index 000000000..156356c1d --- /dev/null +++ b/0.10.2/doc/implementors/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl From<chfl_status> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl From<Utf8Error> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl From<chfl_cellshape> for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl From<CellShape> for chfl_cellshape","synthetic":false,"types":["chemfiles_sys::chfl_cellshape"]},{"text":"impl From<chfl_bond_order> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl From<bool> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<f64> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<String> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl<'a> From<&'a str> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<[f64; 3]> for Property","synthetic":false,"types":["chemfiles::property::Property"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/fmt/trait.Debug.js b/0.10.2/doc/implementors/core/fmt/trait.Debug.js new file mode 100644 index 000000000..21a553777 --- /dev/null +++ b/0.10.2/doc/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Debug for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Debug for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Debug for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Debug for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Debug for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Debug for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl Debug for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/fmt/trait.Display.js b/0.10.2/doc/implementors/core/fmt/trait.Display.js new file mode 100644 index 000000000..cdacd5e88 --- /dev/null +++ b/0.10.2/doc/implementors/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Display for Error","synthetic":false,"types":["chemfiles::errors::Error"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/iter/traits/collect/trait.IntoIterator.js b/0.10.2/doc/implementors/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 000000000..f478370c2 --- /dev/null +++ b/0.10.2/doc/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> IntoIterator for &'a Match","synthetic":false,"types":["chemfiles::selection::Match"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/iter/traits/iterator/trait.Iterator.js b/0.10.2/doc/implementors/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 000000000..7bef8fef2 --- /dev/null +++ b/0.10.2/doc/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Iterator for PropertiesIter<'a>","synthetic":false,"types":["chemfiles::property::PropertiesIter"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/marker/trait.Copy.js b/0.10.2/doc/implementors/core/marker/trait.Copy.js new file mode 100644 index 000000000..292291348 --- /dev/null +++ b/0.10.2/doc/implementors/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Copy for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/marker/trait.Freeze.js b/0.10.2/doc/implementors/core/marker/trait.Freeze.js new file mode 100644 index 000000000..7a6ceb43d --- /dev/null +++ b/0.10.2/doc/implementors/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Freeze for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Freeze for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl Freeze for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> Freeze for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Freeze for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Freeze for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl Freeze for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> Freeze for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Freeze for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl Freeze for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> Freeze for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Freeze for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Freeze for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> Freeze for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl Freeze for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl Freeze for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Freeze for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl Freeze for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Freeze for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> Freeze for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Freeze for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/marker/trait.Send.js b/0.10.2/doc/implementors/core/marker/trait.Send.js new file mode 100644 index 000000000..7e2b45b5e --- /dev/null +++ b/0.10.2/doc/implementors/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Send for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Send for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl !Send for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> !Send for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !Send for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Send for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl !Send for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> !Send for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !Send for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl !Send for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> !Send for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Send for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl !Send for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> !Send for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl !Send for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl !Send for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Send for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl !Send for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Send for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !Send for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Send for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/marker/trait.StructuralEq.js b/0.10.2/doc/implementors/core/marker/trait.StructuralEq.js new file mode 100644 index 000000000..706c84330 --- /dev/null +++ b/0.10.2/doc/implementors/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralEq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl StructuralEq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl StructuralEq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl StructuralEq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/marker/trait.StructuralPartialEq.js b/0.10.2/doc/implementors/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 000000000..f07883adc --- /dev/null +++ b/0.10.2/doc/implementors/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralPartialEq for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl StructuralPartialEq for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl StructuralPartialEq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl StructuralPartialEq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl StructuralPartialEq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl StructuralPartialEq for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl StructuralPartialEq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/marker/trait.Sync.js b/0.10.2/doc/implementors/core/marker/trait.Sync.js new file mode 100644 index 000000000..505c4c942 --- /dev/null +++ b/0.10.2/doc/implementors/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Sync for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Sync for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl !Sync for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> !Sync for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !Sync for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Sync for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl !Sync for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> !Sync for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !Sync for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl !Sync for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> !Sync for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Sync for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl !Sync for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> !Sync for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl !Sync for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl !Sync for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Sync for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl !Sync for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Sync for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !Sync for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Sync for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/marker/trait.Unpin.js b/0.10.2/doc/implementors/core/marker/trait.Unpin.js new file mode 100644 index 000000000..5aa634457 --- /dev/null +++ b/0.10.2/doc/implementors/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Unpin for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Unpin for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl Unpin for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> Unpin for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Unpin for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Unpin for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl Unpin for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> Unpin for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Unpin for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl Unpin for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> Unpin for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Unpin for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Unpin for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> Unpin for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl Unpin for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl Unpin for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Unpin for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl Unpin for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Unpin for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> Unpin for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Unpin for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/ops/deref/trait.Deref.js b/0.10.2/doc/implementors/core/ops/deref/trait.Deref.js new file mode 100644 index 000000000..8126c0190 --- /dev/null +++ b/0.10.2/doc/implementors/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Deref for AtomRef<'a>","synthetic":false,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Deref for AtomMut<'a>","synthetic":false,"types":["chemfiles::atom::AtomMut"]},{"text":"impl<'a> Deref for UnitCellRef<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Deref for UnitCellMut<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl<'a> Deref for ResidueRef<'a>","synthetic":false,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl<'a> Deref for TopologyRef<'a>","synthetic":false,"types":["chemfiles::topology::TopologyRef"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/ops/deref/trait.DerefMut.js b/0.10.2/doc/implementors/core/ops/deref/trait.DerefMut.js new file mode 100644 index 000000000..1e78a1875 --- /dev/null +++ b/0.10.2/doc/implementors/core/ops/deref/trait.DerefMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> DerefMut for AtomMut<'a>","synthetic":false,"types":["chemfiles::atom::AtomMut"]},{"text":"impl<'a> DerefMut for UnitCellMut<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellMut"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/ops/drop/trait.Drop.js b/0.10.2/doc/implementors/core/ops/drop/trait.Drop.js new file mode 100644 index 000000000..d2cedb699 --- /dev/null +++ b/0.10.2/doc/implementors/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Drop for Atom","synthetic":false,"types":["chemfiles::atom::Atom"]},{"text":"impl Drop for UnitCell","synthetic":false,"types":["chemfiles::cell::UnitCell"]},{"text":"impl Drop for Residue","synthetic":false,"types":["chemfiles::residue::Residue"]},{"text":"impl Drop for Topology","synthetic":false,"types":["chemfiles::topology::Topology"]},{"text":"impl Drop for Frame","synthetic":false,"types":["chemfiles::frame::Frame"]},{"text":"impl Drop for Trajectory","synthetic":false,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Drop for Selection","synthetic":false,"types":["chemfiles::selection::Selection"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/ops/index/trait.Index.js b/0.10.2/doc/implementors/core/ops/index/trait.Index.js new file mode 100644 index 000000000..f1b5f2ce2 --- /dev/null +++ b/0.10.2/doc/implementors/core/ops/index/trait.Index.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Index<usize> for Match","synthetic":false,"types":["chemfiles::selection::Match"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/0.10.2/doc/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 000000000..5fdc8a884 --- /dev/null +++ b/0.10.2/doc/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl RefUnwindSafe for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl RefUnwindSafe for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl RefUnwindSafe for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> RefUnwindSafe for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> RefUnwindSafe for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl RefUnwindSafe for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl RefUnwindSafe for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> RefUnwindSafe for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> RefUnwindSafe for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl RefUnwindSafe for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> RefUnwindSafe for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl RefUnwindSafe for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl RefUnwindSafe for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> RefUnwindSafe for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl RefUnwindSafe for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl RefUnwindSafe for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl RefUnwindSafe for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl RefUnwindSafe for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl RefUnwindSafe for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !RefUnwindSafe for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl RefUnwindSafe for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/0.10.2/doc/implementors/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 000000000..256c14ddc --- /dev/null +++ b/0.10.2/doc/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl UnwindSafe for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl UnwindSafe for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl UnwindSafe for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> UnwindSafe for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !UnwindSafe for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl UnwindSafe for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl UnwindSafe for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> UnwindSafe for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !UnwindSafe for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl UnwindSafe for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> UnwindSafe for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl UnwindSafe for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl UnwindSafe for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> UnwindSafe for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl UnwindSafe for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl UnwindSafe for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl UnwindSafe for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl UnwindSafe for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl UnwindSafe for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !UnwindSafe for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl UnwindSafe for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/implementors/std/error/trait.Error.js b/0.10.2/doc/implementors/std/error/trait.Error.js new file mode 100644 index 000000000..8c8d3b053 --- /dev/null +++ b/0.10.2/doc/implementors/std/error/trait.Error.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Error for Error","synthetic":false,"types":["chemfiles::errors::Error"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/doc/light.css b/0.10.2/doc/light.css new file mode 100644 index 000000000..d4d3882e3 --- /dev/null +++ b/0.10.2/doc/light.css @@ -0,0 +1 @@ + body{background-color:white;color:black;}h1,h2,h3,h4{color:black;}h1.fqn{border-bottom-color:#D5D5D5;}h2,h3,h4{border-bottom-color:#DDDDDD;}.in-band{background-color:white;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#F5F5F5;}pre,.rustdoc.source .example-wrap{background-color:#F5F5F5;}.sidebar{background-color:#F1F1F1;}*{scrollbar-color:rgba(36,37,39,0.6) #e6e6e6;}.sidebar{scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;}.logo-container.rust-logo>img{}::-webkit-scrollbar-track{background-color:#ecebeb;}::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar::-webkit-scrollbar-track{background-color:#dcdcdc;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar .current{background-color:#fff;}.source .sidebar{background-color:#fff;}.sidebar .location{border-color:#000;background-color:#fff;color:#333;}.sidebar .version{border-bottom-color:#DDD;}.sidebar-title{border-top-color:#777;border-bottom-color:#777;}.block a:hover{background:#F5F5F5;}.line-numbers span{color:#c67e2d;}.line-numbers .line-highlighted{background-color:#f6fdb0 !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#ddd;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#4E4C4C;}.search-results a:hover{background-color:#ddd;}.search-results a:focus{color:#000 !important;background-color:#ccc;}.search-results a:focus span{color:#000 !important;}a.result-trait:focus{background-color:#c7b6ff;}a.result-traitalias:focus{background-color:#c7b6ff;}a.result-mod:focus,a.result-externcrate:focus{background-color:#afc6e4;}a.result-enum:focus{background-color:#b4d1b9;}a.result-struct:focus{background-color:#e7b1a0;}a.result-union:focus{background-color:#b7bd49;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#c6afb3;}a.result-type:focus{background-color:#ffc891;}a.result-foreigntype:focus{background-color:#f5c4ff;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#8ce488;}a.result-constant:focus,a.result-static:focus{background-color:#c3e0ff;}a.result-primitive:focus{background-color:#9aecff;}a.result-keyword:focus{background-color:#f99650;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#508157;}.content span.struct,.content a.struct,.block a.current.struct{color:#ad448e;}.content span.type,.content a.type,.block a.current.type{color:#ba5d00;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#cd00e2;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#068000;}.content span.union,.content a.union,.block a.current.union{color:#767b27;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#546e8a;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#2c8093;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#4d76ae;}.content span.trait,.content a.trait,.block a.current.trait{color:#7c5af3;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#6841f1;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#9a6e31;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#de5249;}nav:not(.sidebar){border-bottom-color:#e0e0e0;}nav.main .current{border-top-color:#000;border-bottom-color:#000;}nav.main .separator{border:1px solid #000;}a{color:#000;}body.source .example-wrap pre.rust a{background:#eee;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#3873AD;}a.test-arrow{color:#f5f5f5;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}#crate-search{color:#555;background-color:white;border-color:#e0e0e0;box-shadow:0 0 0 1px #e0e0e0,0 0 0 2px transparent;}.search-input{color:#555;background-color:white;box-shadow:0 0 0 1px #e0e0e0,0 0 0 2px transparent;}.search-input:focus{border-color:#66afe9;}.search-input:disabled{background-color:#e6e6e6;}#crate-search+.search-input:focus{box-shadow:0 0 8px #078dd8;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;}.stab.portability>code{background:none;}#help>div{background:#e9e9e9;border-color:#bfbfbf;}#help>div>span{border-bottom-color:#bfbfbf;}.since{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:black;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#8959A8;}pre.rust .kw-2,pre.rust .prelude-ty{color:#4271AE;}pre.rust .number,pre.rust .string{color:#718C00;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#C82829;}pre.rust .comment{color:#8E908C;}pre.rust .doccomment{color:#4D4D4C;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#B76514;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#c7c7c7;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target,:target>*{background:#FDFFD3;}:target{border-right:3px solid #ffb44c;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.5);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.5);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#eee;border-color:#999;}.notable-traits-tooltiptext .notable{border-bottom-color:#DDDDDD;}#titles>button:not(.selected){background-color:#e6e6e6;border-top-color:#e6e6e6;}#titles>button:hover,#titles>button.selected{background-color:#ffffff;border-top-color:#0089ff;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#F1F1F1;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#F1F1F1;border-right-color:#000;}#sidebar-filler{background-color:#F1F1F1;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#e0e0e0;background-color:#fff;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#717171;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(35%);}#theme-choices{border-color:#ccc;background-color:#fff;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#eee;}@media (max-width:700px){#theme-picker{background:#fff;}}#all-types{background-color:#fff;}#all-types:hover{background-color:#f9f9f9;}.search-results .result-name span.alias{color:#000;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#F1F1F1;}#sidebar-toggle:hover{background-color:#E0E0E0;}#source-sidebar{background-color:#F1F1F1;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#E0E0E0;}div.files>.selected{background-color:#fff;}.setting-line>.title{border-bottom-color:#D5D5D5;} \ No newline at end of file diff --git a/0.10.2/doc/main.js b/0.10.2/doc/main.js new file mode 100644 index 000000000..33ee852cf --- /dev/null +++ b/0.10.2/doc/main.js @@ -0,0 +1,8 @@ +if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.indexOf(searchString,position)===position}}if(!String.prototype.endsWith){String.prototype.endsWith=function(suffix,length){var l=length||this.length;return this.indexOf(suffix,l-suffix.length)!==-1}}if(!DOMTokenList.prototype.add){DOMTokenList.prototype.add=function(className){if(className&&!hasClass(this,className)){if(this.className&&this.className.length>0){this.className+=" "+className}else{this.className=className}}}}if(!DOMTokenList.prototype.remove){DOMTokenList.prototype.remove=function(className){if(className&&this.className){this.className=(" "+this.className+" ").replace(" "+className+" "," ").trim()}}}(function(){var rustdocVars=document.getElementById("rustdoc-vars");if(rustdocVars){window.rootPath=rustdocVars.attributes["data-root-path"].value;window.currentCrate=rustdocVars.attributes["data-current-crate"].value;window.searchJS=rustdocVars.attributes["data-search-js"].value;window.searchIndexJS=rustdocVars.attributes["data-search-index-js"].value}var sidebarVars=document.getElementById("sidebar-vars");if(sidebarVars){window.sidebarCurrent={name:sidebarVars.attributes["data-name"].value,ty:sidebarVars.attributes["data-ty"].value,relpath:sidebarVars.attributes["data-relpath"].value,}}}());function getVirtualKey(ev){if("key"in ev&&typeof ev.key!="undefined"){return ev.key}var c=ev.charCode||ev.keyCode;if(c==27){return"Escape"}return String.fromCharCode(c)}var THEME_PICKER_ELEMENT_ID="theme-picker";var THEMES_ELEMENT_ID="theme-choices";function getThemesElement(){return document.getElementById(THEMES_ELEMENT_ID)}function getThemePickerElement(){return document.getElementById(THEME_PICKER_ELEMENT_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function showThemeButtonState(){var themePicker=getThemePickerElement();var themeChoices=getThemesElement();themeChoices.style.display="block";themePicker.style.borderBottomRightRadius="0";themePicker.style.borderBottomLeftRadius="0"}function hideThemeButtonState(){var themePicker=getThemePickerElement();var themeChoices=getThemesElement();themeChoices.style.display="none";themePicker.style.borderBottomRightRadius="3px";themePicker.style.borderBottomLeftRadius="3px"}(function(){var themeChoices=getThemesElement();var themePicker=getThemePickerElement();var availableThemes=["ayu","dark","light"];function switchThemeButtonState(){if(themeChoices.style.display==="block"){hideThemeButtonState()}else{showThemeButtonState()}}function handleThemeButtonsBlur(e){var active=document.activeElement;var related=e.relatedTarget;if(active.id!==THEME_PICKER_ELEMENT_ID&&(!active.parentNode||active.parentNode.id!==THEMES_ELEMENT_ID)&&(!related||(related.id!==THEME_PICKER_ELEMENT_ID&&(!related.parentNode||related.parentNode.id!==THEMES_ELEMENT_ID)))){hideThemeButtonState()}}themePicker.onclick=switchThemeButtonState;themePicker.onblur=handleThemeButtonsBlur;availableThemes.forEach(function(item){var but=document.createElement("button");but.textContent=item;but.onclick=function(){switchTheme(window.currentTheme,window.mainTheme,item,true);useSystemTheme(false)};but.onblur=handleThemeButtonsBlur;themeChoices.appendChild(but)})}());(function(){"use strict";window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:function(){return document.getElementById("search")},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:function(){if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},focus:function(){searchState.input.focus()},defocus:function(){searchState.input.blur()},showResults:function(search){if(search===null||typeof search==='undefined'){search=searchState.outputElement()}addClass(main,"hidden");removeClass(search,"hidden");searchState.mouseMovedAfterSearch=false;document.title=searchState.title},hideResults:function(search){if(search===null||typeof search==='undefined'){search=searchState.outputElement()}addClass(search,"hidden");removeClass(main,"hidden");document.title=searchState.titleBeforeSearch;if(searchState.browserSupportsHistoryApi()){history.replaceState("",window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}},getQueryStringParams:function(){var params={};window.location.search.substring(1).split("&").map(function(s){var pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},putBackSearch:function(search_input){var search=searchState.outputElement();if(search_input.value!==""&&hasClass(search,"hidden")){searchState.showResults(search);if(searchState.browserSupportsHistoryApi()){var extra="?search="+encodeURIComponent(search_input.value);history.replaceState(search_input.value,"",getNakedUrl()+extra+window.location.hash)}document.title=searchState.title}},browserSupportsHistoryApi:function(){return window.history&&typeof window.history.pushState==="function"},setup:function(){var search_input=searchState.input;if(!searchState.input){return}function loadScript(url){var script=document.createElement('script');script.src=url;document.head.append(script)}var searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(window.searchJS);loadScript(window.searchIndexJS)}}search_input.addEventListener("focus",function(){searchState.putBackSearch(this);search_input.origPlaceholder=searchState.input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});search_input.addEventListener("blur",function(){search_input.placeholder=searchState.input.origPlaceholder});search_input.removeAttribute('disabled');searchState.addCrateDropdown(window.ALL_CRATES);var params=searchState.getQueryStringParams();if(params.search!==undefined){var search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search);loadSearch()}},addCrateDropdown:function(crates){var elem=document.getElementById("crate-search");if(!elem){return}var savedCrate=getSettingValue("saved-filter-crate");for(var i=0,len=crates.length;i0){return tmp}}return null}function showSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){addClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];if(sidebar){addClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(!filler){var div=document.createElement("div");div.id="sidebar-filler";sidebar.appendChild(div)}}}function hideSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){removeClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(filler){filler.remove()}document.getElementsByTagName("body")[0].style.marginTop=""}var toggleAllDocsId="toggle-all-docs";var main=document.getElementById("main");var savedHash="";function handleHashes(ev){var elem;var search=searchState.outputElement();if(ev!==null&&search&&!hasClass(search,"hidden")&&ev.newURL){searchState.hideResults(search);var hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(searchState.browserSupportsHistoryApi()){history.replaceState(hash,"",getNakedUrl()+window.location.search+"#"+hash)}elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}expandSection(savedHash.slice(1))}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function getHelpElement(build){if(build){buildHelperPopup()}return document.getElementById("help")}function displayHelp(display,ev,help){if(display){help=help?help:getHelpElement(true);if(hasClass(help,"hidden")){ev.preventDefault();removeClass(help,"hidden");addClass(document.body,"blur")}}else{help=help?help:getHelpElement(false);if(help&&!hasClass(help,"hidden")){ev.preventDefault();addClass(help,"hidden");removeClass(document.body,"blur")}}}function handleEscape(ev){var help=getHelpElement(false);var search=searchState.outputElement();if(help&&!hasClass(help,"hidden")){displayHelp(false,ev,help)}else if(search&&!hasClass(search,"hidden")){searchState.clearInputTimeout();ev.preventDefault();searchState.hideResults(search)}searchState.defocus();hideThemeButtonState()}var disableShortcuts=getSettingValue("disable-shortcuts")==="true";function handleShortcut(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":displayHelp(false,ev);ev.preventDefault();searchState.focus();break;case"+":case"-":ev.preventDefault();toggleAllDocs();break;case"?":displayHelp(true,ev);break;case"t":case"T":displayHelp(false,ev);ev.preventDefault();var themePicker=getThemePickerElement();themePicker.click();themePicker.focus();break;default:if(getThemePickerElement().parentNode.contains(ev.target)){handleThemeKeyDown(ev)}}}}function handleThemeKeyDown(ev){var active=document.activeElement;var themes=getThemesElement();switch(getVirtualKey(ev)){case"ArrowUp":ev.preventDefault();if(active.previousElementSibling&&ev.target.id!==THEME_PICKER_ELEMENT_ID){active.previousElementSibling.focus()}else{showThemeButtonState();themes.lastElementChild.focus()}break;case"ArrowDown":ev.preventDefault();if(active.nextElementSibling&&ev.target.id!==THEME_PICKER_ELEMENT_ID){active.nextElementSibling.focus()}else{showThemeButtonState();themes.firstElementChild.focus()}break;case"Enter":case"Return":case"Space":if(ev.target.id===THEME_PICKER_ELEMENT_ID&&themes.style.display==="none"){ev.preventDefault();showThemeButtonState();themes.firstElementChild.focus()}break;case"Home":ev.preventDefault();themes.firstElementChild.focus();break;case"End":ev.preventDefault();themes.lastElementChild.focus();break}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);(function(){var x=document.getElementsByClassName("version-selector");if(x.length>0){x[0].onchange=function(){var i,match,url=document.location.href,stripped="",len=window.rootPath.match(/\.\.\//g).length+1;for(i=0;i .in-band > .trait").textContent;var baseIdName="impl-"+traitName+"-";var libs=Object.getOwnPropertyNames(imp);for(var i=0,llength=libs.length;ithe rustdoc book.";var container=document.createElement("div");var shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["T","Focus the theme picker menu"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(function(x){return"
"+x[0].split(" ").map(function(y,index){return(index&1)===0?""+y+"":" "+y+" "}).join("")+"
"+x[1]+"
"}).join("");var div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";var infos=["Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + * -> vec)","Search multiple things at once by splitting your query with comma (e.g., \ + str,u8 or String,struct:Vec,test)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for items inside another one by searching for a path: vec::Vec",].map(function(x){return"

"+x+"

"}).join("");var div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;container.appendChild(book_info);container.appendChild(div_shortcuts);container.appendChild(div_infos);popup.appendChild(container);insertAfter(popup,searchState.outputElement());buildHelperPopup=function(){}};onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){var reset_button_timeout=null;window.copy_path=function(but){var parent=but.parentElement;var path=[];onEach(parent.childNodes,function(child){if(child.tagName==='A'){path.push(child.textContent)}});var el=document.createElement('textarea');el.value=path.join('::');el.setAttribute('readonly','');el.style.position='absolute';el.style.left='-9999px';document.body.appendChild(el);el.select();document.execCommand('copy');document.body.removeChild(el);but.children[0].style.display='none';var tmp;if(but.childNodes.length<2){tmp=document.createTextNode('✓');but.appendChild(tmp)}else{onEachLazy(but.childNodes,function(e){if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent='✓'}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent='';reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/0.10.2/doc/normalize.css b/0.10.2/doc/normalize.css new file mode 100644 index 000000000..469959f13 --- /dev/null +++ b/0.10.2/doc/normalize.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/0.10.2/doc/noscript.css b/0.10.2/doc/noscript.css new file mode 100644 index 000000000..aea68efbc --- /dev/null +++ b/0.10.2/doc/noscript.css @@ -0,0 +1 @@ + #main .attributes{margin-left:0 !important;}#copy-path{display:none;} \ No newline at end of file diff --git a/0.10.2/doc/noto-sans-kr-v13-korean-regular-LICENSE.txt b/0.10.2/doc/noto-sans-kr-v13-korean-regular-LICENSE.txt new file mode 100644 index 000000000..922d5fdc1 --- /dev/null +++ b/0.10.2/doc/noto-sans-kr-v13-korean-regular-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2014, 2015 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.2/doc/noto-sans-kr-v13-korean-regular.woff b/0.10.2/doc/noto-sans-kr-v13-korean-regular.woff new file mode 100644 index 000000000..01d6b6b54 Binary files /dev/null and b/0.10.2/doc/noto-sans-kr-v13-korean-regular.woff differ diff --git a/0.10.2/doc/rust-logo.png b/0.10.2/doc/rust-logo.png new file mode 100644 index 000000000..74b4bd695 Binary files /dev/null and b/0.10.2/doc/rust-logo.png differ diff --git a/0.10.2/doc/rustdoc.css b/0.10.2/doc/rustdoc.css new file mode 100644 index 000000000..29c1a7eb5 --- /dev/null +++ b/0.10.2/doc/rustdoc.css @@ -0,0 +1 @@ + @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular.woff2") format("woff2"),url("FiraSans-Regular.woff") format('woff');font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium.woff2") format("woff2"),url("FiraSans-Medium.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular.ttf.woff2") format("woff2"),url("SourceSerif4-Regular.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It.ttf.woff2") format("woff2"),url("SourceSerif4-It.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold.ttf.woff2") format("woff2"),url("SourceSerif4-Bold.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular.ttf.woff2") format("woff2"),url("SourceCodePro-Regular.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It.ttf.woff2") format("woff2"),url("SourceCodePro-It.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold.ttf.woff2") format("woff2"),url("SourceCodePro-Semibold.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Noto Sans KR';src:url("noto-sans-kr-v13-korean-regular.woff") format("woff");font-display:swap;unicode-range:U+A960-A97F,U+AC00-D7AF,U+D7B0-D7FF;}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:16px/1.4 "Source Serif 4","Noto Sans KR",serif;margin:0;position:relative;padding:10px 15px 20px 15px;-webkit-font-feature-settings:"kern","liga";-moz-font-feature-settings:"kern","liga";font-feature-settings:"kern","liga";}h1{font-size:1.5em;}h2{font-size:1.4em;}h3{font-size:1.3em;}h1,h2,h3,h4{font-weight:500;margin:20px 0 15px 0;padding-bottom:6px;}h1.fqn{display:flex;border-bottom:1px dashed;margin-top:0;padding-left:1px;}h1.fqn>.in-band>a:hover{text-decoration:underline;}h2,h3,h4{border-bottom:1px solid;}h3.code-header,h4.code-header{font-size:1em;font-weight:600;border:none;padding:0;margin:0;}.impl,.impl-items .method,.methods .method,.impl-items .type,.methods .type,.impl-items .associatedconstant,.methods .associatedconstant,.impl-items .associatedtype,.methods .associatedtype{flex-basis:100%;font-weight:600;margin-top:16px;margin-bottom:10px;position:relative;}.impl,.method.trait-impl,.type.trait-impl,.associatedconstant.trait-impl,.associatedtype.trait-impl{padding-left:15px;}div.impl-items>div{padding-left:0;}h1,h2,h3,h4,.sidebar,a.source,.search-input,.search-results .result-name,.content table td:first-child>a,.item-left>a,div.item-list .out-of-band,span.since,#source-sidebar,#sidebar-toggle,details.rustdoc-toggle>summary::before,details.undocumented>summary::before,div.impl-items>div:not(.docblock):not(.item-info),.content ul.crate a.crate,a.srclink,#main>ul.docblock>li>a{font-family:"Fira Sans",Arial,sans-serif;}.content ul.crate a.crate{font-size:16px/1.6;}ol,ul{padding-left:25px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.6em;}p{margin:0 0 .6em 0;}summary{outline:none;}td,th{padding:0;}table{border-collapse:collapse;}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;}details:not(.rustdoc-toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.1em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;}.type-decl pre{overflow-x:auto;}.source .content pre{padding:20px;}img{max-width:100%;}li{position:relative;}.source .content{margin-top:50px;max-width:none;overflow:visible;margin-left:0px;}nav.sub{font-size:16px;text-transform:uppercase;}.sidebar{width:200px;position:fixed;left:0;top:0;bottom:0;overflow:auto;}*{scrollbar-width:initial;}.sidebar{scrollbar-width:thin;}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;}.sidebar .block>ul>li{margin-right:-10px;}.content,nav{max-width:960px;}.hidden{display:none !important;}.logo-container{height:100px;width:100px;position:relative;margin:20px auto;display:block;margin-top:10px;}.logo-container>img{max-width:100px;max-height:100px;height:100%;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;}.sidebar .location{border:1px solid;font-size:17px;margin:30px 10px 20px 10px;text-align:center;word-wrap:break-word;font-weight:inherit;padding:0;}.sidebar .version{font-size:15px;text-align:center;border-bottom:1px solid;overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;}.location:empty{border:none;}.location a:first-of-type{font-weight:500;}.location a:hover{text-decoration:underline;}.block{padding:0;margin-bottom:14px;}.block h2,.block h3{text-align:center;}.block ul,.block li{margin:0 10px;padding:0;list-style:none;}.block a{display:block;text-overflow:ellipsis;overflow:hidden;line-height:15px;padding:7px 5px;font-size:14px;font-weight:300;transition:border 500ms ease-out;}.sidebar-title{border-top:1px solid;border-bottom:1px solid;text-align:center;font-size:17px;margin-bottom:5px;font-weight:inherit;padding:0;}.sidebar-links{margin-bottom:15px;}.sidebar-links>a{padding-left:10px;width:100%;}.sidebar-menu{display:none;}.content{padding:15px 0;}.source .content pre.rust{white-space:pre;overflow:auto;padding-left:0;}.rustdoc .example-wrap{display:inline-flex;margin-bottom:10px;}.example-wrap{position:relative;width:100%;}.example-wrap>pre.line-number{overflow:initial;border:1px solid;padding:13px 8px;text-align:right;border-top-left-radius:5px;border-bottom-left-radius:5px;}.example-wrap>pre.rust a:hover{text-decoration:underline;}.rustdoc:not(.source) .example-wrap>pre:not(.line-number){width:100%;overflow-x:auto;}.rustdoc .example-wrap>pre{margin:0;}#search{margin-left:230px;position:relative;}#results>table{width:100%;table-layout:fixed;}.content>.example-wrap pre.line-numbers{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.line-numbers span{cursor:pointer;}.docblock-short{overflow-wrap:anywhere;}.docblock-short p{display:inline;}.docblock-short p{overflow:hidden;text-overflow:ellipsis;margin:0;}.docblock>:not(pre)>code,.docblock-short>:not(pre)>code{white-space:pre-wrap;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom:1px solid;}.top-doc .docblock h1{font-size:1.3em;}.top-doc .docblock h2{font-size:1.15em;}.top-doc .docblock h3,.top-doc .docblock h4,.top-doc .docblock h5{font-size:1em;}.docblock h1{font-size:1em;}.docblock h2{font-size:0.95em;}.docblock h3,.docblock h4,.docblock h5{font-size:0.9em;}.docblock{margin-left:24px;position:relative;}.content .out-of-band{flex-grow:0;text-align:right;font-size:23px;margin:0px;padding:0 0 0 12px;font-weight:normal;}.method>.code-header,.trait-impl>.code-header,.invisible>.code-header{max-width:calc(100% - 41px);display:block;}.invisible{width:100%;display:inline-block;}.content .in-band{flex-grow:1;margin:0px;padding:0px;}.in-band>code,.in-band>.code-header{display:inline-block;}#main{position:relative;}#main>.since{top:inherit;font-family:"Fira Sans",Arial,sans-serif;}.content table:not(.table-display){border-spacing:0 5px;}.content td{vertical-align:top;}.content td:first-child{padding-right:20px;}.content td p:first-child{margin-top:0;}.content td h1,.content td h2{margin-left:0;font-size:1.1em;}.content tr:first-child td{border-top:0;}.docblock table{margin:.5em 0;width:calc(100% - 2px);overflow-x:auto;display:block;}.docblock table td{padding:.5em;border:1px dashed;}.docblock table th{padding:.5em;text-align:left;border:1px solid;}.fields+table{margin-bottom:1em;}.content .item-list{list-style-type:none;padding:0;}.content .multi-column{-moz-column-count:5;-moz-column-gap:2.5em;-webkit-column-count:5;-webkit-column-gap:2.5em;column-count:5;column-gap:2.5em;}.content .multi-column li{width:100%;display:inline-block;}.content>.methods>.method{font-size:1em;position:relative;}.content .method .where,.content .fn .where,.content .where.fmt-newline{display:block;font-size:0.8em;}.content .methods>div:not(.notable-traits):not(.method){margin-left:40px;margin-bottom:15px;}.content .docblock>.impl-items{margin-left:20px;margin-top:-34px;}.content .docblock>.impl-items .table-display{margin:0;}.content .docblock>.impl-items table td{padding:0;}.content .docblock>.impl-items .table-display,.impl-items table td{border:none;}.content .item-info code{font-size:90%;}.content .item-info{position:relative;margin-left:33px;}.sub-variant>div>.item-info{margin-top:initial;}.content .item-info::before{content:'⬑';font-size:25px;position:absolute;top:-6px;left:-19px;}.content .impl-items .method,.content .impl-items>.type,.impl-items>.associatedconstant,.impl-items>.associatedtype,.content .impl-items details>summary>.type,.impl-items details>summary>.associatedconstant,.impl-items details>summary>.associatedtype{margin-left:20px;}.content .impl-items .docblock,.content .impl-items .item-info{margin-bottom:.6em;}.content .impl-items>.item-info{margin-left:40px;}.methods>.item-info,.content .impl-items>.item-info{margin-top:-8px;}.impl-items{flex-basis:100%;}#main>.item-info{margin-top:0;}nav:not(.sidebar){border-bottom:1px solid;padding-bottom:10px;margin-bottom:10px;}nav.main{padding:20px 0;text-align:center;}nav.main .current{border-top:1px solid;border-bottom:1px solid;}nav.main .separator{border:1px solid;display:inline-block;height:23px;margin:0 20px;}nav.sum{text-align:right;}nav.sub form{display:inline;}nav.sub,.content{margin-left:230px;}a{text-decoration:none;background:transparent;}.small-section-header{display:flex;justify-content:space-between;position:relative;}.small-section-header:hover>.anchor{display:initial;}.in-band:hover>.anchor,.impl:hover>.anchor,.method.trait-impl:hover>.anchor,.type.trait-impl:hover>.anchor,.associatedconstant.trait-impl:hover>.anchor,.associatedtype.trait-impl:hover>.anchor{display:inline-block;position:absolute;}.anchor{display:none;position:absolute;left:0;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.anchor::before{content:'§';}.docblock a:not(.srclink):not(.test-arrow):hover,.docblock-short a:not(.srclink):not(.test-arrow):hover,.item-info a{text-decoration:underline;}.invisible>.srclink,.method>.code-header+.srclink{position:absolute;top:0;right:0;font-size:17px;font-weight:normal;}.block a.current.crate{font-weight:500;}.item-table{display:grid;column-gap:1.2rem;row-gap:0.0rem;grid-template-columns:auto 1fr;justify-items:start;}.item-left,.item-right{display:block;}.item-left{grid-column:1;}.item-right{grid-column:2;}.search-container{position:relative;}.search-container>div{display:inline-flex;width:calc(100% - 63px);}#crate-search{min-width:115px;margin-top:5px;padding:6px;padding-right:19px;flex:none;border:0;border-right:0;border-radius:4px 0 0 4px;outline:none;cursor:pointer;border-right:1px solid;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;text-overflow:"";background-repeat:no-repeat;background-color:transparent;background-size:20px;background-position:calc(100% - 1px) 56%;}.search-container>.top-button{position:absolute;right:0;top:10px;}.search-input{-moz-box-sizing:border-box !important;box-sizing:border-box !important;outline:none;border:none;border-radius:1px;margin-top:5px;padding:10px 16px;font-size:17px;transition:border-color 300ms ease;transition:border-radius 300ms ease-in-out;transition:box-shadow 300ms ease-in-out;width:100%;}#crate-search+.search-input{border-radius:0 1px 1px 0;width:calc(100% - 32px);}.search-input:focus{border-radius:2px;border:0;outline:0;}.search-results{display:none;padding-bottom:2em;}.search-results.active{display:block;clear:both;}.search-results .desc>span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:block;}.search-results>a{display:block;width:100%;margin-left:2px;margin-right:2px;border-bottom:1px solid #aaa3;}.search-results>a>div{display:flex;flex-flow:row wrap;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:50%;}.search-results .result-name{padding-right:1em;}.search-results .result-name>span{display:inline-block;margin:0;font-weight:normal;}body.blur>:not(#help){filter:blur(8px);-webkit-filter:blur(8px);opacity:.7;}#help{width:100%;height:100vh;position:fixed;top:0;left:0;display:flex;justify-content:center;align-items:center;}#help>div{flex:0 0 auto;box-shadow:0 0 6px rgba(0,0,0,.2);width:550px;height:auto;border:1px solid;}#help dt{float:left;clear:left;display:block;margin-right:0.5rem;}#help>div>span{text-align:center;display:block;margin:10px 0;font-size:18px;border-bottom:1px solid #ccc;padding-bottom:4px;margin-bottom:6px;}#help dd{margin:5px 35px;}#help .infos{padding-left:0;}#help h1,#help h2{margin-top:0;}#help>div div{width:50%;float:left;padding:0 20px 20px 17px;;}.item-info .stab{display:table;}.stab{border-width:1px;border-style:solid;padding:3px;margin-bottom:5px;font-size:90%;font-weight:normal;}.stab p{display:inline;}.stab .emoji{font-size:1.5em;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.module-item .stab,.import-item .stab{border-radius:3px;display:inline-block;font-size:80%;line-height:1.2;margin-bottom:0;margin-left:.3em;padding:2px;vertical-align:text-bottom;}.module-item.unstable,.import-item.unstable{opacity:0.65;}.since{font-weight:normal;font-size:initial;}.impl-items .since,.impl .since,.methods .since{padding-left:12px;padding-right:2px;position:initial;}.impl-items .srclink,.impl .srclink,.methods .srclink{font-size:17px;font-weight:normal;}.rightside{float:right;}.has-srclink{font-size:16px;margin-bottom:12px;justify-content:space-between;}.variants_table{width:100%;}.variants_table tbody tr td:first-child{width:1%;}td.summary-column{width:100%;}.summary{padding-right:0px;}pre.rust .question-mark{font-weight:bold;}a.test-arrow{display:inline-block;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:130%;top:5px;right:5px;z-index:1;}a.test-arrow:hover{text-decoration:none;}.section-header:hover a:before{position:absolute;left:-25px;padding-right:10px;content:'\2002\00a7\2002';}.section-header:hover a{text-decoration:none;}.section-header a{color:inherit;}.code-attribute{font-weight:300;}.since+.srclink{padding-left:10px;}.item-spacer{width:100%;height:12px;}.out-of-band>span.since{position:initial;font-size:20px;margin-right:5px;}.sub-variant,.sub-variant>h3{margin-top:0px !important;padding-top:1px;}#main .sub-variant>h3{font-size:15px;margin-left:25px;margin-bottom:5px;}.sub-variant>div{margin-left:20px;margin-bottom:10px;}.sub-variant>div>span{display:block;position:relative;}.toggle-label{display:inline-block;margin-left:4px;margin-top:3px;}.docblock>.section-header:first-child{margin-left:15px;margin-top:0;}.docblock>.section-header:first-child:hover>a:before{left:-10px;}:target>code,:target>.code-header{opacity:1;}:target{padding-right:3px;}.information{position:absolute;left:-25px;margin-top:7px;z-index:1;}.tooltip{position:relative;display:inline-block;cursor:pointer;}.tooltip::after{display:none;text-align:center;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;font-size:16px;}.tooltip.ignore::after{content:"This example is not tested";}.tooltip.compile_fail::after{content:"This example deliberately fails to compile";}.tooltip.should_panic::after{content:"This example panics";}.tooltip.edition::after{content:"This code runs with edition " attr(data-edition);}.tooltip::before{content:" ";position:absolute;top:50%;left:16px;margin-top:-5px;border-width:5px;border-style:solid;display:none;}.tooltip:hover::before,.tooltip:hover::after{display:inline;}.tooltip.compile_fail,.tooltip.should_panic,.tooltip.ignore{font-weight:bold;font-size:20px;}.notable-traits-tooltip{display:inline-block;cursor:pointer;}.notable-traits:hover .notable-traits-tooltiptext,.notable-traits .notable-traits-tooltiptext.force-tooltip{display:inline-block;}.notable-traits .notable-traits-tooltiptext{display:none;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;z-index:10;font-size:16px;cursor:default;position:absolute;border:1px solid;}.notable-traits-tooltip::after{content:"\00a0\00a0\00a0";}.notable-traits .notable,.notable-traits .docblock{margin:0;}.notable-traits .notable{margin:0;margin-bottom:13px;font-size:19px;font-weight:600;}.notable-traits .docblock code.content{margin:0;padding:0;font-size:20px;}pre.rust.rust-example-rendered{position:relative;}pre.rust{tab-size:4;-moz-tab-size:4;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#titles{height:35px;}#titles>button{float:left;width:33.3%;text-align:center;font-size:18px;cursor:pointer;border:0;border-top:2px solid;}#titles>button:not(:last-child){margin-right:1px;width:calc(33.3% - 1px);}#titles>button>div.count{display:inline-block;font-size:16px;}.notable-traits{cursor:pointer;z-index:2;margin-left:5px;}#all-types{text-align:center;border:1px solid;margin:0 10px;margin-bottom:10px;display:block;border-radius:7px;}#all-types>p{margin:5px 0;}#sidebar-toggle{position:fixed;top:30px;left:300px;z-index:10;padding:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;cursor:pointer;font-weight:bold;transition:left .5s;font-size:1.2em;border:1px solid;border-left:0;}#source-sidebar{position:fixed;top:0;bottom:0;left:0;width:300px;z-index:1;overflow:auto;transition:left .5s;border-right:1px solid;}#source-sidebar>.title{font-size:1.5em;text-align:center;border-bottom:1px solid;margin-bottom:6px;}.theme-picker{position:absolute;left:211px;top:19px;}.theme-picker button{outline:none;}#settings-menu,#help-button{position:absolute;top:10px;}#settings-menu{right:0;outline:none;}#theme-picker,#settings-menu,#help-button,#copy-path{padding:4px;width:27px;height:29px;border:1px solid;border-radius:3px;cursor:pointer;}#help-button{right:30px;font-family:"Fira Sans",Arial,sans-serif;text-align:center;font-size:17px;padding-top:2px;}#copy-path{background:initial;margin-left:10px;padding:0;padding-left:2px;border:0;}#theme-choices{display:none;position:absolute;left:0;top:28px;border:1px solid;border-radius:3px;z-index:1;cursor:pointer;}#theme-choices>button{border:none;width:100%;padding:4px 8px;text-align:center;background:rgba(0,0,0,0);}#theme-choices>button:not(:first-child){border-top:1px solid;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px;border-radius:3px;box-shadow:inset 0 -1px 0;cursor:default;}.hidden-by-impl-hider,.hidden-by-usual-hider{display:none !important;}#implementations-list>h3>span.in-band{width:100%;}.table-display{width:100%;border:0;border-collapse:collapse;border-spacing:0;font-size:16px;}.table-display tr td:first-child{padding-right:0;}.table-display tr td:last-child{float:right;}.table-display .out-of-band{position:relative;font-size:19px;display:block;}#implementors-list>.impl-items .table-display .out-of-band{font-size:17px;}.table-display td:hover .anchor{display:block;top:2px;left:-5px;}#main>ul{padding-left:10px;}#main>ul>li{list-style:none;}.non-exhaustive{margin-bottom:1em;}div.children{padding-left:27px;display:none;}div.name{cursor:pointer;position:relative;margin-left:16px;}div.files>a{display:block;padding:0 3px;}div.files>a:hover,div.name:hover{background-color:#a14b4b;}div.name.expand+.children{display:block;}div.name::before{content:"\25B6";padding-left:4px;font-size:0.7em;position:absolute;left:-16px;top:4px;}div.name.expand::before{transform:rotate(90deg);left:-15px;top:2px;}details.rustdoc-toggle>summary.hideme{cursor:pointer;}details.rustdoc-toggle>summary,details.undocumented>summary{list-style:none;}details.rustdoc-toggle>summary::-webkit-details-marker,details.rustdoc-toggle>summary::marker,details.undocumented>summary::-webkit-details-marker,details.undocumented>summary::marker{display:none;}details.rustdoc-toggle>summary.hideme>span{margin-left:9px;}details.rustdoc-toggle>summary::before{content:"";cursor:pointer;width:17px;height:max(17px,1.1em);background-repeat:no-repeat;background-position:top left;display:inline-block;vertical-align:middle;opacity:.5;}details.rustdoc-toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.rustdoc-toggle>summary.hideme::after{content:"";}details.rustdoc-toggle>summary:focus::before,details.rustdoc-toggle>summary:hover::before{opacity:1;}details.rustdoc-toggle.top-doc>summary,details.rustdoc-toggle.top-doc>summary::before,details.rustdoc-toggle.non-exhaustive>summary,details.rustdoc-toggle.non-exhaustive>summary::before{font-family:'Fira Sans';font-size:16px;}details.non-exhaustive{margin-bottom:8px;}details.rustdoc-toggle>summary.hideme::before{position:relative;}details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-23px;top:3px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before,.undocumented>details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-2px;}details.rustdoc-toggle[open] >summary.hideme{position:absolute;}details.rustdoc-toggle,details.undocumented{position:relative;}details.rustdoc-toggle[open] >summary.hideme>span{display:none;}details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{width:17px;height:max(17px,1.1em);background-repeat:no-repeat;background-position:top left;display:inline-block;content:"";}details.rustdoc-toggle[open] >summary::after,details.rustdoc-toggle[open] >summary.hideme::after{content:"Collapse";}details.undocumented>summary::before{padding-left:17px;height:max(17px,1.1em);background-repeat:no-repeat;background-position:top left;content:"Show hidden undocumented items";cursor:pointer;font-size:16px;font-weight:300;opacity:.5;}details.undocumented>summary:focus::before,details.undocumented>summary:hover::before{opacity:1;}details.undocumented[open] >summary::before{padding-left:17px;height:max(17px,1.1em);background-repeat:no-repeat background-position:top left;content:"Hide undocumented items";}@media (min-width:701px){.docblock>.information:first-child>.tooltip{margin-top:16px;}}@media (max-width:700px){body{padding-top:0px;}.rustdoc>.sidebar{height:45px;min-height:40px;margin:0;margin-left:-15px;padding:0 15px;position:static;z-index:11;}.sidebar>.location{float:right;margin:0px;margin-top:2px;padding:3px 10px 1px 10px;min-height:39px;background:inherit;text-align:left;font-size:24px;}.sidebar .location:empty{padding:0;}.sidebar .logo-container{width:35px;height:35px;margin-top:5px;margin-bottom:5px;float:left;margin-left:50px;}.sidebar .logo-container>img{max-width:35px;max-height:35px;}.sidebar-menu{position:fixed;z-index:10;font-size:2rem;cursor:pointer;width:45px;left:0;text-align:center;display:block;border-bottom:1px solid;border-right:1px solid;height:45px;}.rustdoc.source>.sidebar>.sidebar-menu{display:none;}.sidebar-elems{position:fixed;z-index:1;top:45px;bottom:0;width:246px;left:-246px;overflow-y:auto;border-right:1px solid;}.sidebar>.block.version{overflow:hidden;border-bottom:none;margin-bottom:0;height:100%;padding-left:12px;}.sidebar>.block.version>div.narrow-helper{float:left;width:1px;height:100%;}.sidebar>.block.version>p{margin:0;min-width:55px;display:flex;align-items:center;height:100%;}nav.sub{width:calc(100% - 32px);float:right;}.content{margin-left:0px;}#main,#search{margin-top:45px;padding:0;}#search{margin-left:0;}.anchor{display:none !important;}.theme-picker{left:10px;top:54px;z-index:1;}.notable-traits{position:absolute;left:-22px;top:24px;}#titles>button>div.count{float:left;width:100%;}#titles{height:50px;}.sidebar.mobile{position:fixed;width:100%;margin-left:0;background-color:rgba(0,0,0,0);height:100%;}.sidebar.mobile>div.version{overflow:hidden;max-height:33px;}.sidebar{width:calc(100% + 30px);}.show-it,.sidebar-elems:focus-within{z-index:2;left:0;}.show-it>.block.items{margin:8px 0;}.show-it>.block.items>ul{margin:0;}.show-it>.block.items>ul>li{text-align:center;margin:2px 0;}.show-it>.block.items>ul>li>a{font-size:21px;}#sidebar-filler{position:fixed;left:45px;width:calc(100% - 45px);top:0;height:45px;z-index:-1;border-bottom:1px solid;}#main>details.rustdoc-toggle>summary::before,#main>div>details.rustdoc-toggle>summary::before{left:-11px;}#all-types{margin:10px;}#sidebar-toggle{top:100px;width:30px;font-size:1.5rem;text-align:center;padding:0;}#source-sidebar{z-index:11;}#main>.line-numbers{margin-top:0;}.notable-traits .notable-traits-tooltiptext{left:0;top:100%;}#help-button{display:none;}.item-table{display:flex;flex-flow:column wrap;}.item-left,.item-right{width:100%;}.search-container>div{width:calc(100% - 32px);}.search-results>a{border-bottom:1px solid #aaa9;padding:5px 0px;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:100%;}.search-results div.desc,.search-results .result-description,.item-right{padding-left:2em;}}@media print{nav.sub,.content .out-of-band{display:none;}}@media (max-width:464px){#titles,#titles>button{height:73px;}#main,#search{margin-top:100px;}#main>table:not(.table-display) td{word-break:break-word;width:50%;}.search-container>div{display:block;width:calc(100% - 37px);}#crate-search{width:100%;border-radius:4px;border:0;}#crate-search+.search-input{width:calc(100% + 71px);margin-left:-36px;}#theme-picker,#settings-menu{padding:5px;width:31px;height:31px;}#theme-picker{margin-top:-2px;}#settings-menu{top:7px;}.docblock{margin-left:12px;}}details.undocumented[open] >summary::before,details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{background-image:url(toggle-minus.svg);}details.undocumented>summary::before,details.rustdoc-toggle>summary::before{background-image:url(toggle-plus.svg);} \ No newline at end of file diff --git a/0.10.2/doc/search-index.js b/0.10.2/doc/search-index.js new file mode 100644 index 000000000..2c8b3d86f --- /dev/null +++ b/0.10.2/doc/search-index.js @@ -0,0 +1,4 @@ +var searchIndex = JSON.parse('{\ +"chemfiles":{"doc":"Chemfiles is a multi-language library written in modern …","t":[13,13,3,3,3,4,13,4,13,13,13,13,3,13,13,3,3,13,3,13,13,13,3,4,13,13,13,3,3,3,13,13,4,13,13,13,3,3,3,13,13,13,3,3,3,13,13,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,12,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,12,11,5,11,11,11,11,12,12,12,12,12],"n":["Amide","Aromatic","Atom","AtomMut","AtomRef","BondOrder","Bool","CellShape","ChemfilesError","ConfigurationError","Double","Double","Error","FileError","FormatError","FormatMetadata","Frame","Infinite","Match","MemoryError","Orthorhombic","OutOfBounds","PropertiesIter","Property","PropertyError","Quadruple","Quintuplet","Residue","ResidueRef","Selection","SelectionError","Single","Status","StdCppError","String","Success","Topology","TopologyRef","Trajectory","Triclinic","Triple","UTF8PathError","UnitCell","UnitCellMut","UnitCellRef","Unknown","Vector3D","add_atom","add_atom","add_atom","add_bond","add_bond","add_bond_with_order","add_bond_with_order","add_configuration","add_residue","add_residue","add_velocities","angle","angles","angles","angles_count","are_linked","atom","atom","atom_mut","atom_mut","atomic_number","atomic_type","atoms","atoms","bond_order","bond_orders","bonds","bonds","bonds_count","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","cell","cell_mut","charge","cleanup","clear_bonds","clear_bonds","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","contains","count","covalent_radius","deref","deref","deref","deref","deref","deref","deref_mut","deref_mut","description","description","dihedral","dihedrals","dihedrals_count","distance","drop","drop","drop","drop","drop","drop","drop","eq","eq","eq","eq","eq","eq","eq","evaluate","extension","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","formats_list","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_matrix","full_name","get","get","get","guess_bonds","guess_format","has_velocities","id","impropers","impropers_count","index","infinite","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into_iter","iter","last_error","len","lengths","list","mass","matrix","memory","memory_buffer","memory_reader","memory_writer","message","name","name","name","ne","ne","ne","ne","new","new","new","new","new","new","new","next","nsteps","open","open_with_format","out_of_plane","partial_cmp","partial_cmp","path","positions","positions","positions_mut","properties","properties","properties","read","read","read_step","reference","remove","remove","remove_bond","remove_bond","residue","residue_for_atom","residues","residues_count","resize","resize","set","set","set","set_angles","set_atomic_type","set_cell","set_cell","set_charge","set_lengths","set_mass","set_name","set_shape","set_step","set_topology","set_topology","set_topology_file","set_topology_with_format","set_warning_callback","shape","size","size","size","size","size_hint","status","step","string","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","topology","triclinic","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","unit_cell","vdw_radius","velocities","velocities","velocities_mut","version","volume","with_id","wrap","write","write","0","0","0","0"],"q":["chemfiles","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","chemfiles::Property","","",""],"d":["Amide bond (required by some file formats)","Aromatic bond (required by some file formats)","An Atom is a particle in the current Frame. It stores the …","An analog to a mutable reference to an atom (&mut Atom)","An analog to a reference to an atom (&Atom)","Possible bond order associated with bonds","Boolean property","Available unit cell shapes.","Exception in the C++ chemfiles library","Error in configuration files syntax","Double bond","Floating point property","Error type for Chemfiles.","Error while reading or writing a file","Error in file formatting, i.e. the file is invalid","FormatMetadata contains metadata associated with one …","A Frame contains data from one simulation step: the …","Infinite cell, to use when there is no cell.","A Match is a set of atomic indexes matching a given …","Error in memory allocations","Orthorhombic cell, with the three angles equals to 90°.","Error for out of bounds indexing","An iterator over the properties in an atom/frame/residue","A Property is a piece of data that can be associated with …","Error related to properties","Quadruple bond (present in some metals)","Quintuplet bond (present in some metals)","A Residue is a group of atoms belonging to the same …","An analog to a reference to a residue (&Residue)","A Selection allow to select atoms in a Frame, from a …","Error in selection string syntax","Single bond","Possible causes of error in chemfiles","Exception in the C++ standard library","String property","No error","A Topology contains the definition of all the atoms in the …","An analog to a reference to a topology (&Topology)","The Trajectory type is the main entry point when using …","Triclinic cell, with any values for the angles.","Triple bond","The given path is not valid UTF8","An UnitCell represent the box containing the atoms, and …","An analog to a mutable reference to an unit cell (…","An analog to a reference to an unit cell (&UnitCell)","Unknown or unspecified bond order","3-dimensional vector property","Add the atom at index atom in this residue.","Add an Atom at the end of this topology","Add an Atom and the corresponding position and optionally …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Read configuration data from the file at path.","Add a residue to this topology.","Add a copy of residue to this frame.","Add velocity data to this frame. If the frame already have …","Get the angle formed by the atoms at indexes i, j and k in …","Get the three angles of the cell, in degrees.","Get the list of angles in the topology.","Get the number of angles in the topology.","Check if the two residues first and second from the …","Get a reference of the atom at the given index in this …","Get a reference to the atom at the given index in this …","Get a mutable reference to the atom at the given index in …","Get a mutable reference to the atom at the given index in …","Try to get the atomic number of the atom from the atomic …","Get the atom type.","Get the list of atoms of this residue.","Does this format support storing atom names or types?","Get the bond order for the bond between the atoms at …","Get the bond order for all the bonds in the topology","Get the list of bonds in the topology.","Does this format support storing bonds between atoms?","Get the number of bonds in the topology.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get a reference to the UnitCell from this frame.","Get a mutable reference to the UnitCell from this frame.","Get the atom charge, in number of the electron charge e.","Clear any error from the C++ library","Remove all existing bonds, angles, dihedral angles and …","Remove all existing bonds, angles, dihedral angles and …","","","","","","","","","","","","","","","","","","","","","","","","","","","","Check if the atom at index i is in this residue","","Try to get the covalent radius of the atom from the atomic …","","","","","","","","","","Extended, user-facing description of the format.","Get the dihedral angle formed by the atoms at indexes i, j…","Get the list of dihedral angles in the topology.","Get the number of dihedral angles in the topology.","Get the distance between the atoms at indexes i and j in …","","","","","","","","","","","","","","","Evaluate a selection for a given frame, and return the …","Extension associated with the format.","","","","","","","","","Get the list of formats known by chemfiles, as well as all …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Create an UnitCell from a cell matrix. If matrix contains …","Try to get the full name of the atom from the atomic type. …","Get a property with the given name in this atom, if it …","Get a property with the given name in this frame, if it …","Get a property with the given name in this frame, if it …","Guess the bonds, angles and dihedrals in this frame.","Get the format that chemfiles would use to read a file at …","Check if this frame contains velocity data.","Get the identifier of this residue in the initial topology …","Get the list of improper dihedral angles in the topology.","Get the number of improper dihedral angles in the topology.","","Create an Infinite UnitCell.","","","","","","","","","","","","","","","","","","","","","","","Iterate over the atomic indexes in the match.","Get the last error message from the C++ library.","Get the length of the Match.","Get the three lengths of the cell, in Angstroms.","Evaluates a selection of size 1 on a given frame. This …","Get the atom mass, in atomic mass units.","Get the unit cell matricial representation.","Does this format support in-memory IO?","Obtain the memory buffer written to by the trajectory.","Read a memory buffer as though it was a formatted file.","Write to a memory buffer as though it was a formatted file.","A message describing the error cause","Get the atom name.","Get the name of this residue.","Name of the format.","","","","","Create an atom with the given name, and set the atom type …","Create an Orthorhombic UnitCell from the three lengths, in …","Create a new residue with the given name","Create a new empty topology.","Create an empty frame. It will be resized by the library …","Create a new selection from the given selection string.","Create a new match containing the atoms in the atoms slice.","","Get the number of steps (the number of frames) in a …","Open the file at the given path in the given mode.","Open the file at the given path using a specific file …","Get the out of plane distance formed by the atoms at …","","","Get file path for this trajectory.","Get a view into the positions of this frame.","Does this format support storing atomic positions?","Get a mutable view into the positions of this frame.","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Read the next step of this trajectory into a frame.","Is reading files in this format implemented?","Read a specific step of this trajectory into a frame.","URL pointing to the format definition/reference.","Remove an Atom from this topology by index. This modify …","Remove the atom at index i in this frame.","Remove any existing bond between the atoms at indexes i …","Remove any existing bond between the atoms at indexes i …","Get a reference to the residue at index index from this …","Get a copy of the residue containing the atom at index …","Does this format support storing residues?","Get the number of residues in this topology.","Resize this topology to hold natoms atoms, inserting dummy …","Resize the positions and the velocities in this frame, to …","Add a new property with the given name to this atom.","Add a new property with the given name to this residue.","Add a new property with the given name to this frame.","Set the three angles of the cell, in degrees.","Set the atom type to atomic_type.","Set the UnitCell of this frame to cell.","Set the unit cell associated with a trajectory. This cell …","Set the atom charge to charge, in number of the electron …","Set the three lengths of the cell, in Angstroms.","Set the atom mass to mass, in atomic mass units.","Set the atom name to name.","Set the shape of the unit cell to shape.","Set this frame step to step.","Set the Topology of this frame to topology.","Set the topology associated with this trajectory. This …","Set the topology associated with this trajectory by …","Set the topology associated with this trajectory by …","Use callback for every chemfiles warning. The callback …","Get the shape of the unit cell.","Get the number of atoms in this residue.","Get the current number of atoms in this topology.","Get the current number of atoms in this frame.","Get the size of the selection, i.e. the number of atoms we …","","The error status code","Get this frame step, i.e. the frame number in the …","Get the selection string used to create this selection.","","","","","","","","","","","","","","","Get a reference to the Topology of this frame.","Create an Triclinic UnitCell from the three lengths (in …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Does this format support storing unit cell information?","Try to get the Van der Waals radius of the atom from the …","Get a view into the velocities of this frame.","Does this format support storing atomic velocities?","Get a mutable view into the velocities of this frame.","Get the version of the chemfiles library.","Get the volume of the unit cell.","Create a new residue with the given name and id as …","Wrap a vector in this unit cell.","Write a frame to this trajectory.","Is writing files in this format implemented?","","","",""],"i":[1,1,0,0,0,0,2,0,3,3,1,2,0,3,3,0,0,4,0,3,4,3,0,0,3,1,1,0,0,0,3,1,0,3,2,3,0,0,0,4,1,3,0,0,0,1,2,5,6,7,6,7,6,7,0,6,7,7,7,8,6,6,6,6,7,6,7,9,9,5,10,6,6,6,10,6,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,7,7,9,20,6,7,9,8,5,6,7,18,20,3,4,1,21,2,10,9,8,5,6,7,18,20,3,4,1,21,2,10,1,5,19,9,11,12,13,14,15,16,12,14,20,10,7,6,6,7,9,8,5,6,7,17,18,20,3,4,1,21,2,10,18,10,20,20,3,4,1,21,2,10,0,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,20,20,3,4,4,1,1,21,2,2,2,2,2,2,10,8,9,9,5,7,7,0,7,5,6,6,21,8,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,19,21,20,21,8,18,9,8,10,17,17,17,20,9,5,10,20,21,2,10,9,8,5,6,7,18,21,19,17,17,17,7,1,2,17,7,10,7,9,5,7,17,10,17,10,6,7,6,7,6,6,10,6,6,7,9,5,7,8,9,7,17,9,8,9,9,8,7,7,17,17,17,0,8,5,6,7,18,19,20,7,18,9,8,5,6,7,18,20,3,4,1,21,2,10,20,7,8,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,10,9,7,10,7,0,8,5,8,17,10,22,23,24,25],"f":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["usize",15]]],[[["atom",3]]],[[["atom",3]]],[[["usize",15]]],[[["usize",15]]],[[["usize",15],["bondorder",4]]],[[["usize",15],["bondorder",4]]],[[],[["error",3],["result",4,["error"]]]],[[["residue",3]],[["error",3],["result",4,["error"]]]],[[["residue",3]],[["error",3],["result",4,["error"]]]],[[]],[[["usize",15]],["f64",15]],[[]],[[],["vec",3]],[[],["usize",15]],[[["residue",3]],["bool",15]],[[["usize",15]],["atomref",3]],[[["usize",15]],["atomref",3]],[[["usize",15]],["atommut",3]],[[["usize",15]],["atommut",3]],[[],["u64",15]],[[],["string",3]],[[],[["vec",3,["usize"]],["usize",15]]],null,[[["usize",15]],["bondorder",4]],[[],[["vec",3,["bondorder"]],["bondorder",4]]],[[],["vec",3]],null,[[],["usize",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["unitcellref",3]],[[],["unitcellmut",3]],[[],["f64",15]],[[]],[[]],[[]],[[],["atom",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["frame",3]],[[],["selection",3]],[[],["error",3]],[[],["status",4]],[[],["cellshape",4]],[[],["bondorder",4]],[[],["match",3]],[[],["property",4]],[[],["formatmetadata",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["bondorder",4]],["ordering",4]],[[["usize",15]],["bool",15]],[[],["usize",15]],[[],["f64",15]],[[],["atom",3]],[[],["atom",3]],[[],["unitcell",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["atom",3]],[[],["unitcell",3]],[[],["str",15]],null,[[["usize",15]],["f64",15]],[[],["vec",3]],[[],["usize",15]],[[["usize",15]],["f64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["error",3]],["bool",15]],[[["status",4]],["bool",15]],[[["cellshape",4]],["bool",15]],[[["bondorder",4]],["bool",15]],[[["match",3]],["bool",15]],[[["property",4]],["bool",15]],[[["formatmetadata",3]],["bool",15]],[[["frame",3]],[["match",3],["vec",3,["match"]]]],null,[[["formatter",3]],[["error",3],["result",4,["error"]]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[],[["vec",3,["formatmetadata"]],["formatmetadata",3]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["utf8error",3]]],[[]],[[["chfl_status",4]],["error",3]],[[]],[[]],[[["chfl_cellshape",4]],["cellshape",4]],[[["chfl_bond_order",4]],["bondorder",4]],[[]],[[]],[[["bool",15]]],[[["f64",15]]],[[["string",3]]],[[]],[[["str",15]]],[[]],[[]],[[],["unitcell",3]],[[],["string",3]],[[["str",15]],[["property",4],["option",4,["property"]]]],[[["str",15]],[["property",4],["option",4,["property"]]]],[[["str",15]],[["property",4],["option",4,["property"]]]],[[],[["error",3],["result",4,["error"]]]],[[["str",15]],["string",3]],[[],["bool",15]],[[],[["option",4,["i64"]],["i64",15]]],[[],["vec",3]],[[],["usize",15]],[[["usize",15]]],[[],["unitcell",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],[["usize",15],["iter",3,["usize"]]]],[[],["string",3]],[[],["usize",15]],[[]],[[["frame",3]],[["vec",3,["usize"]],["usize",15]]],[[],["f64",15]],[[]],null,[[],[["str",15],["result",4,["str","error"]],["error",3]]],[[],[["error",3],["result",4,["trajectory","error"]],["trajectory",3]]],[[],[["error",3],["result",4,["trajectory","error"]],["trajectory",3]]],null,[[],["string",3]],[[],["string",3]],null,[[["error",3]],["bool",15]],[[["match",3]],["bool",15]],[[["property",4]],["bool",15]],[[["formatmetadata",3]],["bool",15]],[[],["atom",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["frame",3]],[[["str",15],["into",8,["str"]]],[["error",3],["result",4,["selection","error"]],["selection",3]]],[[],["match",3]],[[],["option",4]],[[],["usize",15]],[[["char",15]],[["error",3],["result",4,["trajectory","error"]],["trajectory",3]]],[[["char",15]],[["error",3],["result",4,["trajectory","error"]],["trajectory",3]]],[[["usize",15]],["f64",15]],[[["bondorder",4]],[["option",4,["ordering"]],["ordering",4]]],[[["property",4]],[["option",4,["ordering"]],["ordering",4]]],[[],["string",3]],[[]],null,[[]],[[],["propertiesiter",3]],[[],["propertiesiter",3]],[[],["propertiesiter",3]],[[["frame",3]],[["error",3],["result",4,["error"]]]],null,[[["usize",15],["frame",3]],[["error",3],["result",4,["error"]]]],null,[[["usize",15]]],[[["usize",15]]],[[["usize",15]]],[[["usize",15]]],[[["u64",15]],[["residueref",3],["option",4,["residueref"]]]],[[["usize",15]],[["residueref",3],["option",4,["residueref"]]]],null,[[],["u64",15]],[[["usize",15]]],[[["usize",15]]],[[["str",15]]],[[["str",15]]],[[["str",15]]],[[],[["error",3],["result",4,["error"]]]],[[]],[[["unitcell",3]]],[[["unitcell",3]]],[[["f64",15]]],[[],[["error",3],["result",4,["error"]]]],[[["f64",15]]],[[]],[[["cellshape",4]],[["error",3],["result",4,["error"]]]],[[["usize",15]]],[[["topology",3]],[["error",3],["result",4,["error"]]]],[[["topology",3]]],[[],[["error",3],["result",4,["error"]]]],[[],[["error",3],["result",4,["error"]]]],[[]],[[],["cellshape",4]],[[],["usize",15]],[[],["usize",15]],[[],["usize",15]],[[],["usize",15]],[[]],null,[[],["usize",15]],[[],["string",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[],["topologyref",3]],[[],["unitcell",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],null,[[],["f64",15]],[[]],null,[[]],[[],["string",3]],[[],["f64",15]],[[["i64",15]],["residue",3]],[[]],[[["frame",3]],[["error",3],["result",4,["error"]]]],null,null,null,null,null],"p":[[4,"BondOrder"],[4,"Property"],[4,"Status"],[4,"CellShape"],[3,"Residue"],[3,"Topology"],[3,"Frame"],[3,"UnitCell"],[3,"Atom"],[3,"FormatMetadata"],[3,"AtomRef"],[3,"AtomMut"],[3,"UnitCellRef"],[3,"UnitCellMut"],[3,"ResidueRef"],[3,"TopologyRef"],[3,"Trajectory"],[3,"Selection"],[3,"PropertiesIter"],[3,"Error"],[3,"Match"],[13,"Bool"],[13,"Double"],[13,"String"],[13,"Vector3D"]]}\ +}'); +if (window.initSearch) {window.initSearch(searchIndex)}; \ No newline at end of file diff --git a/0.10.2/doc/search.js b/0.10.2/doc/search.js new file mode 100644 index 000000000..91de2a155 --- /dev/null +++ b/0.10.2/doc/search.js @@ -0,0 +1 @@ +(function(){var itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias"];var TY_PRIMITIVE=itemTypes.indexOf("primitive");var TY_KEYWORD=itemTypes.indexOf("keyword");function printTab(nb){if(nb===0||nb===1||nb===2){searchState.currentTab=nb}var nb_copy=nb;onEachLazy(document.getElementById("titles").childNodes,function(elem){if(nb_copy===0){addClass(elem,"selected")}else{removeClass(elem,"selected")}nb_copy-=1});onEachLazy(document.getElementById("results").childNodes,function(elem){if(nb===0){addClass(elem,"active")}else{removeClass(elem,"active")}nb-=1})}function removeEmptyStringsFromArray(x){for(var i=0,len=x.length;i-1){var obj=searchIndex[results[i].id];obj.lev=results[i].lev;var res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType){var ar=[];for(var entry in results){if(hasOwnPropertyRustdoc(results,entry)){ar.push(results[entry])}}results=ar;var i,len,result;for(i=0,len=results.length;ib?+1:-1)}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});for(i=0,len=results.length;i"));return{name:val.substring(0,val.indexOf("<")),generics:values.split(/\s*,\s*/),}}return{name:val,generics:[],}}function checkGenerics(obj,val){var tmp_lev,elem_name;if(val.generics.length>0){if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>=val.generics.length){var elems=Object.create(null);var elength=obj[GENERICS_DATA].length;for(var x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length>0){var elems=Object.create(null);len=obj[GENERICS_DATA].length;for(x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length!==0){var tmp_lev=checkGenerics(obj,val);if(tmp_lev<=MAX_LEV_DISTANCE){return tmp_lev}}}}else if(literalSearch){if((!val.generics||val.generics.length===0)&&obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){return obj[GENERICS_DATA].some(function(name){return name===val.name})}return false}lev_distance=Math.min(levenshtein(obj[NAME],val.name),lev_distance);if(lev_distance<=MAX_LEV_DISTANCE){lev_distance=Math.ceil((checkGenerics(obj,val)+lev_distance)/2)}else if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){var olength=obj[GENERICS_DATA].length;for(x=0;x0){var length=obj.type[INPUTS_DATA].length;for(var i=0;iOUTPUT_DATA){var ret=obj.type[OUTPUT_DATA];if(typeof ret[0]==="string"){ret=[ret]}for(var x=0,len=ret.length;xlength){return MAX_LEV_DISTANCE+1}for(var i=0;ilength){break}var lev_total=0;var aborted=false;for(var x=0;xMAX_LEV_DISTANCE){aborted=true;break}lev_total+=lev}if(!aborted){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER)return true;if(filter===type)return true;var name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates){var aliases=[];var crateAliases=[];if(filterCrates!==undefined){if(ALIASES[filterCrates]&&ALIASES[filterCrates][query.search]){var query_aliases=ALIASES[filterCrates][query.search];var len=query_aliases.length;for(var i=0;iMAX_RESULTS){ret.others.pop()}};onEach(aliases,pushFunc);onEach(crateAliases,pushFunc)}var nSearchWords=searchWords.length;var i,it;var ty;var fullId;var returned;var in_args;var len;if((val.charAt(0)==="\""||val.charAt(0)==="'")&&val.charAt(val.length-1)===val.charAt(0)){val=extractGenerics(val.substr(1,val.length-2));for(i=0;i")>-1){var trimmer=function(s){return s.trim()};var parts=val.split("->").map(trimmer);var input=parts[0];var inputs=input.split(",").map(trimmer).sort();for(i=0,len=inputs.length;i1?paths.length-1:1);var lev,j;for(j=0;j1){lev=checkPath(contains,paths[paths.length-1],ty);if(lev>MAX_LEV_DISTANCE){continue}else if(lev>0){lev_add=lev/10}}returned=MAX_LEV_DISTANCE+1;in_args=MAX_LEV_DISTANCE+1;var index=-1;lev=MAX_LEV_DISTANCE+1;fullId=ty.id;if(searchWords[j].indexOf(split[i])>-1||searchWords[j].indexOf(val)>-1||ty.normalizedName.indexOf(val)>-1){if(typePassesFilter(typeFilter,ty.ty)&&results[fullId]===undefined){index=ty.normalizedName.indexOf(val)}}if((lev=levenshtein(searchWords[j],val))<=MAX_LEV_DISTANCE){if(typePassesFilter(typeFilter,ty.ty)){lev+=1}else{lev=MAX_LEV_DISTANCE+1}}in_args=findArg(ty,valGenerics,false,typeFilter);returned=checkReturned(ty,valGenerics,false,typeFilter);lev+=lev_add;if(lev>0&&val.length>3&&searchWords[j].indexOf(val)>-1){if(val.length<6){lev-=1}else{lev=0}}if(in_args<=MAX_LEV_DISTANCE){if(results_in_args[fullId]===undefined){results_in_args[fullId]={id:j,index:index,lev:in_args,}}results_in_args[fullId].lev=Math.min(results_in_args[fullId].lev,in_args)}if(returned<=MAX_LEV_DISTANCE){if(results_returned[fullId]===undefined){results_returned[fullId]={id:j,index:index,lev:returned,}}results_returned[fullId].lev=Math.min(results_returned[fullId].lev,returned)}if(typePassesFilter(typeFilter,ty.ty)&&(index!==-1||lev<=MAX_LEV_DISTANCE)){if(index!==-1&&paths.length<2){lev=0}if(results[fullId]===undefined){results[fullId]={id:j,index:index,lev:lev,}}results[fullId].lev=Math.min(results[fullId].lev,lev)}}}var ret={"in_args":sortResults(results_in_args,true),"returned":sortResults(results_returned,true),"others":sortResults(results,false),};handleAliases(ret,query,filterCrates);return ret}function validateResult(name,path,keys,parent){for(var i=0,len=keys.length;i-1||path.indexOf(keys[i])>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(keys[i])>-1)||levenshtein(name,keys[i])<=MAX_LEV_DISTANCE)){return false}}return true}function getQuery(raw){var matches,type,query;query=raw;matches=query.match(/^(fn|mod|struct|enum|trait|type|const|macro)\s*:\s*/i);if(matches){type=matches[1].replace(/^const$/,"constant");query=query.substring(matches[0].length)}return{raw:raw,query:query,type:type,id:query+type}}function nextTab(direction){var next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){var target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#titles > button").item(searchState.currentTab);if(target){target.focus()}}function buildHrefAndPath(item){var displayPath;var href;var type=itemTypes[item.ty];var name=item.name;var path=item.path;if(type==="mod"){displayPath=path+"::";href=window.rootPath+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="primitive"||type==="keyword"){displayPath="";href=window.rootPath+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=window.rootPath+name+"/index.html"}else if(item.parent!==undefined){var myparent=item.parent;var anchor="#"+type+"."+name;var parentType=itemTypes[myparent.ty];var pageType=parentType;var pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){var enumNameIdx=item.path.lastIndexOf("::");var enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=window.rootPath+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=window.rootPath+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function escape(content){var h1=document.createElement("h1");h1.textContent=content;return h1.innerHTML}function pathSplitter(path){var tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){var extraClass="";if(display===true){extraClass=" active"}var output=document.createElement("div");var duplicates={};var length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(function(item){if(item.is_alias!==true){if(duplicates[item.fullPath]){return}duplicates[item.fullPath]=true}var name=item.name;var type=itemTypes[item.ty];length+=1;var extra="";if(type==="primitive"){extra=" (primitive type)"}else if(type==="keyword"){extra=" (keyword)"}var link=document.createElement("a");link.className="result-"+type;link.href=item.href;var wrapper=document.createElement("div");var resultName=document.createElement("div");resultName.className="result-name";if(item.is_alias){var alias=document.createElement("span");alias.className="alias";var bold=document.createElement("b");bold.innerText=item.alias;alias.appendChild(bold);alias.insertAdjacentHTML("beforeend"," - see ");resultName.appendChild(alias)}resultName.insertAdjacentHTML("beforeend",item.displayPath+""+name+extra+"");wrapper.appendChild(resultName);var description=document.createElement("div");description.className="desc";var spanDesc=document.createElement("span");spanDesc.insertAdjacentHTML("beforeend",item.desc);description.appendChild(spanDesc);wrapper.appendChild(description);link.appendChild(wrapper);output.appendChild(link)})}else{output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first){var search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==searchState.loadingText))){var elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}var query=getQuery(searchState.input.value);currentResults=query.id;var ret_others=addTab(results.others,query);var ret_in_args=addTab(results.in_args,query,false);var ret_returned=addTab(results.returned,query,false);var currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}var output="

Results for "+escape(query.query)+(query.type?" (type: "+escape(query.type)+")":"")+"

"+"
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
";var resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;search.appendChild(resultsElem);searchState.focusedByTab=[null,null,null];searchState.showResults(search);var elems=document.getElementById("titles").childNodes;elems[0].onclick=function(){printTab(0)};elems[1].onclick=function(){printTab(1)};elems[2].onclick=function(){printTab(2)};printTab(currentTab)}function execSearch(query,searchWords,filterCrates){function getSmallest(arrays,positions,notDuplicates){var start=null;for(var it=0,len=positions.length;itpositions[it]&&(start===null||start>arrays[it][positions[it]].lev)&&!notDuplicates[arrays[it][positions[it]].fullPath]){start=arrays[it][positions[it]].lev}}return start}function mergeArrays(arrays){var ret=[];var positions=[];var notDuplicates={};for(var x=0,arrays_len=arrays.length;xpositions[x]&&arrays[x][positions[x]].lev===smallest&&!notDuplicates[arrays[x][positions[x]].fullPath]){ret.push(arrays[x][positions[x]]);notDuplicates[arrays[x][positions[x]].fullPath]=true;positions[x]+=1}}}return ret}function tokenizeQuery(raw){var i,matched;var l=raw.length;var depth=0;var nextAngle=/(<|>)/g;var ret=[];var start=0;for(i=0;i'){depth+=1}break;case">":if(depth>0){depth-=1}break;case",":if(depth===0){ret.push(raw.substring(start,i));start=i+1}break}}if(start!==i){ret.push(raw.substring(start,i))}return ret}var queries=tokenizeQuery(query.raw);var results={"in_args":[],"returned":[],"others":[],};for(var i=0,len=queries.length;i1){return{"in_args":mergeArrays(results.in_args),"returned":mergeArrays(results.returned),"others":mergeArrays(results.others),}}return{"in_args":results.in_args[0],"returned":results.returned[0],"others":results.others[0],}}function getFilterCrates(){var elem=document.getElementById("crate-search");if(elem&&elem.value!=="All crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return undefined}function search(e,forced){var params=searchState.getQueryStringParams();var query=getQuery(searchState.input.value.trim());if(e){e.preventDefault()}if(query.query.length===0){return}if(!forced&&query.id===currentResults){if(query.query.length>0){searchState.putBackSearch(searchState.input)}return}searchState.title="Results for "+query.query+" - Rust";if(searchState.browserSupportsHistoryApi()){var newURL=getNakedUrl()+"?search="+encodeURIComponent(query.raw)+window.location.hash;if(!history.state&&!params.search){history.pushState(query,"",newURL)}else{history.replaceState(query,"",newURL)}}var filterCrates=getFilterCrates();showResults(execSearch(query,index,filterCrates),params.go_to_first)}function buildIndex(rawSearchIndex){searchIndex=[];var searchWords=[];var i,word;var currentIndex=0;var id=0;for(var crate in rawSearchIndex){if(!hasOwnPropertyRustdoc(rawSearchIndex,crate)){continue}var crateSize=0;searchWords.push(crate);var crateRow={crate:crate,ty:1,name:crate,path:"",desc:rawSearchIndex[crate].doc,parent:undefined,type:null,id:id,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),};id+=1;searchIndex.push(crateRow);currentIndex+=1;var itemTypes=rawSearchIndex[crate].t;var itemNames=rawSearchIndex[crate].n;var itemPaths=rawSearchIndex[crate].q;var itemDescs=rawSearchIndex[crate].d;var itemParentIdxs=rawSearchIndex[crate].i;var itemFunctionSearchTypes=rawSearchIndex[crate].f;var paths=rawSearchIndex[crate].p;var aliases=rawSearchIndex[crate].a;var len=paths.length;for(i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:itemFunctionSearchTypes[i],id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){ALIASES[crate]={};var j,local_aliases;for(var alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}if(!hasOwnPropertyRustdoc(ALIASES[crate],alias_name)){ALIASES[crate][alias_name]=[]}local_aliases=aliases[alias_name];for(j=0,len=local_aliases.length;j0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=function(){var qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}index=buildIndex(rawSearchIndex);registerSearchEvents();if(searchState.getQueryStringParams().search){search()}};if(window.searchIndex!==undefined){initSearch(window.searchIndex)}})() \ No newline at end of file diff --git a/0.10.2/doc/settings.css b/0.10.2/doc/settings.css new file mode 100644 index 000000000..670986588 --- /dev/null +++ b/0.10.2/doc/settings.css @@ -0,0 +1 @@ +.setting-line{padding:5px;position:relative;}.setting-line>div{display:inline-block;vertical-align:top;font-size:17px;padding-top:2px;}.setting-line>.title{font-size:19px;width:100%;max-width:none;border-bottom:1px solid;}.toggle{position:relative;display:inline-block;width:45px;height:27px;margin-right:20px;}.toggle input{opacity:0;position:absolute;}.select-wrapper{float:right;position:relative;height:27px;min-width:25%;}.select-wrapper select{appearance:none;-moz-appearance:none;-webkit-appearance:none;background:none;border:2px solid #ccc;padding-right:28px;width:100%;}.select-wrapper img{pointer-events:none;position:absolute;right:0;bottom:0;background:#ccc;height:100%;width:28px;padding:0px 4px;}.select-wrapper select option{color:initial;}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.3s;transition:.3s;}.slider:before{position:absolute;content:"";height:19px;width:19px;left:4px;bottom:4px;background-color:white;-webkit-transition:.3s;transition:.3s;}input:checked+.slider{background-color:#2196F3;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}input:checked+.slider:before{-webkit-transform:translateX(19px);-ms-transform:translateX(19px);transform:translateX(19px);}.setting-line>.sub-settings{padding-left:42px;width:100%;display:block;} \ No newline at end of file diff --git a/0.10.2/doc/settings.html b/0.10.2/doc/settings.html new file mode 100644 index 000000000..9f98cbfbd --- /dev/null +++ b/0.10.2/doc/settings.html @@ -0,0 +1,4 @@ +Rustdoc settings

Rustdoc settings

Theme preferences
Use system theme
Preferred dark theme
Preferred light theme
+
Auto-hide item contents for large items.
Auto-hide item methods' documentation
Auto-hide trait implementation documentation
Directly go to item in search if there is only one result
Show line numbers on code examples
Disable keyboard shortcuts
+ + \ No newline at end of file diff --git a/0.10.2/doc/settings.js b/0.10.2/doc/settings.js new file mode 100644 index 000000000..b4d6fdcd7 --- /dev/null +++ b/0.10.2/doc/settings.js @@ -0,0 +1 @@ +(function(){function changeSetting(settingName,value){updateLocalStorage("rustdoc-"+settingName,value);switch(settingName){case"preferred-dark-theme":case"preferred-light-theme":case"use-system-theme":updateSystemTheme();break}}function handleKey(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey){return}switch(getVirtualKey(ev)){case"Enter":case"Return":case"Space":ev.target.checked=!ev.target.checked;ev.preventDefault();break}}function setEvents(){onEachLazy(document.getElementsByClassName("slider"),function(elem){var toggle=elem.previousElementSibling;var settingId=toggle.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=function(){changeSetting(this.id,this.checked)};toggle.onkeyup=handleKey;toggle.onkeyrelease=handleKey});onEachLazy(document.getElementsByClassName("select-wrapper"),function(elem){var select=elem.getElementsByTagName("select")[0];var settingId=select.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){select.value=settingValue}select.onchange=function(){changeSetting(this.id,this.value)}})}window.addEventListener("DOMContentLoaded",setEvents)})() \ No newline at end of file diff --git a/0.10.2/doc/source-files.js b/0.10.2/doc/source-files.js new file mode 100644 index 000000000..c49ec708c --- /dev/null +++ b/0.10.2/doc/source-files.js @@ -0,0 +1,3 @@ +var N = null;var sourcesIndex = {}; +sourcesIndex["chemfiles"] = {"name":"","files":["atom.rs","cell.rs","errors.rs","frame.rs","lib.rs","misc.rs","property.rs","residue.rs","selection.rs","strings.rs","topology.rs","trajectory.rs"]}; +createSourceSidebar(); diff --git a/0.10.2/doc/source-script.js b/0.10.2/doc/source-script.js new file mode 100644 index 000000000..5dc8fee0f --- /dev/null +++ b/0.10.2/doc/source-script.js @@ -0,0 +1 @@ +(function(){function getCurrentFilePath(){var parts=window.location.pathname.split("/");var rootPathParts=window.rootPath.split("/");for(var i=0,len=rootPathParts.length;i"){sidebar.style.left="";this.style.left="";child.innerText="<";updateLocalStorage("rustdoc-source-sidebar-show","true")}else{sidebar.style.left="-300px";this.style.left="0";child.innerText=">";updateLocalStorage("rustdoc-source-sidebar-show","false")}}function createSidebarToggle(){var sidebarToggle=document.createElement("div");sidebarToggle.id="sidebar-toggle";sidebarToggle.onclick=toggleSidebar;var inner1=document.createElement("div");inner1.style.position="relative";var inner2=document.createElement("div");inner2.style.paddingTop="3px";if(getCurrentValue("rustdoc-source-sidebar-show")==="true"){inner2.innerText="<"}else{inner2.innerText=">";sidebarToggle.style.left="0"}inner1.appendChild(inner2);sidebarToggle.appendChild(inner1);return sidebarToggle}function createSourceSidebar(){if(!window.rootPath.endsWith("/")){window.rootPath+="/"}var main=document.getElementById("main");var sidebarToggle=createSidebarToggle();main.insertBefore(sidebarToggle,main.firstChild);var sidebar=document.createElement("div");sidebar.id="source-sidebar";if(getCurrentValue("rustdoc-source-sidebar-show")!=="true"){sidebar.style.left="-300px"}var currentFile=getCurrentFilePath();var hasFoundFile=false;var title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(function(key){sourcesIndex[key].name=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",currentFile,hasFoundFile)});main.insertBefore(sidebar,main.firstChild);var selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}var lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSourceLines(scrollTo,match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}var from=parseInt(match[1],10);var to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(tocur_line_id){var tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",function(){var match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSourceLines(false,match)}});onEachLazy(document.getElementsByClassName("line-numbers"),function(el){el.addEventListener("click",handleSourceHighlight)});highlightSourceLines(true);window.createSourceSidebar=createSourceSidebar})() \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/atom.rs.html b/0.10.2/doc/src/chemfiles/atom.rs.html new file mode 100644 index 000000000..5e1dcca8a --- /dev/null +++ b/0.10.2/doc/src/chemfiles/atom.rs.html @@ -0,0 +1,1056 @@ +atom.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null};
+use strings;
+
+use property::{Property, RawProperty, PropertiesIter};
+
+/// An `Atom` is a particle in the current `Frame`. It stores the following
+/// atomic properties:
+///
+/// - atom name;
+/// - atom type;
+/// - atom mass;
+/// - atom charge.
+///
+/// The atom name is usually an unique identifier (`H1`, `C_a`) while the
+/// atom type will be shared between all particles of the same type: `H`,
+/// `Ow`, `CH3`.
+pub struct Atom {
+    handle: *mut CHFL_ATOM,
+}
+
+/// An analog to a reference to an atom (`&Atom`)
+pub struct AtomRef<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a Atom>
+}
+
+impl<'a> Deref for AtomRef<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an atom (`&mut Atom`)
+pub struct AtomMut<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a mut Atom>
+}
+
+impl<'a> Deref for AtomMut<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for AtomMut<'a> {
+    fn deref_mut(&mut self) -> &mut Atom {
+        &mut self.inner
+    }
+}
+
+impl Clone for Atom {
+    fn clone(&self) -> Atom {
+        unsafe {
+            let new_handle = chfl_atom_copy(self.as_ptr());
+            Atom::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Atom {
+    /// Create an owned `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_ATOM) -> Atom {
+        check_not_null(ptr);
+        Atom {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_ATOM) -> AtomRef<'a> {
+        AtomRef {
+            inner: Atom::from_ptr(ptr as *mut CHFL_ATOM),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a mutably borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_ATOM) -> AtomMut<'a> {
+        AtomMut {
+            inner: Atom::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_ATOM {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_ATOM {
+        self.handle
+    }
+
+    /// Create an atom with the given `name`, and set the atom type to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Atom {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_atom(buffer.as_ptr());
+            Atom::from_ptr(handle)
+        }
+    }
+
+    /// Get the atom mass, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.mass(), 4.002602);
+    /// ```
+    pub fn mass(&self) -> f64 {
+        let mut mass = 0.0;
+        unsafe {
+            check_success(chfl_atom_mass(self.as_ptr(), &mut mass));
+        }
+        return mass;
+    }
+
+    /// Set the atom mass to `mass`, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_mass(34.9);
+    /// assert_eq!(atom.mass(), 34.9);
+    /// ```
+    pub fn set_mass(&mut self, mass: f64) {
+        unsafe {
+            check_success(chfl_atom_set_mass(self.as_mut_ptr(), mass));
+        }
+    }
+
+    /// Get the atom charge, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.charge(), 0.0);
+    /// ```
+    pub fn charge(&self) -> f64 {
+        let mut charge = 0.0;
+        unsafe {
+            check_success(chfl_atom_charge(self.as_ptr(), &mut charge));
+        }
+        return charge;
+    }
+
+    /// Set the atom charge to `charge`, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_charge(-2.0);
+    /// assert_eq!(atom.charge(), -2.0);
+    /// ```
+    pub fn set_charge(&mut self, charge: f64) {
+        unsafe {
+            check_success(chfl_atom_set_charge(self.as_mut_ptr(), charge));
+        }
+    }
+
+    /// Get the atom name.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_atom_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_name).expect("getting name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Get the atom type.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.atomic_type(), "He");
+    /// ```
+    pub fn atomic_type(&self) -> String {
+        let get_type = |ptr, len| unsafe { chfl_atom_type(self.as_ptr(), ptr, len) };
+        let buffer = strings::call_autogrow_buffer(10, get_type).expect("getting type failed");
+        return strings::from_c(buffer.as_ptr());
+    }
+
+    /// Set the atom name to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_name("Zn3");
+    /// assert_eq!(atom.name(), "Zn3");
+    /// ```
+    pub fn set_name<'a>(&mut self, name: impl Into<&'a str>) {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            check_success(chfl_atom_set_name(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Set the atom type to `atomic_type`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_atomic_type("F");
+    /// assert_eq!(atom.atomic_type(), "F");
+    /// ```
+    pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>) {
+        let buffer = strings::to_c(atomic_type.into());
+        unsafe {
+            check_success(chfl_atom_set_type(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Try to get the full name of the atom from the atomic type. For example,
+    /// the full name of "He" is "Helium", and so on. If the name can not be
+    /// found, this function returns the empty string.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("Zn");
+    /// assert_eq!(atom.full_name(), "Zinc");
+    /// ```
+    pub fn full_name(&self) -> String {
+        let get_full_name = |ptr, len| unsafe { chfl_atom_full_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_full_name).expect("getting full name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Try to get the Van der Waals radius of the atom from the atomic type.
+    /// If the radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+    /// assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+    /// ```
+    pub fn vdw_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_vdw_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the covalent radius of the atom from the atomic type. If the
+    /// radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+    /// assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+    /// ```
+    pub fn covalent_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_covalent_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the atomic number of the atom from the atomic type. If the
+    /// number can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").atomic_number(), 2);
+    /// assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+    /// ```
+    pub fn atomic_number(&self) -> u64 {
+        let mut number = 0;
+        unsafe {
+            check_success(chfl_atom_atomic_number(self.as_ptr(), &mut number));
+        }
+        return number;
+    }
+
+    /// Add a new `property` with the given `name` to this atom.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("a bool", true);
+    /// atom.set("a string", "test");
+    ///
+    /// assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+    /// assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_atom_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+
+    /// Get a property with the given `name` in this atom, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(atom.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_atom_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                let property = Property::from_raw(raw);
+                Some(property)
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this atom
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    /// atom.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in atom.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_atom_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_atom_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Atom {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+
+        let copy = atom.clone();
+        assert_eq!(copy.name(), "He");
+
+        atom.set_name("Na");
+        assert_eq!(atom.name(), "Na");
+        assert_eq!(copy.name(), "He");
+    }
+
+    #[test]
+    fn mass() {
+        let mut atom = Atom::new("He");
+        assert_ulps_eq!(atom.mass(), 4.002602);
+        atom.set_mass(15.0);
+        assert_eq!(atom.mass(), 15.0);
+    }
+
+    #[test]
+    fn charge() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.charge(), 0.0);
+        atom.set_charge(-1.5);
+        assert_eq!(atom.charge(), -1.5);
+    }
+
+    #[test]
+    fn name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+        atom.set_name("Zn-12");
+        assert_eq!(atom.name(), "Zn-12");
+    }
+
+    #[test]
+    fn atomic_type() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.atomic_type(), "He");
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.atomic_type(), "Zn");
+    }
+
+    #[test]
+    fn full_name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.full_name(), "Helium");
+
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.full_name(), "Zinc");
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.full_name(), "");
+    }
+
+    #[test]
+    fn radii() {
+        let atom = Atom::new("He");
+        assert_ulps_eq!(atom.vdw_radius(), 1.4);
+        assert_ulps_eq!(atom.covalent_radius(), 0.32);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.vdw_radius(), 0.0);
+        assert_eq!(atom.covalent_radius(), 0.0);
+    }
+
+    #[test]
+    fn atomic_number() {
+        let atom = Atom::new("He");
+        assert_eq!(atom.atomic_number(), 2);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.atomic_number(), 0);
+    }
+
+    #[test]
+    fn property() {
+        let mut atom = Atom::new("F");
+
+        atom.set("foo", -22.0);
+        assert_eq!(atom.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(atom.get("bar"), None);
+
+        atom.set("bar", Property::String("here".into()));
+        for (name, property) in atom.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/cell.rs.html b/0.10.2/doc/src/chemfiles/cell.rs.html new file mode 100644 index 000000000..050f0d141 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/cell.rs.html @@ -0,0 +1,1104 @@ +cell.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null, check, Error};
+
+/// Available unit cell shapes.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum CellShape {
+    /// Orthorhombic cell, with the three angles equals to 90°.
+    Orthorhombic,
+    /// Triclinic cell, with any values for the angles.
+    Triclinic,
+    /// Infinite cell, to use when there is no cell.
+    Infinite,
+}
+
+impl From<chfl_cellshape> for CellShape {
+    fn from(celltype: chfl_cellshape) -> CellShape {
+        match celltype {
+            chfl_cellshape::CHFL_CELL_ORTHORHOMBIC => CellShape::Orthorhombic,
+            chfl_cellshape::CHFL_CELL_TRICLINIC => CellShape::Triclinic,
+            chfl_cellshape::CHFL_CELL_INFINITE => CellShape::Infinite,
+        }
+    }
+}
+
+impl From<CellShape> for chfl_cellshape {
+    fn from(celltype: CellShape) -> chfl_cellshape {
+        match celltype {
+            CellShape::Orthorhombic => chfl_cellshape::CHFL_CELL_ORTHORHOMBIC,
+            CellShape::Triclinic => chfl_cellshape::CHFL_CELL_TRICLINIC,
+            CellShape::Infinite => chfl_cellshape::CHFL_CELL_INFINITE,
+        }
+    }
+}
+
+/// An `UnitCell` represent the box containing the atoms, and its periodicity.
+///
+/// An unit cell is fully represented by three lengths (a, b, c); and three
+/// angles (alpha, beta, gamma). The angles are stored in degrees, and the
+/// lengths in Angstroms.
+///
+/// A cell also has a matricial representation, by projecting the three base
+/// vector into an orthonormal base. We choose to represent such matrix as an
+/// upper triangular matrix:
+///
+/// ```text
+/// | a_x   b_x   c_x |
+/// |  0    b_y   c_y |
+/// |  0     0    c_z |
+/// ```
+pub struct UnitCell {
+    handle: *mut CHFL_CELL,
+}
+
+/// An analog to a reference to an unit cell (`&UnitCell`)
+pub struct UnitCellRef<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a UnitCell>
+}
+
+impl<'a> Deref for UnitCellRef<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an unit cell (`&mut UnitCell`)
+pub struct UnitCellMut<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a mut UnitCell>
+}
+
+impl<'a> Deref for UnitCellMut<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for UnitCellMut<'a> {
+    fn deref_mut(&mut self) -> &mut UnitCell {
+        &mut self.inner
+    }
+}
+
+impl Clone for UnitCell {
+    fn clone(&self) -> UnitCell {
+        unsafe {
+            let new_handle = chfl_cell_copy(self.as_ptr());
+            UnitCell::from_ptr(new_handle)
+        }
+    }
+}
+
+impl UnitCell {
+    /// Create an owned `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_CELL) -> UnitCell {
+        check_not_null(ptr);
+        UnitCell {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime.
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_CELL) -> UnitCellRef<'a> {
+        UnitCellRef {
+            inner: UnitCell::from_ptr(ptr as *mut CHFL_CELL),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible for
+    /// setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_CELL) -> UnitCellMut<'a> {
+        UnitCellMut {
+            inner: UnitCell::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_CELL {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_CELL {
+        self.handle
+    }
+
+    /// Create an `Orthorhombic` `UnitCell` from the three lengths, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn new(lengths: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), ptr::null());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `Infinite` `UnitCell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::infinite();
+    ///
+    /// assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn infinite() -> UnitCell {
+        let mut cell = UnitCell::new([0.0, 0.0, 0.0]);
+        cell.set_shape(CellShape::Infinite).expect("could not set cell shape");
+        return cell;
+    }
+
+    /// Create an `Triclinic` `UnitCell` from the three lengths (in Angstroms)
+    /// and three angles (in degree). `alpha` is the angle between the vectors
+    /// `b` and `c`; `beta` is the between the vectors `a` and `c` and `gamma`
+    /// is the angle between the vectors `a` and `b`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// assert_eq!(cell.angles()[0], 98.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), angles.as_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `UnitCell` from a cell matrix. If `matrix` contains only
+    /// zeros, then an `Infinite` cell is created. If only the diagonal of the
+    /// matrix is non-zero, then the cell is `Orthorhombic`. Else a
+    /// `Triclinic` cell is created. The matrix entries should be in Angstroms.
+    ///
+    /// # Panics
+    ///
+    /// If the matrix has a negative determinant, or more generally is not
+    /// representing a unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::from_matrix([
+    ///     [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+    /// ]);
+    ///
+    /// assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn from_matrix(mut matrix: [[f64; 3]; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell_from_matrix(matrix.as_mut_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Get the three lengths of the cell, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// ```
+    pub fn lengths(&self) -> [f64; 3] {
+        let mut lengths = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_lengths(self.as_ptr(), lengths.as_mut_ptr()));
+        }
+        return lengths;
+    }
+
+    /// Set the three lengths of the cell, in Angstroms.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is infinite, or if one of the
+    /// lengths is negative.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+    /// assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+    ///
+    /// assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+    /// ```
+    pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_lengths(self.as_mut_ptr(), lengths.as_ptr()))
+        }
+    }
+
+    /// Get the three angles of the cell, in degrees.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([20.0, 20.0, 20.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    ///
+    /// let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// ```
+    pub fn angles(&self) -> [f64; 3] {
+        let mut angles = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_angles(self.as_ptr(), angles.as_mut_ptr()));
+        }
+        return angles;
+    }
+
+    /// Set the three angles of the cell, in degrees.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is not `Triclinic`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    ///
+    /// cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// ```
+    pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_angles(self.as_mut_ptr(), angles.as_ptr()))
+        }
+    }
+
+    /// Get the unit cell matricial representation.
+    ///
+    /// The unit cell representation is obtained by aligning the a vector along
+    /// the *x* axis and putting the b vector in the *xy* plane. This make the
+    /// matrix an upper triangular matrix:
+    ///
+    /// ```text
+    /// | a_x   b_x   c_x |
+    /// |  0    b_y   c_y |
+    /// |  0     0    c_z |
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let matrix = cell.matrix();
+    ///
+    /// assert_eq!(matrix[0][0], 10.0);
+    /// assert_eq!(matrix[1][1], 20.0);
+    /// assert_eq!(matrix[2][2], 30.0);
+    ///
+    /// assert!(matrix[1][2].abs() < 1e-9);
+    /// ```
+    pub fn matrix(&self) -> [[f64; 3]; 3] {
+        let mut matrix = [[0.0; 3]; 3];
+        unsafe {
+            check_success(chfl_cell_matrix(self.as_ptr(), matrix.as_mut_ptr()));
+        }
+        return matrix;
+    }
+
+    /// Get the shape of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn shape(&self) -> CellShape {
+        let mut shape = chfl_cellshape::CHFL_CELL_INFINITE;
+        unsafe {
+            check_success(chfl_cell_shape(self.as_ptr(), &mut shape));
+        }
+        return CellShape::from(shape);
+    }
+
+    /// Set the shape of the unit cell to `shape`.
+    ///
+    /// # Errors
+    ///
+    /// This can fail if the cell length or angles are incompatible with the
+    /// new shape.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    ///
+    /// cell.set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_shape(self.as_mut_ptr(), shape.into()))
+        }
+    }
+
+    /// Get the volume of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+    /// ```
+    pub fn volume(&self) -> f64 {
+        let mut volume = 0.0;
+        unsafe {
+            check_success(chfl_cell_volume(self.as_ptr(), &mut volume));
+        }
+        return volume;
+    }
+
+    /// Wrap a `vector` in this unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let mut vector = [12.0, 5.2, -45.3];
+    /// cell.wrap(&mut vector);
+    /// assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+    /// ```
+    pub fn wrap(&self, vector: &mut [f64; 3]) {
+        unsafe {
+            check_success(chfl_cell_wrap(self.as_ptr(), vector.as_mut_ptr()));
+        }
+    }
+}
+
+impl Drop for UnitCell {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+
+        let copy = cell.clone();
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+    }
+
+    #[test]
+    fn lengths() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+    }
+
+    #[test]
+    fn angles() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        crate::assert_vector3d_eq(&cell.angles(), &[90.0, 90.0, 90.0], 1e-6);
+
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        cell.set_angles([80.0, 89.0, 100.0]).unwrap();
+
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 89.0, 100.0], 1e-6);
+
+        let cell = UnitCell::triclinic([1., 2., 3.], [80., 90., 100.]);
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 90.0, 100.0], 1e-6);
+    }
+
+    #[test]
+    fn volume() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.volume(), 2.0 * 3.0 * 4.0);
+    }
+
+    #[test]
+    fn wrap() {
+        let cell = UnitCell::new([10.0, 20.0, 30.0]);
+        let mut vector = [12.0, 5.2, -45.3];
+        cell.wrap(&mut vector);
+        crate::assert_vector3d_eq(&vector, &[2.0, 5.2, 14.7], 1e-6);
+    }
+
+    #[test]
+    fn matrix() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+
+        let matrix = cell.matrix();
+        let result = [[2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 4.0]];
+
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn from_matrix() {
+        let cell = UnitCell::from_matrix([[10.0, 0.0, 0.0], [0.0, 21.0, 0.0], [0.0, 0.0, 32.0]]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        assert_eq!(cell.lengths(), [10.0, 21.0, 32.0]);
+
+        let result_matrix = [
+            [123.0, 4.08386, 71.7295],
+            [0.0, 233.964, 133.571],
+            [0.0, 0.0, 309.901],
+        ];
+        let cell = UnitCell::from_matrix(result_matrix);
+
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+        for i in 0..3 {
+            assert_ulps_eq!(
+                cell.lengths()[i],
+                [123.0, 234.0, 345.0][i],
+                epsilon = 1e-3
+            );
+            assert_ulps_eq!(cell.angles()[i], [67.0, 78.0, 89.0][i], epsilon = 1e-3);
+        }
+
+        let matrix = cell.matrix();
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result_matrix[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn shape() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+        let cell = UnitCell::infinite();
+        assert_eq!(cell.shape(), CellShape::Infinite);
+
+        let cell = UnitCell::triclinic([1.0, 2.0, 3.0], [80.0, 90.0, 100.0]);
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+
+        let mut cell = UnitCell::new([10.0, 10.0, 10.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/errors.rs.html b/0.10.2/doc/src/chemfiles/errors.rs.html new file mode 100644 index 000000000..02f33eef8 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/errors.rs.html @@ -0,0 +1,458 @@ +errors.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+extern crate libc;
+
+use std::error;
+use std::fmt;
+use std::panic::{self, RefUnwindSafe};
+use std::path::Path;
+
+use self::libc::c_char;
+
+use chemfiles_sys::*;
+use strings;
+
+#[derive(Clone, Debug, PartialEq)]
+/// Error type for Chemfiles.
+pub struct Error {
+    /// The error status code
+    pub status: Status,
+    /// A message describing the error cause
+    pub message: String,
+}
+
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Clone, Debug, PartialEq)]
+/// Possible causes of error in chemfiles
+pub enum Status {
+    /// No error
+    Success = chfl_status::CHFL_SUCCESS as isize,
+    /// Error in memory allocations
+    MemoryError = chfl_status::CHFL_MEMORY_ERROR as isize,
+    /// Error while reading or writing a file
+    FileError = chfl_status::CHFL_FILE_ERROR as isize,
+    /// Error in file formatting, *i.e.* the file is invalid
+    FormatError = chfl_status::CHFL_FORMAT_ERROR as isize,
+    /// Error in selection string syntax
+    SelectionError = chfl_status::CHFL_SELECTION_ERROR as isize,
+    /// Error in configuration files syntax
+    ConfigurationError = chfl_status::CHFL_CONFIGURATION_ERROR as isize,
+    /// Error for out of bounds indexing
+    OutOfBounds = chfl_status::CHFL_OUT_OF_BOUNDS as isize,
+    /// Error related to properties
+    PropertyError = chfl_status::CHFL_PROPERTY_ERROR as isize,
+    /// Exception in the C++ chemfiles library
+    ChemfilesError = chfl_status::CHFL_GENERIC_ERROR as isize,
+    /// Exception in the C++ standard library
+    StdCppError = chfl_status::CHFL_CXX_ERROR as isize,
+    /// The given path is not valid UTF8
+    // TODO: rename this to UTF8Error in the next breaking release
+    UTF8PathError,
+}
+
+impl From<chfl_status> for Error {
+    fn from(status: chfl_status) -> Error {
+        let status = match status {
+            chfl_status::CHFL_SUCCESS => Status::Success,
+            chfl_status::CHFL_CXX_ERROR => Status::StdCppError,
+            chfl_status::CHFL_GENERIC_ERROR => Status::ChemfilesError,
+            chfl_status::CHFL_MEMORY_ERROR => Status::MemoryError,
+            chfl_status::CHFL_FILE_ERROR => Status::FileError,
+            chfl_status::CHFL_FORMAT_ERROR => Status::FormatError,
+            chfl_status::CHFL_SELECTION_ERROR => Status::SelectionError,
+            chfl_status::CHFL_CONFIGURATION_ERROR => Status::ConfigurationError,
+            chfl_status::CHFL_OUT_OF_BOUNDS => Status::OutOfBounds,
+            chfl_status::CHFL_PROPERTY_ERROR => Status::PropertyError,
+        };
+
+        let message = Error::last_error();
+        Error {
+            status,
+            message,
+        }
+    }
+}
+
+impl From<std::str::Utf8Error> for Error {
+    fn from(_: std::str::Utf8Error) -> Self {
+        Error {
+            status: Status::UTF8PathError,
+            message: "failed to convert data to UTF8 string".into(),
+        }
+    }
+}
+
+impl Error {
+    /// Create a new error because the given `path` is invalid UTF-8 data
+    pub(crate) fn utf8_path_error(path: &Path) -> Error {
+        Error {
+            status: Status::UTF8PathError,
+            message: format!("Could not convert '{}' to UTF8", path.display()),
+        }
+    }
+
+    /// Get the last error message from the C++ library.
+    pub fn last_error() -> String {
+        unsafe { strings::from_c(chfl_last_error()) }
+    }
+
+    /// Clear any error from the C++ library
+    pub fn cleanup() {
+        unsafe {
+            check(chfl_clear_errors()).expect("error in chfl_clear_errors. Things went very bad");
+        }
+    }
+}
+
+/// Check return value of a C function, and get the error if needed.
+pub(crate) fn check(status: chfl_status) -> Result<(), Error> {
+    if status == chfl_status::CHFL_SUCCESS {
+        Ok(())
+    } else {
+        Err(Error::from(status))
+    }
+}
+
+/// Check return value of a C function, panic if it failed.
+pub(crate) fn check_success(status: chfl_status) {
+    if status != chfl_status::CHFL_SUCCESS {
+        panic!("unexpected failure: {}", Error::last_error());
+    }
+}
+
+/// Check a pointer for null.
+pub(crate) fn check_not_null<T>(ptr: *const T) {
+    if ptr.is_null() {
+        panic!("unexpected null pointer: {}", Error::last_error());
+    }
+}
+
+pub trait WarningCallback: RefUnwindSafe + Fn(&str) {}
+impl<T> WarningCallback for T
+where
+    T: RefUnwindSafe + Fn(&str),
+{
+}
+
+static mut LOGGING_CALLBACK: Option<*mut dyn WarningCallback<Output = ()>> = None;
+
+extern "C" fn warning_callback(message: *const c_char) {
+    unsafe {
+        let callback = &*LOGGING_CALLBACK.expect("No callback provided, this is an internal bug");
+        // ignore result. If a panic happened, everything is going badly anyway
+        let _result = panic::catch_unwind(|| {
+            callback(&strings::from_c(message));
+        });
+    }
+}
+
+/// Use `callback` for every chemfiles warning. The callback will be passed
+/// the warning message. This will drop any previous warning callback.
+pub fn set_warning_callback<F>(callback: F) where F: WarningCallback + 'static {
+    // box callback to ensure it stays accessible
+    let callback = Box::into_raw(Box::new(callback));
+    unsafe {
+        if let Some(previous) = LOGGING_CALLBACK {
+            // drop the previous callback
+            let previous = Box::from_raw(previous);
+            std::mem::drop(previous);
+            // set the LOGGING_CALLBACK to the new one
+            LOGGING_CALLBACK = Some(callback);
+        } else {
+            // set the LOGGING_CALLBACK
+            LOGGING_CALLBACK = Some(callback);
+            // Tell C code to use Rust-provided callback
+            check_success(chfl_set_warning_callback(warning_callback));
+        }
+    }
+}
+
+
+impl fmt::Display for Error {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        write!(fmt, "{}", self.message)
+    }
+}
+
+impl error::Error for Error {
+    fn description(&self) -> &str {
+        match self.status {
+            Status::Success => "Success",
+            Status::StdCppError => "Exception from the C++ standard library",
+            Status::ChemfilesError => "Exception from the chemfiles library",
+            Status::MemoryError => "Error in memory allocations",
+            Status::FileError => "Error while reading or writing a file",
+            Status::FormatError => "Error in file formatting, i.e. the file is invalid",
+            Status::SelectionError => "Error in selection string syntax",
+            Status::UTF8PathError => "A string is not valid UTF8",
+            Status::ConfigurationError => "Error in configuration files",
+            Status::OutOfBounds => "Out of bounds indexing",
+            Status::PropertyError => "Error in property",
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use Trajectory;
+
+    #[test]
+    fn errors() {
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+        assert!(Trajectory::open("nope", 'r').is_err());
+        assert_eq!(
+            Error::last_error(),
+            "file at \'nope\' does not have an extension, provide a format name to read it"
+        );
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+    }
+
+    #[test]
+    fn codes() {
+        assert_eq!(Error::from(chfl_status::CHFL_SUCCESS).status, Status::Success);
+        assert_eq!(Error::from(chfl_status::CHFL_CXX_ERROR).status, Status::StdCppError);
+        assert_eq!(Error::from(chfl_status::CHFL_GENERIC_ERROR).status, Status::ChemfilesError);
+        assert_eq!(Error::from(chfl_status::CHFL_MEMORY_ERROR).status, Status::MemoryError);
+        assert_eq!(Error::from(chfl_status::CHFL_FILE_ERROR).status, Status::FileError);
+        assert_eq!(Error::from(chfl_status::CHFL_FORMAT_ERROR).status, Status::FormatError);
+        assert_eq!(Error::from(chfl_status::CHFL_SELECTION_ERROR).status, Status::SelectionError);
+        assert_eq!(Error::from(chfl_status::CHFL_OUT_OF_BOUNDS).status, Status::OutOfBounds);
+        assert_eq!(Error::from(chfl_status::CHFL_PROPERTY_ERROR).status, Status::PropertyError);
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/frame.rs.html b/0.10.2/doc/src/chemfiles/frame.rs.html new file mode 100644 index 000000000..30c9a9798 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/frame.rs.html @@ -0,0 +1,2298 @@ +frame.rs - source
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::ptr;
+use std::slice;
+
+use chemfiles_sys::*;
+use strings;
+use errors::{check_not_null, check_success, check, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Topology, TopologyRef, Residue, BondOrder};
+use super::{UnitCell, UnitCellRef, UnitCellMut};
+use property::{Property, RawProperty, PropertiesIter};
+
+/// A `Frame` contains data from one simulation step: the current unit
+/// cell, the topology, the positions, and the velocities of the particles in
+/// the system. If some information is missing (topology or velocity or unit
+/// cell), the corresponding data is filled with a default value.
+pub struct Frame {
+    handle: *mut CHFL_FRAME,
+}
+
+impl Clone for Frame {
+    fn clone(&self) -> Frame {
+        unsafe {
+            let new_handle = chfl_frame_copy(self.as_ptr());
+            Frame::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Frame {
+    /// Create a `Frame` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_FRAME) -> Frame {
+        check_not_null(ptr);
+        Frame {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Create an empty frame. It will be resized by the library as needed.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    ///
+    /// assert_eq!(frame.size(), 0);
+    /// ```
+    pub fn new() -> Frame {
+        unsafe {
+            Frame::from_ptr(chfl_frame())
+        }
+    }
+
+    /// Get a reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// let atom = frame.atom(0);
+    /// assert_eq!(atom.name(), "Zn");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_frame(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// assert_eq!(frame.atom(0).name(), "Zn");
+    ///
+    /// frame.atom_mut(0).set_name("Fe");
+    /// assert_eq!(frame.atom(0).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_frame(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.size(), 0);
+    ///
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_frame_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize the positions and the velocities in this frame, to make space for
+    /// `natoms` atoms. Previous data is conserved, as well as the presence of
+    /// absence of velocities.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_frame_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` and the corresponding position and optionally velocity
+    /// data to this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+    ///
+    /// frame.add_velocities();
+    /// frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+    /// ```
+    pub fn add_atom(
+        &mut self,
+        atom: &Atom,
+        position: [f64; 3],
+        velocity: impl Into<Option<[f64; 3]>>,
+    )
+    {
+        let velocity = velocity.into();
+        let velocity_ptr = match velocity {
+            Some(ref data) => data.as_ptr(),
+            None => ptr::null(),
+        };
+
+        unsafe {
+            check_success(chfl_frame_add_atom(
+                self.as_mut_ptr(),
+                atom.as_ptr(),
+                position.as_ptr(),
+                velocity_ptr
+            ));
+        }
+
+    }
+
+    /// Remove the atom at index `i` in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+    /// assert_eq!(frame.size(), 3);
+    ///
+    /// frame.remove(1);
+    /// assert_eq!(frame.size(), 2);
+    /// assert_eq!(frame.atom(1).name(), "Sn");
+    /// ```
+    pub fn remove(&mut self, i: usize) {
+        unsafe {
+            check_success(chfl_frame_remove(self.as_mut_ptr(), i as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    /// assert_eq!(frame.topology().bonds_count(), 3);
+    ///
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+    /// assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(2);
+    ///
+    /// frame.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_frame_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// the frame.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    ///
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+    ///
+    /// frame.remove_bond(2, 4);
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_remove_bond(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+            ));
+        }
+    }
+
+    /// Add a copy of `residue` to this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue id is already in this frame's
+    /// topology, or if the residue contain atoms that are already in another
+    /// residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Residue};
+    /// let mut frame = Frame::new();
+    ///
+    /// let residue = Residue::new("foo");
+    /// frame.add_residue(&residue).unwrap();
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.residues_count(), 1);
+    /// assert_eq!(topology.residue(0).unwrap().name(), "foo");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Get the distance between the atoms at indexes `i` and `j` in this frame,
+    /// accounting for periodic boundary conditions. The result is expressed in
+    /// Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+    ///
+    /// assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+    /// ```
+    pub fn distance(&self, i: usize, j: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_distance(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get the angle formed by the atoms at indexes `i`, `j` and `k` in this
+    /// frame, accounting for periodic boundary conditions. The result is
+    /// expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+    /// ```
+    pub fn angle(&self, i: usize, j: usize, k: usize) -> f64 {
+        let mut angle = 0.0;
+        unsafe {
+            check_success(chfl_frame_angle(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                &mut angle,
+            ));
+        }
+        return angle;
+    }
+
+    /// Get the dihedral angle formed by the atoms at indexes `i`, `j`, `k` and
+    /// `m` in this frame, accounting for periodic boundary conditions. The
+    /// result is expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+    ///
+    /// assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+    /// ```
+    pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut dihedral = 0.0;
+        unsafe {
+            check_success(chfl_frame_dihedral(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut dihedral,
+            ));
+        }
+        return dihedral;
+    }
+
+    /// Get the out of plane distance formed by the atoms at indexes `i`, `j`,
+    /// `k` and `m` in this frame, accounting for periodic boundary conditions.
+    /// The result is expressed in angstroms.
+    ///
+    /// This is the distance between the atom j and the ikm plane. The j atom
+    /// is the center of the improper dihedral angle formed by i, j, k and m.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+    /// frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+    /// ```
+    pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_out_of_plane(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get a view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions.len(), 67);
+    /// assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn positions(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms
+            ));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// {
+    ///     let positions = frame.positions_mut();
+    ///     assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    ///     positions[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn positions_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Get a view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    ///
+    /// let velocities = frame.velocities();
+    /// assert_eq!(velocities.len(), 67);
+    /// assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn velocities(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    /// {
+    ///     let velocities = frame.velocities_mut();
+    ///     assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    ///     velocities[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let velocities = frame.velocities();
+    /// assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn velocities_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Check if this frame contains velocity data.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn has_velocities(&self) -> bool {
+        let mut res = 0;
+        unsafe {
+            check_success(chfl_frame_has_velocities(self.as_ptr(), &mut res));
+        }
+        return res != 0;
+    }
+
+    /// Add velocity data to this frame. If the frame already have velocities,
+    /// this does nothing.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn add_velocities(&mut self) {
+        unsafe {
+            check_success(chfl_frame_add_velocities(self.as_mut_ptr()));
+        }
+    }
+
+    /// Get a reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let frame = Frame::new();
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn cell(&self) -> UnitCellRef {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW());
+            UnitCell::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// assert_eq!(frame.cell().shape(), CellShape::Infinite);
+    ///
+    /// frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+    /// ```
+    pub fn cell_mut(&mut self) -> UnitCellMut {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr());
+            UnitCell::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Set the `UnitCell` of this frame to `cell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, UnitCell, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_frame_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get a reference to the `Topology` of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(42);
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.size(), 42);
+    /// ```
+    pub fn topology(&self) -> TopologyRef {
+        unsafe {
+            let handle = chfl_topology_from_frame(self.as_ptr());
+            Topology::ref_from_ptr(handle)
+        }
+    }
+
+    /// Set the `Topology` of this frame to `topology`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology contains a different number of atoms
+    /// than this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Topology, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.resize(2);
+    ///
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_bond(0, 1);
+    ///
+    /// frame.set_topology(&topology).unwrap();
+    /// assert_eq!(frame.atom(0).name(), "Cl");
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_set_topology(self.as_mut_ptr(), topology.as_ptr()))
+        }
+    }
+
+    /// Get this frame step, i.e. the frame number in the trajectory
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    /// ```
+    pub fn step(&self) -> usize {
+        let mut step = 0;
+        unsafe {
+            check_success(chfl_frame_step(self.as_ptr(), &mut step));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return step as usize;
+    }
+
+    /// Set this frame step to `step`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    ///
+    /// frame.set_step(10);
+    /// assert_eq!(frame.step(), 10);
+    /// ```
+    pub fn set_step(&mut self, step: usize) {
+        unsafe {
+            check_success(chfl_frame_set_step(self.as_mut_ptr(), step as u64));
+        }
+    }
+
+    /// Guess the bonds, angles and dihedrals in this `frame`.
+    ///
+    /// The bonds are guessed using a distance-based algorithm, and then angles
+    /// and dihedrals are guessed from the bonds.
+    ///
+    /// # Errors
+    ////
+    /// This function can fail if the covalent radius is unknown for some atoms
+    /// in the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    ///
+    /// frame.guess_bonds().unwrap();
+    /// assert_eq!(frame.topology().bonds_count(), 1);
+    /// ```
+    pub fn guess_bonds(&mut self) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_guess_bonds(self.as_mut_ptr()))
+        }
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology of the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, Frame};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(1, 2);
+    ///
+    /// assert_eq!(frame.topology().bonds().len(), 2);
+    /// assert_eq!(frame.topology().angles().len(), 1);
+    ///
+    /// frame.clear_bonds();
+    /// assert!(frame.topology().bonds().is_empty());
+    /// assert!(frame.topology().angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_frame_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a new `property` with the given `name` to this frame.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("a string", "hello");
+    /// frame.set("a double", 4.3);
+    ///
+    /// assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_frame_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(frame.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_frame_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    /// frame.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in frame.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_frame_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_frame_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Frame {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Topology, UnitCell};
+
+    #[test]
+    fn clone() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+        let copy = frame.clone();
+        assert_eq!(copy.size(), 0);
+
+        frame.resize(42);
+        assert_eq!(frame.size(), 42);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+
+        frame.resize(12);
+        assert_eq!(frame.size(), 12);
+    }
+
+    #[test]
+    fn add_atom() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        let positions = &[[1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        frame.add_velocities();
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], [4.0, 3.0, 2.0]);
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+        assert_eq!(frame.atom(1).name(), "F");
+
+        let positions = &[[1.0, 1.0, 2.0], [1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        let velocities = &[[0.0, 0.0, 0.0], [4.0, 3.0, 2.0]];
+        assert_eq!(frame.velocities(), velocities);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_atom() {
+        let mut frame = Frame::new();
+        frame.resize(22);
+        let _atom = frame.atom(23);
+    }
+
+    #[test]
+    fn remove_atom() {
+        let mut frame = Frame::new();
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], None);
+
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        frame.remove(0);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "F");
+    }
+
+    #[test]
+    #[should_panic]
+    fn remove_out_of_bounds() {
+        let mut frame = Frame::new();
+        frame.resize(32);
+
+        frame.remove(100);
+    }
+
+    #[test]
+    fn positions() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.positions_mut().clone_from_slice(expected);
+        assert_eq!(frame.positions(), expected);
+    }
+
+    #[test]
+    fn velocities() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        assert!(!frame.has_velocities());
+        frame.add_velocities();
+        assert!(frame.has_velocities());
+
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.velocities_mut().clone_from_slice(expected);
+        assert_eq!(frame.velocities(), expected);
+    }
+
+    #[test]
+    fn cell() {
+        let mut frame = Frame::new();
+        frame.set_cell(&UnitCell::new([3.0, 4.0, 5.0]));
+        let cell = frame.cell();
+        assert_eq!(cell.lengths(), [3.0, 4.0, 5.0]);
+    }
+
+    #[test]
+    fn topology() {
+        let mut frame = Frame::new();
+        frame.resize(2);
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Zn"));
+        topology.add_atom(&Atom::new("Ar"));
+
+        assert!(frame.set_topology(&topology).is_ok());
+
+        let topology = frame.topology();
+
+        assert_eq!(topology.atom(0).name(), "Zn");
+        assert_eq!(topology.atom(1).name(), "Ar");
+
+        assert_eq!(frame.atom(0).name(), "Zn");
+        assert_eq!(frame.atom(1).name(), "Ar");
+    }
+
+    #[test]
+    fn bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        assert_eq!(frame.topology().bonds_count(), 0);
+
+        frame.add_bond(0, 1);
+        frame.add_bond(9, 2);
+        frame.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(frame.topology().bonds_count(), 3);
+
+        assert_eq!(frame.topology().bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(frame.topology().bond_orders(), expected);
+
+        assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(frame.topology().bond_order(3, 7), BondOrder::Aromatic);
+
+        frame.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        frame.remove_bond(8, 7);
+        assert_eq!(frame.topology().bonds_count(), 2);
+
+        frame.clear_bonds();
+        assert_eq!(frame.topology().bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn residues() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.topology().residues_count(), 0);
+
+        let residue = &Residue::new("foobar");
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+
+        assert_eq!(frame.topology().residues_count(), 3);
+        assert_eq!(frame.topology().residue(0).unwrap().name(), "foobar");
+    }
+
+    #[test]
+    fn step() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.step(), 0);
+        frame.set_step(42);
+        assert_eq!(frame.step(), 42);
+    }
+
+    #[test]
+    fn property() {
+        let mut frame = Frame::new();
+        frame.set("foo", -22.0);
+        assert_eq!(frame.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(frame.get("bar"), None);
+
+        frame.set("bar", Property::String("here".into()));
+        for (name, property) in frame.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+
+    #[test]
+    fn pbc_geometry() {
+        use std::f64::consts::PI;
+
+        let mut frame = Frame::new();
+        let atom = &Atom::new("");
+
+        frame.add_atom(atom, [1.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 1.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 2.0], None);
+
+        assert_eq!(frame.distance(0, 2), f64::sqrt(2.0));
+        assert_eq!(frame.angle(0, 1, 2), PI / 2.0);
+        assert_eq!(frame.dihedral(0, 1, 2, 3), PI / 2.0);
+        assert_eq!(frame.out_of_plane(1, 4, 0, 2), 2.0);
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/lib.rs.html b/0.10.2/doc/src/chemfiles/lib.rs.html new file mode 100644 index 000000000..10b9c7ba0 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/lib.rs.html @@ -0,0 +1,284 @@ +lib.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! Chemfiles is a multi-language library written in modern C++ for reading and
+//! writing from and to molecular trajectory files. These files are created by
+//! your favorite theoretical chemistry program, and contains information about
+//! atomic or residues names and positions. Some format also have additional
+//! information, such as velocities, forces, energy, …
+//!
+//! This crate expose the C API of chemfiles to Rust, and make all the
+//! functionalities accessible. For more information on the C++ library,
+//! please see its [documentation][cxx_doc]. Specifically, the following pages
+//! are worth reading:
+//!
+//! - The [overview][overview] of the classes organization;
+//! - The list of [supported formats][formats];
+//! - The documentation for the [selection language][selections];
+//!
+//! [cxx_doc]: https://chemfiles.org/chemfiles
+//! [overview]: https://chemfiles.org/chemfiles/latest/overview.html
+//! [formats]: https://chemfiles.org/chemfiles/latest/formats.html
+//! [selections]: https://chemfiles.org/chemfiles/latest/selections.html
+
+#![deny(missing_docs)]
+#![warn(trivial_casts, unused_import_braces, variant_size_differences)]
+#![warn(unused_results)]
+// Configuration for clippy lints
+#![warn(clippy::all, clippy::pedantic)]
+#![allow(clippy::needless_return, clippy::module_name_repetitions)]
+#![allow(clippy::must_use_candidate, clippy::wildcard_imports)]
+
+// Allow a few more clippy lints in test mode
+#![cfg_attr(test, allow(clippy::float_cmp, clippy::unreadable_literal, clippy::shadow_unrelated))]
+
+// deny(warnings) in doc tests
+#![doc(test(attr(deny(warnings))))]
+#![doc(test(attr(allow(unused_variables))))]
+
+#[cfg(test)]
+#[macro_use]
+extern crate approx;
+
+extern crate chemfiles_sys;
+use chemfiles_sys::{chfl_add_configuration, chfl_version};
+
+mod strings;
+
+mod errors;
+pub use errors::{Error, Status};
+pub use errors::set_warning_callback;
+
+mod atom;
+pub use atom::Atom;
+pub use atom::AtomRef;
+pub use atom::AtomMut;
+
+mod cell;
+pub use cell::UnitCell;
+pub use cell::UnitCellRef;
+pub use cell::UnitCellMut;
+pub use cell::CellShape;
+
+mod residue;
+pub use residue::Residue;
+pub use residue::ResidueRef;
+
+mod topology;
+pub use topology::Topology;
+pub use topology::TopologyRef;
+pub use topology::BondOrder;
+
+mod frame;
+pub use frame::Frame;
+
+mod trajectory;
+pub use trajectory::Trajectory;
+
+mod selection;
+pub use selection::{Match, Selection};
+
+mod property;
+pub use property::Property;
+pub use property::PropertiesIter;
+
+mod misc;
+pub use misc::{FormatMetadata, formats_list, guess_format};
+
+/// Get the version of the chemfiles library.
+///
+/// # Example
+/// ```
+/// let version = chemfiles::version();
+/// assert!(version.starts_with("0.10"));
+/// ```
+pub fn version() -> String {
+    unsafe { strings::from_c(chfl_version()) }
+}
+
+/// Read configuration data from the file at `path`.
+///
+/// By default, chemfiles reads configuration from any file named
+/// `.chemfiles.toml` in the current directory or any parent directory. This
+/// function can be used to add data from another configuration file. Data from
+/// the new configuration file will overwrite any existing data.
+///
+/// # Errors
+///
+/// This function will fail if there is no file at `path`, or if the file is
+/// incorrectly formatted.
+///
+/// # Example
+/// ```no_run
+/// chemfiles::add_configuration("local-config.toml").unwrap();
+/// // from now on, the data from "local-config.toml" will be used
+/// ```
+pub fn add_configuration<S>(path: S) -> Result<(), Error>
+where
+    S: AsRef<str>,
+{
+    let buffer = strings::to_c(path.as_ref());
+    unsafe {
+        errors::check(chfl_add_configuration(buffer.as_ptr()))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    fn version() {
+        assert!(!crate::version().is_empty());
+        assert!(crate::version().starts_with("0.10"));
+    }
+}
+
+#[cfg(test)]
+fn assert_vector3d_eq(lhs: &[f64; 3], rhs: &[f64; 3], eps: f64) {
+    lhs.iter()
+        .zip(rhs)
+        .for_each(|(l, r)| assert_ulps_eq!(l, r, epsilon = eps));
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/misc.rs.html b/0.10.2/doc/src/chemfiles/misc.rs.html new file mode 100644 index 000000000..407f737fe --- /dev/null +++ b/0.10.2/doc/src/chemfiles/misc.rs.html @@ -0,0 +1,276 @@ +misc.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2020 Guillaume Fraux -- BSD licensed
+
+use std::convert::TryInto;
+use std::ffi::CStr;
+
+use chemfiles_sys::{chfl_format_metadata, chfl_formats_list, chfl_free, chfl_guess_format};
+use errors::check_success;
+
+/// `FormatMetadata` contains metadata associated with one format.
+#[allow(clippy::struct_excessive_bools)]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct FormatMetadata {
+    /// Name of the format.
+    pub name: &'static str,
+    /// Extension associated with the format.
+    pub extension: Option<&'static str>,
+    /// Extended, user-facing description of the format.
+    pub description: &'static str,
+    /// URL pointing to the format definition/reference.
+    pub reference: &'static str,
+    /// Is reading files in this format implemented?
+    pub read: bool,
+    /// Is writing files in this format implemented?
+    pub write: bool,
+    /// Does this format support in-memory IO?
+    pub memory: bool,
+    /// Does this format support storing atomic positions?
+    pub positions: bool,
+    /// Does this format support storing atomic velocities?
+    pub velocities: bool,
+    /// Does this format support storing unit cell information?
+    pub unit_cell: bool,
+    /// Does this format support storing atom names or types?
+    pub atoms: bool,
+    /// Does this format support storing bonds between atoms?
+    pub bonds: bool,
+    /// Does this format support storing residues?
+    pub residues: bool,
+}
+
+impl FormatMetadata {
+    pub(crate) fn from_raw(raw: &chfl_format_metadata) -> Self {
+        let str_from_ptr = |ptr| unsafe {
+            CStr::from_ptr(ptr)
+                .to_str()
+                .expect("Invalid Rust str from C")
+        };
+        let extension = if raw.extension.is_null() {
+            None
+        } else {
+            Some(str_from_ptr(raw.extension))
+        };
+        Self {
+            name: str_from_ptr(raw.name),
+            extension,
+            description: str_from_ptr(raw.description),
+            reference: str_from_ptr(raw.reference),
+            read: raw.read,
+            write: raw.write,
+            memory: raw.memory,
+            positions: raw.positions,
+            velocities: raw.velocities,
+            unit_cell: raw.unit_cell,
+            atoms: raw.atoms,
+            bonds: raw.bonds,
+            residues: raw.residues,
+        }
+    }
+}
+
+/// Get the list of formats known by chemfiles, as well as all associated metadata.
+///
+/// # Example
+/// ```
+/// let formats = chemfiles::formats_list();
+/// println!("chemfiles supports {} formats:", formats.len());
+/// for format in &formats {
+///     println!(
+///         "   {:<15} {}",
+///         format.name,
+///         format.extension.as_deref().unwrap_or("")
+///     );
+/// }
+/// ```
+#[must_use]
+pub fn formats_list() -> Vec<FormatMetadata> {
+    let mut formats = std::ptr::null_mut();
+    let mut count: u64 = 0;
+    let formats_slice = unsafe {
+        check_success(chfl_formats_list(&mut formats, &mut count));
+        std::slice::from_raw_parts(formats, count.try_into().expect("failed to convert u64 to usize"))
+    };
+    let formats_vec = formats_slice
+        .iter()
+        .map(|fm| FormatMetadata::from_raw(fm))
+        .collect();
+    unsafe {
+        let _ = chfl_free(formats as *const _);
+    }
+    return formats_vec;
+}
+
+#[allow(clippy::doc_markdown)]
+/// Get the format that chemfiles would use to read a file at the given
+/// ``path``.
+///
+/// The format is mostly guessed from the path extension, chemfiles only tries
+/// to read the file to distinguish between CIF and mmCIF files. Opening the
+/// file using the returned format string might still fail. For example, it will
+/// fail if the file is not actually formatted according to the guessed format;
+/// or the format/compression combination is not supported (e.g. `XTC / GZ` will
+/// not work since the XTC reader does not support compressed files).
+///
+/// The returned format is represented in a way compatible with the various
+/// `Trajectory` constructors, i.e. `"<format name> [/ <compression>]"`, where
+/// compression is optional.
+///
+/// # Examples
+/// ```
+/// let format = chemfiles::guess_format("trajectory.xyz.xz");
+/// assert_eq!(format, "XYZ / XZ");
+///
+/// let format = chemfiles::guess_format("trajectory.nc");
+/// assert_eq!(format, "Amber NetCDF");
+/// ```
+pub fn guess_format(path: &str) -> String {
+    let path = crate::strings::to_c(path);
+    let mut buffer = vec![0; 128];
+    unsafe {
+        check_success(chfl_guess_format(
+            path.as_ptr(), buffer.as_mut_ptr(), buffer.len() as u64
+        ));
+    }
+    return crate::strings::from_c(buffer.as_ptr());
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/property.rs.html b/0.10.2/doc/src/chemfiles/property.rs.html new file mode 100644 index 000000000..b3bc3f096 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/property.rs.html @@ -0,0 +1,584 @@ +property.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::vec::IntoIter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use strings;
+
+/// A thin wrapper around `CHFL_PROPERTY`
+pub(crate) struct RawProperty {
+    handle: *mut CHFL_PROPERTY,
+}
+
+impl RawProperty {
+    /// Create a `RawProperty` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    pub unsafe fn from_ptr(ptr: *mut CHFL_PROPERTY) -> RawProperty {
+        check_not_null(ptr);
+        RawProperty {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    pub fn as_ptr(&self) -> *const CHFL_PROPERTY {
+        self.handle
+    }
+
+    fn double(value: f64) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_double(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn bool(value: bool) -> RawProperty {
+        let value = if value { 1 } else { 0 };
+        unsafe {
+            let handle = chfl_property_bool(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn vector3d(value: [f64; 3]) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_vector3d(value.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn string(value: &str) -> RawProperty {
+        let buffer = strings::to_c(value);
+        unsafe {
+            let handle = chfl_property_string(buffer.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn get_kind(&self) -> chfl_property_kind {
+        let mut kind = chfl_property_kind::CHFL_PROPERTY_BOOL;
+        unsafe {
+            check_success(chfl_property_get_kind(self.as_ptr(), &mut kind));
+        }
+        return kind;
+    }
+
+    fn get_bool(&self) -> Result<bool, Error> {
+        let mut value = 0;
+        unsafe {
+            check(chfl_property_get_bool(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value != 0);
+    }
+
+    fn get_double(&self) -> Result<f64, Error> {
+        let mut value = 0.0;
+        unsafe {
+            check(chfl_property_get_double(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value);
+    }
+
+    fn get_string(&self) -> Result<String, Error> {
+        let get_string = |ptr, len| unsafe { chfl_property_get_string(self.as_ptr(), ptr, len) };
+        let value = strings::call_autogrow_buffer(64, get_string)?;
+        return Ok(strings::from_c(value.as_ptr()));
+    }
+
+    fn get_vector3d(&self) -> Result<[f64; 3], Error> {
+        let mut value = [0.0; 3];
+        unsafe {
+            check(chfl_property_get_vector3d(self.as_ptr(), value.as_mut_ptr()))?;
+        }
+        return Ok(value);
+    }
+}
+
+impl Drop for RawProperty {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+/// A `Property` is a piece of data that can be associated with an `Atom` or a
+/// `Frame`.
+#[derive(Debug, Clone, PartialEq, PartialOrd)]
+pub enum Property {
+    /// Boolean property
+    Bool(bool),
+    /// Floating point property
+    Double(f64),
+    /// String property
+    String(String),
+    /// 3-dimensional vector property
+    Vector3D([f64; 3]),
+}
+
+impl From<bool> for Property {
+    fn from(value: bool) -> Self {
+        Property::Bool(value)
+    }
+}
+
+impl From<f64> for Property {
+    fn from(value: f64) -> Self {
+        Property::Double(value)
+    }
+}
+
+impl From<String> for Property {
+    fn from(value: String) -> Self {
+        Property::String(value)
+    }
+}
+
+impl<'a> From<&'a str> for Property {
+    fn from(value: &'a str) -> Self {
+        Property::String(value.into())
+    }
+}
+
+impl From<[f64; 3]> for Property {
+    fn from(value: [f64; 3]) -> Self {
+        Property::Vector3D(value)
+    }
+}
+
+impl Property {
+    pub(crate) fn as_raw(&self) -> RawProperty {
+        match *self {
+            Property::Bool(value) => RawProperty::bool(value),
+            Property::Double(value) => RawProperty::double(value),
+            Property::String(ref value) => RawProperty::string(value),
+            Property::Vector3D(value) => RawProperty::vector3d(value),
+        }
+    }
+
+    #[allow(clippy::needless_pass_by_value)]  // raw property
+    pub(crate) fn from_raw(raw: RawProperty) -> Property {
+        match raw.get_kind() {
+            chfl_property_kind::CHFL_PROPERTY_BOOL => {
+                Property::Bool(raw.get_bool().expect("shoudl be a bool"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_DOUBLE => {
+                Property::Double(raw.get_double().expect("should be a double"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_STRING => {
+                Property::String(raw.get_string().expect("should be a string"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_VECTOR3D => {
+                Property::Vector3D(raw.get_vector3d().expect("should be a vector3d"))
+            }
+        }
+    }
+}
+
+/// An iterator over the properties in an atom/frame/residue
+pub struct PropertiesIter<'a> where  {
+    pub(crate) names: IntoIter<String>,
+    pub(crate) getter: Box<dyn Fn(&str) -> Property + 'a>,
+}
+
+impl<'a> Iterator for PropertiesIter<'a> {
+    type Item = (String, Property);
+    fn next(&mut self) -> Option<Self::Item> {
+        self.names.next().map(|name| {
+            let property = (self.getter)(&*name);
+            (name, property)
+        })
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.names.size_hint()
+    }
+
+    fn count(self) -> usize {
+        self.names.count()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    mod raw {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = RawProperty::bool(false);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(property.get_bool(), Ok(false));
+        }
+
+        #[test]
+        fn double() {
+            let property = RawProperty::double(45.0);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(property.get_double(), Ok(45.0));
+        }
+
+        #[test]
+        fn string() {
+            let property = RawProperty::string("test");
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(property.get_string(), Ok("test".into()));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = RawProperty::vector3d([1.2, 3.4, 5.6]);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(property.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+        }
+    }
+
+    mod rust {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = Property::Bool(false);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(raw.get_bool(), Ok(false));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn double() {
+            let property = Property::Double(45.0);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(raw.get_double(), Ok(45.0));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn string() {
+            let property = Property::String("test".into());
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(raw.get_string(), Ok("test".into()));
+
+            assert_eq!(Property::from_raw(raw), property);
+
+            let property = Property::String("long string ".repeat(128));
+            let raw = property.as_raw();
+            assert_eq!(raw.get_string(), Ok("long string ".repeat(128)));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = Property::Vector3D([1.2, 3.4, 5.6]);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(raw.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/residue.rs.html b/0.10.2/doc/src/chemfiles/residue.rs.html new file mode 100644 index 000000000..c569f85b5 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/residue.rs.html @@ -0,0 +1,826 @@ +residue.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_not_null, check_success};
+use property::{Property, RawProperty, PropertiesIter};
+use strings;
+
+/// A `Residue` is a group of atoms belonging to the same logical unit. They
+/// can be small molecules, amino-acids in a protein, monomers in polymers,
+/// *etc.*
+pub struct Residue {
+    handle: *mut CHFL_RESIDUE,
+}
+
+/// An analog to a reference to a residue (`&Residue`)
+pub struct ResidueRef<'a> {
+    inner: Residue,
+    marker: PhantomData<&'a Residue>
+}
+
+impl<'a> Deref for ResidueRef<'a> {
+    type Target = Residue;
+    fn deref(&self) -> &Residue {
+        &self.inner
+    }
+}
+
+impl Clone for Residue {
+    fn clone(&self) -> Residue {
+        unsafe {
+            let new_handle = chfl_residue_copy(self.as_ptr());
+            Residue::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Residue {
+    /// Create a `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_RESIDUE) -> Residue {
+        check_not_null(ptr);
+        Residue {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_RESIDUE) -> ResidueRef<'a> {
+        ResidueRef {
+            inner: Residue::from_ptr(ptr as *mut CHFL_RESIDUE),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Create a new residue with the given `name`
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("ALA");
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), None);
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue(buffer.as_ptr());
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Create a new residue with the given `name` and `id` as identifier.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("ALA", 67);
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), Some(67));
+    /// ```
+    pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue_with_id(buffer.as_ptr(), id);
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Get the number of atoms in this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    ///
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// assert_eq!(residue.size(), 3);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_residue_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the identifier of this residue in the initial topology file.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("", 42);
+    /// assert_eq!(residue.id(), Some(42));
+    /// ```
+    pub fn id(&self) -> Option<i64> {
+        let mut resid = 0;
+        let status = unsafe {
+            chfl_residue_id(self.as_ptr(), &mut resid)
+        };
+
+        if status == chfl_status::CHFL_SUCCESS {
+            return Some(resid);
+        } else if status == chfl_status::CHFL_GENERIC_ERROR {
+            return None;
+        }
+
+        // call check_success to panic in case of error
+        check_success(status);
+        unreachable!();
+    }
+
+    /// Get the name of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("water");
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_residue_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(64, get_name).expect("getting residue name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Add the atom at index `atom` in this residue.
+    ///
+    /// This will fail if the atom is already in the residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// assert_eq!(residue.contains(56), true);
+    ///
+    /// // Adding the same atom twice is fine
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// ```
+    pub fn add_atom(&mut self, atom: usize) {
+        unsafe {
+            check_success(chfl_residue_add_atom(self.as_mut_ptr(), atom as u64));
+        }
+    }
+
+    /// Check if the atom at index `i` is in this residue
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.contains(56), true);
+    /// ```
+    pub fn contains(&self, atom: usize) -> bool {
+        let mut inside = 0;
+        unsafe {
+            check_success(chfl_residue_contains(self.as_ptr(), atom as u64, &mut inside));
+        }
+        return inside != 0;
+    }
+
+    /// Get the list of atoms of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.atoms(), vec![]);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.atoms(), vec![56]);
+    /// ```
+    pub fn atoms(&self) -> Vec<usize> {
+        let size = self.size();
+        let count = size as u64;
+        let mut indices = vec![u64::max_value(); size];
+        unsafe {
+            check_success(chfl_residue_atoms(
+                self.as_ptr(),
+                indices.as_mut_ptr(),
+                count,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return indices.into_iter().map(|idx| idx as usize).collect();
+    }
+
+    /// Add a new `property` with the given `name` to this residue.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("a string", "hello");
+    /// residue.set("a double", 3.2);
+    ///
+    /// assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_residue_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(residue.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_residue_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    /// residue.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in residue.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_residue_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_residue_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Residue {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        let copy = residue.clone();
+        assert_eq!(copy.size(), 0);
+
+        residue.add_atom(3);
+        residue.add_atom(7);
+        assert_eq!(residue.size(), 2);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn name() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.name(), "A");
+    }
+
+    #[test]
+    fn id() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.id(), None);
+
+        let residue = Residue::with_id("A", 42);
+        assert_eq!(residue.id(), Some(42));
+
+        let residue = Residue::with_id("A", -3);
+        assert_eq!(residue.id(), Some(-3));
+    }
+
+    #[test]
+    fn atoms() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        residue.add_atom(0);
+        residue.add_atom(3);
+        residue.add_atom(45);
+        assert_eq!(residue.size(), 3);
+
+        assert!(residue.contains(3));
+        assert!(!residue.contains(5));
+
+        assert_eq!(residue.atoms(), vec![0, 3, 45]);
+    }
+
+    #[test]
+    fn property() {
+        let mut residue = Residue::new("ALA");
+
+        residue.set("foo", -22.0);
+        assert_eq!(residue.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(residue.get("bar"), None);
+
+        residue.set("bar", Property::String("here".into()));
+        for (name, property) in residue.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/selection.rs.html b/0.10.2/doc/src/chemfiles/selection.rs.html new file mode 100644 index 000000000..20a4b6543 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/selection.rs.html @@ -0,0 +1,860 @@ +selection.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Index};
+use std::iter::IntoIterator;
+use std::slice::Iter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error, Status};
+use strings;
+use frame::Frame;
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+/// A `Match` is a set of atomic indexes matching a given selection. It can
+/// mostly be used like a `&[usize]`.
+pub struct Match {
+    size: usize,
+    atoms: [usize; 4],
+}
+
+#[allow(clippy::len_without_is_empty)]
+impl Match {
+    /// Get the length of the Match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// ```
+    pub fn len(&self) -> usize {
+        self.size
+    }
+
+    /// Create a new match containing the atoms in the `atoms` slice.
+    ///
+    /// # Panics
+    ///
+    /// If the slice contains more than 4 elements, which is the maximal size
+    /// of a match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// assert_eq!(atomic_match[0], 3);
+    /// assert_eq!(atomic_match[1], 4);
+    /// assert_eq!(atomic_match[2], 5);
+    /// ```
+    pub fn new(atoms: &[usize]) -> Match {
+        assert!(atoms.len() <= 4);
+        let size = atoms.len();
+        let mut matches = [usize::max_value(); 4];
+        for (i, atom) in atoms.iter().enumerate() {
+            matches[i] = *atom;
+        }
+        Match {
+            size,
+            atoms: matches,
+        }
+    }
+
+    /// Iterate over the atomic indexes in the match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// let mut iter = atomic_match.iter();
+    ///
+    /// assert_eq!(iter.next(), Some(&3));
+    /// assert_eq!(iter.next(), Some(&4));
+    /// assert_eq!(iter.next(), Some(&5));
+    /// assert_eq!(iter.next(), None);
+    /// ```
+    pub fn iter(&self) -> Iter<usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+impl Index<usize> for Match {
+    type Output = usize;
+    fn index(&self, i: usize) -> &Self::Output {
+        assert!(i < self.len());
+        &self.atoms[i]
+    }
+}
+
+impl<'a> IntoIterator for &'a Match {
+    type Item = &'a usize;
+    type IntoIter = Iter<'a, usize>;
+    fn into_iter(self) -> Iter<'a, usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+/// A `Selection` allow to select atoms in a `Frame`, from a selection
+/// language. The selection language is built by combining basic operations.
+/// Each basic operation follows the `<selector>[(<variable>)] <operator>
+/// <value>` structure, where `<operator>` is a comparison operator in
+/// `== != < <= > >=`.
+pub struct Selection {
+    handle: *mut CHFL_SELECTION,
+}
+
+impl Clone for Selection {
+    fn clone(&self) -> Selection {
+        unsafe {
+            let new_handle = chfl_selection_copy(self.as_ptr());
+            Selection::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Drop for Selection {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl Selection {
+    /// Create a `Selection` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_SELECTION) -> Selection {
+        check_not_null(ptr);
+        Selection {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Create a new selection from the given selection string.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the selection string is invalid.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// ```
+    pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error> {
+        let buffer = strings::to_c(selection.into());
+        unsafe {
+            let handle = chfl_selection(buffer.as_ptr());
+            if handle.is_null() {
+                Err(Error {
+                    status: Status::SelectionError,
+                    message: Error::last_error()
+                })
+            } else {
+                Ok(Selection::from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the size of the selection, i.e. the number of atoms we are selecting
+    /// together.
+    ///
+    /// This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond'
+    /// context, 3 for the 'three' and 'angles' context and 4 for the 'four'
+    /// and 'dihedral' context.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// assert_eq!(selection.size(), 2);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_selection_size(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the selection string used to create this selection.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("name H").unwrap();
+    /// assert_eq!(selection.string(), "name H");
+    /// ```
+    pub fn string(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_selection_string(self.as_ptr(), ptr, len) };
+        let selection = strings::call_autogrow_buffer(1024, get_string).expect("failed to get selection string");
+        return strings::from_c(selection.as_ptr());
+    }
+
+    /// Evaluate a selection for a given frame, and return the corresponding
+    /// matches.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// let matches = selection.evaluate(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    ///
+    /// assert_eq!(matches[0].len(), 2);
+    /// assert_eq!(matches[0][0], 0);
+    /// assert_eq!(matches[0][1], 1);
+    ///
+    /// assert_eq!(matches[1].len(), 2);
+    /// assert_eq!(matches[1][0], 2);
+    /// assert_eq!(matches[1][1], 1);
+    /// ```
+    pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match> {
+        #![allow(clippy::cast_possible_truncation)]
+        let mut count = 0;
+        unsafe {
+            check(chfl_selection_evaluate(
+                self.as_mut_ptr(), frame.as_ptr(), &mut count
+            )).expect("failed to evaluate selection");
+        }
+
+        let size = count as usize;
+        let mut chfl_matches = vec![chfl_match { size: 0, atoms: [0; 4] }; size];
+        unsafe {
+            check(chfl_selection_matches(
+                self.handle,
+                chfl_matches.as_mut_ptr(),
+                count
+            )).expect("failed to extract matches");
+        }
+
+        return chfl_matches.into_iter()
+            .map(|chfl_match| Match {
+                size: chfl_match.size as usize,
+                atoms: [
+                    chfl_match.atoms[0] as usize,
+                    chfl_match.atoms[1] as usize,
+                    chfl_match.atoms[2] as usize,
+                    chfl_match.atoms[3] as usize,
+                ],
+            })
+            .collect();
+    }
+
+    /// Evaluates a selection of size 1 on a given `frame`. This function
+    /// returns the list of atomic indexes in the frame matching this selection.
+    ///
+    /// # Panics
+    ///
+    /// If the selection size is not 1
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("name H").unwrap();
+    /// let matches = selection.list(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    /// assert_eq!(matches[0], 0);
+    /// assert_eq!(matches[1], 2);
+    /// ```
+    pub fn list(&mut self, frame: &Frame) -> Vec<usize> {
+        if self.size() != 1 {
+            panic!("can not call `Selection::list` on a multiple selection");
+        }
+        return self.evaluate(frame)
+            .into_iter()
+            .map(|m| m[0] as usize)
+            .collect();
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use Frame;
+    use Topology;
+    use Atom;
+
+    #[test]
+    fn clone() {
+        let selection = Selection::new("name H").unwrap();
+
+        let copy = selection.clone();
+        assert_eq!(selection.size(), 1);
+        assert_eq!(copy.size(), 1);
+    }
+
+    fn testing_frame() -> Frame {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("H"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("H"));
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(2, 3);
+
+        let mut frame = Frame::new();
+        frame.resize(4);
+        frame.set_topology(&topology).unwrap();
+        return frame;
+    }
+
+    mod matches {
+        use super::*;
+
+        #[test]
+        fn index() {
+            let m = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+            assert_eq!(m[2], 3);
+            assert_eq!(m[3], 4);
+
+            let m = Match::new(&[1, 2]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+        }
+
+        #[test]
+        fn iter() {
+            let match_ = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(match_.iter().copied().collect::<Vec<usize>>(), vec![1, 2, 3, 4]);
+
+            let v = vec![1, 2, 3, 4];
+            for (i, &m) in match_.iter().enumerate() {
+                assert_eq!(v[i], m);
+            }
+        }
+
+        #[test]
+        #[should_panic]
+        fn out_of_bound() {
+            let m = Match::new(&[1, 2]);
+            let _ = m[2];
+        }
+
+        #[test]
+        #[should_panic]
+        fn too_big() {
+            let _ = Match::new(&[1, 2, 3, 5, 4]);
+        }
+    }
+
+    #[test]
+    fn size() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.size(), 1);
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 3);
+
+        let selection = Selection::new("four: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 4);
+    }
+
+    #[test]
+    fn string() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.string(), "name H");
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.string(), "angles: name(#1) H");
+    }
+
+    #[test]
+    fn evaluate() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.evaluate(&frame);
+        assert_eq!(res, &[Match::new(&[0]), Match::new(&[3])]);
+
+        let mut selection = Selection::new("angles: all").unwrap();
+        let res = selection.evaluate(&frame);
+        for m in &[Match::new(&[0, 1, 2]), Match::new(&[1, 2, 3])] {
+            assert!(res.iter().any(|r| r == m));
+        }
+    }
+
+    #[test]
+    fn list() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.list(&frame);
+        assert_eq!(res, vec![0, 3]);
+    }
+
+    #[test]
+    #[should_panic = "can not call `Selection::list` on a multiple selection"]
+    fn list_on_size_1_selection() {
+        let frame = testing_frame();
+        let mut selection = Selection::new("pairs: name(#1) H").unwrap();
+        let _list = selection.list(&frame);
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/strings.rs.html b/0.10.2/doc/src/chemfiles/strings.rs.html new file mode 100644 index 000000000..6994ede6b --- /dev/null +++ b/0.10.2/doc/src/chemfiles/strings.rs.html @@ -0,0 +1,118 @@ +strings.rs - source
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! String conversions between C and Rust
+use std::ffi::{CStr, CString};
+
+use chemfiles_sys::chfl_status;
+use errors::{check, Error};
+
+/// Create a Rust string from a C string. Clones all characters in `buffer`.
+pub fn from_c(buffer: *const i8) -> String {
+    unsafe {
+        let rust_str = CStr::from_ptr(buffer)
+            .to_str()
+            .expect("Invalid Rust string from C");
+        return String::from(rust_str);
+    }
+}
+
+/// Create a C string from a Rust string.
+pub fn to_c(string: &str) -> CString {
+    CString::new(string).expect("Invalid C string from Rust")
+}
+
+/// Check if a string buffer was big enough when passed to a C function
+fn buffer_was_big_enough(buffer: &[i8]) -> bool {
+    let len = buffer.len();
+    if len < 2 {
+        false
+    } else {
+        // The C code should always set the last element to 0
+        debug_assert_eq!(buffer[len - 1], 0);
+        buffer[len - 2] == 0
+    }
+}
+
+/// Call `callback` C function with a string buffer and it length, using
+/// `initial` as the buffer initial size. If the buffer was filled and the
+/// result truncated by the C library, grow the buffer and try again until we
+/// get all the data. Then return the filled buffer to the caller.
+pub fn call_autogrow_buffer<F>(initial: usize, callback: F) -> Result<Vec<i8>, Error>
+where
+    F: Fn(*mut i8, u64) -> chfl_status,
+{
+    let mut size = initial;
+    let mut buffer = vec![0; size];
+    check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+
+    while !buffer_was_big_enough(&buffer) {
+        // Grow the buffer and retry
+        size *= 2;
+        buffer.resize(size, 0);
+        check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+    }
+
+    Ok(buffer)
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/topology.rs.html b/0.10.2/doc/src/chemfiles/topology.rs.html new file mode 100644 index 000000000..3097d9688 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/topology.rs.html @@ -0,0 +1,2014 @@ +topology.rs - source
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Residue, ResidueRef};
+
+/// Possible bond order associated with bonds
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+pub enum BondOrder {
+    /// Unknown or unspecified bond order
+    Unknown = chfl_bond_order::CHFL_BOND_UNKNOWN as isize,
+    /// Single bond
+    Single = chfl_bond_order::CHFL_BOND_SINGLE as isize,
+    /// Double bond
+    Double = chfl_bond_order::CHFL_BOND_DOUBLE as isize,
+    /// Triple bond
+    Triple = chfl_bond_order::CHFL_BOND_TRIPLE as isize,
+    /// Quadruple bond (present in some metals)
+    Quadruple = chfl_bond_order::CHFL_BOND_QUADRUPLE as isize,
+    /// Quintuplet bond (present in some metals)
+    Quintuplet = chfl_bond_order::CHFL_BOND_QUINTUPLET as isize,
+    /// Amide bond (required by some file formats)
+    Amide = chfl_bond_order::CHFL_BOND_AMIDE as isize,
+    /// Aromatic bond (required by some file formats)
+    Aromatic = chfl_bond_order::CHFL_BOND_AROMATIC as isize,
+}
+
+impl BondOrder {
+    pub(crate) fn as_raw(self) -> chfl_bond_order {
+        match self {
+            BondOrder::Unknown => chfl_bond_order::CHFL_BOND_UNKNOWN,
+            BondOrder::Single => chfl_bond_order::CHFL_BOND_SINGLE,
+            BondOrder::Double => chfl_bond_order::CHFL_BOND_DOUBLE,
+            BondOrder::Triple => chfl_bond_order::CHFL_BOND_TRIPLE,
+            BondOrder::Quadruple => chfl_bond_order::CHFL_BOND_QUADRUPLE,
+            BondOrder::Quintuplet => chfl_bond_order::CHFL_BOND_QUINTUPLET,
+            BondOrder::Amide => chfl_bond_order::CHFL_BOND_AMIDE,
+            BondOrder::Aromatic => chfl_bond_order::CHFL_BOND_AROMATIC,
+        }
+    }
+}
+
+impl From<chfl_bond_order> for BondOrder {
+    fn from(order: chfl_bond_order) -> BondOrder {
+        match order {
+            chfl_bond_order::CHFL_BOND_UNKNOWN => BondOrder::Unknown,
+            chfl_bond_order::CHFL_BOND_SINGLE => BondOrder::Single,
+            chfl_bond_order::CHFL_BOND_DOUBLE => BondOrder::Double,
+            chfl_bond_order::CHFL_BOND_TRIPLE => BondOrder::Triple,
+            chfl_bond_order::CHFL_BOND_QUADRUPLE => BondOrder::Quadruple,
+            chfl_bond_order::CHFL_BOND_QUINTUPLET => BondOrder::Quintuplet,
+            chfl_bond_order::CHFL_BOND_AMIDE => BondOrder::Amide,
+            chfl_bond_order::CHFL_BOND_AROMATIC => BondOrder::Aromatic,
+        }
+    }
+}
+
+/// A `Topology` contains the definition of all the atoms in the system, and
+/// the liaisons between the atoms (bonds, angles, dihedrals, ...). It will
+/// also contain all the residues information if it is available.
+pub struct Topology {
+    handle: *mut CHFL_TOPOLOGY,
+}
+
+/// An analog to a reference to a topology (`&Topology`)
+pub struct TopologyRef<'a> {
+    inner: Topology,
+    marker: PhantomData<&'a Topology>
+}
+
+impl<'a> Deref for TopologyRef<'a> {
+    type Target = Topology;
+    fn deref(&self) -> &Topology {
+        &self.inner
+    }
+}
+
+impl Clone for Topology {
+    fn clone(&self) -> Topology {
+        unsafe {
+            let new_handle = chfl_topology_copy(self.as_ptr());
+            Topology::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Topology {
+    /// Create a `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TOPOLOGY) -> Topology {
+        check_not_null(ptr);
+        Topology {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_TOPOLOGY) -> TopologyRef<'a> {
+        TopologyRef {
+            inner: Topology::from_ptr(ptr as *mut CHFL_TOPOLOGY),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Create a new empty topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    /// ```
+    pub fn new() -> Topology {
+        unsafe {
+            Topology::from_ptr(chfl_topology())
+        }
+    }
+
+    /// Get a reference of the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// let atom = topology.atom(4);
+    /// assert_eq!(atom.name(), "");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// assert_eq!(topology.atom(4).name(), "");
+    ///
+    /// topology.atom_mut(4).set_name("Fe");
+    /// assert_eq!(topology.atom(4).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr(), index as u64
+            );
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_topology_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize this topology to hold `natoms` atoms, inserting dummy atoms if
+    /// the new size if bigger than the old one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_topology_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` at the end of this topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Atom};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Mg"));
+    ///
+    /// let atom = topology.atom(0);
+    /// assert_eq!(atom.name(), "Mg");
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom) {
+        unsafe {
+            check_success(chfl_topology_add_atom(self.as_mut_ptr(), atom.as_ptr()));
+        }
+    }
+
+    /// Remove an `Atom` from this topology by `index`. This modify all the
+    /// other atoms indexes.
+    ///
+    /// # Panics
+    ///
+    /// If the `index` is out of bounds
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(9);
+    /// assert_eq!(topology.size(), 9);
+    ///
+    /// topology.remove(7);
+    /// assert_eq!(topology.size(), 8);
+    /// ```
+    pub fn remove(&mut self, index: usize) {
+        unsafe {
+            check_success(chfl_topology_remove(self.as_mut_ptr(), index as u64));
+        }
+    }
+
+    /// Get the number of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds_count(), 3);
+    /// ```
+    pub fn bonds_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_bonds_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.angles_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles_count(), 2);
+    /// ```
+    pub fn angles_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_angles_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.dihedrals_count(), 1);
+    /// ```
+    pub fn dihedrals_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_dihedrals_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    /// assert_eq!(topology.impropers_count(), 1);
+    /// ```
+    pub fn impropers_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_impropers_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the list of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+    /// ```
+    pub fn bonds(&self) -> Vec<[usize; 2]> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![[u64::max_value(); 2]; size];
+        unsafe {
+            check_success(chfl_topology_bonds(self.as_ptr(), bonds.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return bonds
+            .into_iter()
+            .map(|bond| [bond[0] as usize, bond[1] as usize])
+            .collect();
+    }
+
+    /// Get the list of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+    /// ```
+    pub fn angles(&self) -> Vec<[usize; 3]> {
+        let size = self.angles_count();
+        let count = size as u64;
+        let mut angles = vec![[u64::max_value(); 3]; size];
+        unsafe {
+            check_success(chfl_topology_angles(self.as_ptr(), angles.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return angles
+            .into_iter()
+            .map(|angle| [angle[0] as usize, angle[1] as usize, angle[2] as usize])
+            .collect();
+    }
+
+    /// Get the list of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    ///
+    /// assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+    /// ```
+    pub fn dihedrals(&self) -> Vec<[usize; 4]> {
+        let size = self.dihedrals_count();
+        let count = size as u64;
+        let mut dihedrals = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_dihedrals(
+                self.as_ptr(), dihedrals.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return dihedrals
+            .into_iter()
+            .map(|dihedral| {
+                [
+                    dihedral[0] as usize,
+                    dihedral[1] as usize,
+                    dihedral[2] as usize,
+                    dihedral[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Get the list of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    ///
+    /// assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+    /// ```
+    pub fn impropers(&self) -> Vec<[usize; 4]> {
+        let size = self.impropers_count();
+        let count = size as u64;
+        let mut impropers = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_impropers(
+                self.as_ptr(), impropers.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return impropers
+            .into_iter()
+            .map(|improper| {
+                [
+                    improper[0] as usize,
+                    improper[1] as usize,
+                    improper[2] as usize,
+                    improper[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    /// assert_eq!(topology.angles().len(), 1);
+    ///
+    /// topology.clear_bonds();
+    /// assert!(topology.bonds().is_empty());
+    /// assert!(topology.angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_topology_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_topology_bond_with_order(
+                self.as_mut_ptr(), i as u64, j as u64, order.as_raw()
+            ));
+        }
+    }
+
+    /// Get the bond order for the bond between the atoms at indexes `i` and
+    /// `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn bond_order(&self, i: usize, j: usize) -> BondOrder {
+        let mut order = chfl_bond_order::CHFL_BOND_UNKNOWN;
+        unsafe {
+            check_success(chfl_topology_bond_order(
+                self.as_ptr(), i as u64, j as u64, &mut order
+            ));
+        }
+        return order.into()
+    }
+
+    /// Get the bond order for all the bonds in the topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(3);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// topology.add_bond_with_order(0, 2, BondOrder::Single);
+    ///
+    /// assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+    /// ```
+    pub fn bond_orders(&self) -> Vec<BondOrder> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![BondOrder::Unknown; size];
+        unsafe {
+            check_success(chfl_topology_bond_orders(
+                self.as_ptr(),
+                // Casting BondOrder to chfl_bond_order is safe, as they are
+                // both `repr(C)` enums with the same values.
+                bonds.as_mut_ptr().cast(),
+                count
+            ));
+        }
+        return bonds;
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// this topology.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// topology.remove_bond(0, 1);
+    /// assert_eq!(topology.bonds_count(), 1);
+    ///
+    /// // Removing a bond that does not exists is fine
+    /// topology.remove_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 1);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Get a reference to the residue at index `index` from this topology.
+    ///
+    /// The residue index in the topology is not always the same as the residue
+    /// `id`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn residue(&self, index: u64) -> Option<ResidueRef> {
+        unsafe {
+            let handle = chfl_residue_from_topology(self.as_ptr(), index as u64);
+            if handle.is_null() {
+                None
+            } else {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get a copy of the residue containing the atom at index `index` in this
+    /// topology, if any.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.resize(8);
+    ///
+    /// let mut residue = Residue::new("water");
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// topology.add_residue(&residue).unwrap();
+    ///
+    /// let residue = topology.residue_for_atom(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    ///
+    /// assert!(topology.residue_for_atom(6).is_none());
+    /// ```
+    pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef> {
+        let handle = unsafe {
+            chfl_residue_for_atom(self.as_ptr(), index as u64)
+        };
+        if handle.is_null() {
+            None
+        } else {
+            unsafe {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the number of residues in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.residues_count(), 0);
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    /// assert_eq!(topology.residues_count(), 2);
+    /// ```
+    pub fn residues_count(&self) -> u64 {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_residues_count(self.as_ptr(), &mut count));
+        }
+        return count;
+    }
+
+    /// Add a residue to this topology.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue `id` is not already in the topology,
+    /// or if the residue contains atoms that are already in another residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_topology_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Check if the two residues `first` and `second` from the `topology` are
+    /// linked together, *i.e.* if there is a bond between one atom in the
+    /// first residue and one atom in the second one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    ///
+    /// let first = topology.residue(0).unwrap();
+    /// let second = topology.residue(1).unwrap();
+    /// assert_eq!(topology.are_linked(&first, &second), false);
+    /// ```
+    pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool {
+        let mut linked = 0;
+        unsafe {
+            check_success(chfl_topology_residues_linked(
+                self.as_ptr(),
+                first.as_ptr(),
+                second.as_ptr(),
+                &mut linked
+            ));
+        }
+        return linked != 0;
+    }
+}
+
+impl Drop for Topology {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Residue};
+
+    #[test]
+    fn clone() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        let copy = topology.clone();
+        assert_eq!(copy.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+
+        topology.remove(7);
+        assert_eq!(topology.size(), 9);
+
+        topology.add_atom(&Atom::new("Hg"));
+        assert_eq!(topology.size(), 10);
+    }
+
+    #[test]
+    fn atoms() {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(3).name(), "Fe");
+    }
+
+    #[test]
+    fn remove() {
+        let mut topology = Topology::new();
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "W");
+
+        topology.remove(1);
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "Fe");
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove() {
+        let mut topology = Topology::new();
+        topology.resize(18);
+        topology.remove(33);
+    }
+
+
+    #[test]
+    fn bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.bonds_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(9, 2);
+        topology.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(topology.bonds_count(), 3);
+
+        assert_eq!(topology.bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(topology.bond_orders(), expected);
+
+        assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(topology.bond_order(3, 7), BondOrder::Aromatic);
+
+        topology.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        topology.remove_bond(8, 7);
+        assert_eq!(topology.bonds_count(), 2);
+
+        topology.clear_bonds();
+        assert_eq!(topology.bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn angles() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.angles_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 7);
+        topology.add_bond(3, 5);
+        assert_eq!(topology.angles_count(), 2);
+
+        assert_eq!(topology.angles(), vec![[0, 1, 2], [5, 3, 7]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.angles_count(), 0);
+    }
+
+    #[test]
+    fn dihedrals() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.dihedrals_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 2);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(7, 10);
+        assert_eq!(topology.dihedrals_count(), 2);
+
+        assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3], [5, 4, 7, 10]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.dihedrals_count(), 0);
+    }
+
+    #[test]
+    fn impropers() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.impropers_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(0, 2);
+        topology.add_bond(0, 3);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(4, 8);
+        assert_eq!(topology.impropers_count(), 2);
+
+        assert_eq!(topology.impropers(), vec![[1, 0, 2, 3], [5, 4, 7, 8]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.impropers_count(), 0);
+    }
+
+    #[test]
+    fn residues() {
+        let mut topology = Topology::new();
+        topology.resize(4);
+        assert_eq!(topology.residues_count(), 0);
+
+        let mut residue = Residue::new("Foo");
+        residue.add_atom(0);
+        residue.add_atom(2);
+
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 1);
+
+        assert_eq!(topology.residue(0).unwrap().name(), "Foo");
+        {
+            let residue = topology.residue_for_atom(2).unwrap();
+            assert_eq!(residue.name(), "Foo");
+        }
+
+        let mut residue = Residue::new("Bar");
+        residue.add_atom(3);
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 2);
+
+        let first = topology.residue(0).unwrap();
+        let second = topology.residue(0).unwrap();
+        assert!(topology.are_linked(&first, &second));
+
+        // missing residue
+        assert!(topology.residue_for_atom(1).is_none());
+        // out of bounds
+        assert!(topology.residue_for_atom(67).is_none());
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/src/chemfiles/trajectory.rs.html b/0.10.2/doc/src/chemfiles/trajectory.rs.html new file mode 100644 index 000000000..d3be889a2 --- /dev/null +++ b/0.10.2/doc/src/chemfiles/trajectory.rs.html @@ -0,0 +1,1178 @@ +trajectory.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::convert::TryInto;
+use std::path::Path;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check, check_success, Error, Status};
+use strings;
+
+use {Frame, Topology, UnitCell};
+
+/// The `Trajectory` type is the main entry point when using chemfiles. A
+/// `Trajectory` behave a bit like a file, allowing to read and/or write
+/// `Frame`.
+pub struct Trajectory {
+    handle: *mut CHFL_TRAJECTORY,
+}
+
+impl Trajectory {
+    /// Create a `Trajectory` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TRAJECTORY) -> Result<Trajectory, Error> {
+        if ptr.is_null() {
+            Err(Error {
+                status: Status::FileError,
+                message: Error::last_error()
+            })
+        } else {
+            Ok(Trajectory {
+                handle: ptr
+            })
+        }
+    }
+
+    /// Get the underlying C pointer as a pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Open the file at the given `path` in the given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// ```
+    pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_open(path.as_ptr(), mode as i8);
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Open the file at the given `path` using a specific file `format` and the
+    /// given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// Specifying a format is needed when the file format does not match the
+    /// extension, or when there is not standard extension for this format. If
+    /// `format` is an empty string, the format will be guessed from the
+    /// extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+    /// ```
+    pub fn open_with_format<'a, P, S>(filename: P, mode: char, format: S) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let filename =
+            filename.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(filename.as_ref()))?;
+
+        let filename = strings::to_c(filename);
+        let format = strings::to_c(format.into());
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_with_format(
+                filename.as_ptr(), mode as i8, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read a memory buffer as though it was a formatted file.
+    ///
+    /// The memory buffer used to store the file is given using the `data`
+    /// argument. The `format` parameter is required and should follow the same
+    /// rules as in the main `Trajectory` constructor.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or if the format do not support in-memory readers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+    /// let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+    /// let mut frame = Frame::new();
+    /// trajectory.read(&mut frame).unwrap();
+    /// assert_eq!(frame.size(), 6);
+    /// ```
+    pub fn memory_reader<'a, S>(data: S, format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let data = strings::to_c(data.into());
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_reader(
+                data.as_ptr(), data.as_bytes().len() as u64, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Write to a memory buffer as though it was a formatted file.
+    ///
+    /// The `format` parameter should follow the same rules as in the main
+    /// `Trajectory` constructor, except that compression specification
+    /// is not supported.
+    ///
+    /// The `memory_buffer` function can be used to retrieve the data written
+    /// to memory of the `Trajectory`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the format do not support in-memory writers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Trajectory;
+    /// let trajectory_memory = Trajectory::memory_writer("SMI");
+    ///
+    /// // Binary formats typically do not support this feature
+    /// assert!(Trajectory::memory_writer("XTC").is_err());
+    /// ```
+    pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_writer(format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read the next step of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of atom
+    /// in the next step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read(&mut frame).unwrap();
+    /// ```
+    pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read(self.as_mut_ptr(), frame.as_mut_ptr()))
+        }
+    }
+
+    /// Read a specific `step` of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of
+    /// atom at this step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read_step(10, &mut frame).unwrap();
+    /// ```
+    pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read_step(self.as_mut_ptr(), step as u64, frame.as_mut_ptr()))
+        }
+    }
+
+    /// Write a `frame` to this trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.write(&mut frame).unwrap();
+    /// ```
+    pub fn write(&mut self, frame: &Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_write(self.as_mut_ptr(), frame.as_ptr()))
+        }
+    }
+
+    /// Set the `topology` associated with this trajectory. This topology will
+    /// be used when reading and writing the files, replacing any topology in
+    /// the frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Atom, Topology};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_atom(&Atom::new("O"));
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    ///
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_topology(&topology);
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) {
+        unsafe {
+            check_success(chfl_trajectory_set_topology(self.as_mut_ptr(), topology.as_ptr()));
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in `format`;
+    /// and extracting the topology of this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_file("topology.pdb").unwrap();
+    /// ```
+    pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), ptr::null()))
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in
+    /// `format`; and extracting the topology of this frame.
+    ///
+    /// If `format` is an empty string, the format will be guessed from the
+    /// `path` extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+    /// ```
+    pub fn set_topology_with_format<'a, P, S>(&mut self, path: P, format: S) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let format = strings::to_c(format.into());
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), format.as_ptr()))
+        }
+    }
+
+    /// Set the unit `cell` associated with a trajectory. This cell will be
+    /// used when reading and writing the files, replacing any unit cell in the
+    /// frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, UnitCell};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_trajectory_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get the number of steps (the number of frames) in a trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// println!("This trajectory contains {} steps", trajectory.nsteps());
+    /// ```
+    // FIXME should this take &self instead? The file can be modified by this
+    // function, but the format should reset the state.
+    pub fn nsteps(&mut self) -> usize {
+        let mut res = 0;
+        unsafe {
+            check(chfl_trajectory_nsteps(self.as_mut_ptr(), &mut res)).expect(
+                "failed to get the number of steps in this trajectory"
+            );
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return res as usize;
+    }
+
+    /// Obtain the memory buffer written to by the trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This fails if the trajectory was not opened with
+    /// `Trajectory::memory_writer`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, BondOrder, Frame, Trajectory};
+    /// let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+    ///
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_bond_with_order(0, 1, BondOrder::Single);
+    ///
+    /// trajectory_memory.write(&frame).unwrap();
+    ///
+    /// let result = trajectory_memory.memory_buffer();
+    /// assert_eq!(result.unwrap(), "CC\n");
+    /// ```
+    #[allow(clippy::cast_possible_truncation)]
+    pub fn memory_buffer(&self) -> Result<&str, Error> {
+            let mut ptr: *const i8 = std::ptr::null();
+            let mut count: u64 = 0;
+            let buffer = unsafe {
+                check(chfl_trajectory_memory_buffer(self.as_ptr(), &mut ptr, &mut count))?;
+                 std::slice::from_raw_parts(
+                    ptr.cast(), count.try_into().expect("failed to convert u64 to usize")
+                )
+            };
+
+            let string = std::str::from_utf8(buffer)?;
+            Ok(string)
+    }
+
+    /// Get file path for this trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// assert_eq!(trajectory.path(), "water.xyz");
+    /// ```
+    pub fn path(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_trajectory_path(self.as_ptr(), ptr, len) };
+        let path = strings::call_autogrow_buffer(1024, get_string).expect("failed to get path string");
+        return strings::from_c(path.as_ptr());
+    }
+}
+
+impl Drop for Trajectory {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_trajectory_close(self.as_ptr());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use std::fs;
+    use std::path::Path;
+    use std::io::Read;
+
+    use approx::assert_ulps_eq;
+
+    use {Atom, CellShape, Frame, Topology, UnitCell};
+
+    #[test]
+    fn read() {
+        let root = Path::new(file!()).parent().unwrap().join("..");
+        let filename = root.join("data").join("water.xyz");
+        let mut file = Trajectory::open(filename.to_str().unwrap(), 'r').unwrap();
+
+        if cfg!(target_family = "unix") {
+            assert_eq!(file.path(), "src/../data/water.xyz");
+        } else if cfg!(target_family = "windows") {
+            assert_eq!(file.path(), "src\\..\\data\\water.xyz");
+        } else {
+            panic!("please add test for this OS!");
+        }
+
+        assert_eq!(file.nsteps(), 100);
+
+        let mut frame = Frame::new();
+        assert!(file.read(&mut frame).is_ok());
+
+        assert_eq!(frame.size(), 297);
+        assert_ulps_eq!(frame.positions()[0][0], 0.417219);
+        assert_ulps_eq!(frame.positions()[0][1], 8.303366);
+        assert_ulps_eq!(frame.positions()[0][2], 11.737172);
+        assert_ulps_eq!(frame.positions()[124][0], 5.099554);
+        assert_ulps_eq!(frame.positions()[124][1], -0.045104);
+        assert_ulps_eq!(frame.positions()[124][2], 14.153846);
+
+        assert_eq!(frame.atom(0).name(), "O");
+
+        file.set_cell(&UnitCell::new([30.0, 30.0, 30.0]));
+        assert!(file.read_step(41, &mut frame).is_ok());
+        let cell = frame.cell().clone();
+        assert_eq!(cell.lengths(), [30.0, 30.0, 30.0]);
+
+
+        assert_ulps_eq!(frame.positions()[0][0], 0.761277);
+        assert_ulps_eq!(frame.positions()[0][1], 8.106125);
+        assert_ulps_eq!(frame.positions()[0][2], 10.622949);
+        assert_ulps_eq!(frame.positions()[124][0], 5.13242);
+        assert_ulps_eq!(frame.positions()[124][1], 0.079862);
+        assert_ulps_eq!(frame.positions()[124][2], 14.194161);
+
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 0);
+        }
+
+        assert!(frame.guess_bonds().is_ok());
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 180);
+            assert_eq!(topology.angles_count(), 84);
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("Cs");
+        for _ in 0..297 {
+            topology.add_atom(&atom);
+        }
+
+        file.set_topology(&topology);
+        assert!(file.read_step(10, &mut frame).is_ok());
+        assert_eq!(frame.atom(42).name(), "Cs");
+
+        let filename = root.join("data").join("topology.xyz");
+        assert!(file.set_topology_file(filename.to_str().unwrap()).is_ok());
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.atom(100).name(), "Rd");
+
+        let filename = root.join("data").join("helium.xyz.but.not.really");
+        let filename = filename.to_str().unwrap();
+        let mut file = Trajectory::open_with_format(filename, 'r', "XYZ").unwrap();
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.size(), 125);
+    }
+
+    fn write_file(path: &str) {
+        let mut file = Trajectory::open(path, 'w').unwrap();
+        let mut frame = Frame::new();
+        frame.resize(4);
+
+        for position in frame.positions_mut() {
+            *position = [1.0, 2.0, 3.0];
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("X");
+        for _ in 0..4 {
+            topology.add_atom(&atom);
+        }
+        frame.set_topology(&topology).unwrap();
+        assert!(file.write(&frame).is_ok());
+    }
+
+    #[test]
+    fn write() {
+        let filename = "test-tmp.xyz";
+        write_file(filename);
+
+        let expected_content = "4
+Properties=species:S:1:pos:R:3
+X 1 2 3
+X 1 2 3
+X 1 2 3
+X 1 2 3".lines().collect::<Vec<_>>();
+
+        let mut file = fs::File::open(filename).unwrap();
+        let mut content = String::new();
+        let _ = file.read_to_string(&mut content).unwrap();
+
+        assert_eq!(expected_content, content.lines().collect::<Vec<_>>());
+        fs::remove_file(filename).unwrap();
+    }
+
+    #[test]
+    fn memory() {
+        // formats in decreasing order of their memory buffer length to check null termination
+        for format in &["CSSR", "GRO", "XYZ"] {
+            let mut frame_write = Frame::new();
+            frame_write.add_atom(&Atom::new("H"), [1.5, 3.0, -10.0], None);
+            frame_write.add_atom(&Atom::new("O"), [2.3, -1.4, 50.0], None);
+            frame_write.add_atom(&Atom::new("H"), [-1.5, 10.0, 0.0], None);
+            let cell = UnitCell::new([10.0, 11.0, 12.5]);
+
+            let mut trajectory_write = Trajectory::memory_writer(*format).unwrap();
+            trajectory_write.set_cell(&cell);
+            trajectory_write.write(&frame_write).unwrap();
+
+            let buffer = trajectory_write.memory_buffer().unwrap();
+            let mut trajectory_read = Trajectory::memory_reader(buffer, *format).unwrap();
+            let mut frame_read = Frame::new();
+            trajectory_read.read(&mut frame_read).unwrap();
+
+            assert_eq!(trajectory_read.nsteps(), 1);
+            assert_eq!(frame_read.cell().shape(), CellShape::Orthorhombic);
+            assert_eq!(frame_read.size(), 3);
+            assert_eq!(frame_read.atom(1).name(), "O");
+            crate::assert_vector3d_eq(&frame_read.positions()[2], &[-1.5, 10.0, 0.0], 1e-4);
+        }
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/doc/storage.js b/0.10.2/doc/storage.js new file mode 100644 index 000000000..6b16cbd83 --- /dev/null +++ b/0.10.2/doc/storage.js @@ -0,0 +1 @@ +var resourcesSuffix="";var darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");window.mainTheme=document.getElementById("mainThemeStyle");var settingsDataset=(function(){var settingsElement=document.getElementById("default-settings");if(settingsElement===null){return null}var dataset=settingsElement.dataset;if(dataset===undefined){return null}return dataset})();function getSettingValue(settingName){var current=getCurrentValue('rustdoc-'+settingName);if(current!==null){return current}if(settingsDataset!==null){var def=settingsDataset[settingName.replace(/-/g,'_')];if(def!==undefined){return def}}return null}var localStoredTheme=getSettingValue("theme");var savedHref=[];function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(!elem||!elem.classList){return}elem.classList.add(className)}function removeClass(elem,className){if(!elem||!elem.classList){return}elem.classList.remove(className)}function onEach(arr,func,reversed){if(arr&&arr.length>0&&func){var length=arr.length;var i;if(reversed){for(i=length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(i=0;i=0){updateLocalStorage("rustdoc-preferred-dark-theme",localStoredTheme)}updateSystemTheme()}else{switchTheme(window.currentTheme,window.mainTheme,getSettingValue("theme")||"light",false)} \ No newline at end of file diff --git a/0.10.2/doc/toggle-minus.svg b/0.10.2/doc/toggle-minus.svg new file mode 100644 index 000000000..73154788a --- /dev/null +++ b/0.10.2/doc/toggle-minus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/doc/toggle-plus.svg b/0.10.2/doc/toggle-plus.svg new file mode 100644 index 000000000..08b17033e --- /dev/null +++ b/0.10.2/doc/toggle-plus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/doc/wheel.svg b/0.10.2/doc/wheel.svg new file mode 100644 index 000000000..01da3b24c --- /dev/null +++ b/0.10.2/doc/wheel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/down-arrow.svg b/0.10.2/down-arrow.svg new file mode 100644 index 000000000..35437e77a --- /dev/null +++ b/0.10.2/down-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/favicon-16x16.png b/0.10.2/favicon-16x16.png new file mode 100644 index 000000000..7cfe6c135 Binary files /dev/null and b/0.10.2/favicon-16x16.png differ diff --git a/0.10.2/favicon-32x32.png b/0.10.2/favicon-32x32.png new file mode 100644 index 000000000..5109c1de8 Binary files /dev/null and b/0.10.2/favicon-32x32.png differ diff --git a/0.10.2/favicon.svg b/0.10.2/favicon.svg new file mode 100644 index 000000000..8b34b5119 --- /dev/null +++ b/0.10.2/favicon.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/0.10.2/implementors/core/clone/trait.Clone.js b/0.10.2/implementors/core/clone/trait.Clone.js new file mode 100644 index 000000000..f29cb2061 --- /dev/null +++ b/0.10.2/implementors/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Clone for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Clone for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Clone for Atom","synthetic":false,"types":["chemfiles::atom::Atom"]},{"text":"impl Clone for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Clone for UnitCell","synthetic":false,"types":["chemfiles::cell::UnitCell"]},{"text":"impl Clone for Residue","synthetic":false,"types":["chemfiles::residue::Residue"]},{"text":"impl Clone for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Clone for Topology","synthetic":false,"types":["chemfiles::topology::Topology"]},{"text":"impl Clone for Frame","synthetic":false,"types":["chemfiles::frame::Frame"]},{"text":"impl Clone for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Clone for Selection","synthetic":false,"types":["chemfiles::selection::Selection"]},{"text":"impl Clone for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl Clone for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/cmp/trait.Eq.js b/0.10.2/implementors/core/cmp/trait.Eq.js new file mode 100644 index 000000000..991ad22a1 --- /dev/null +++ b/0.10.2/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Eq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Eq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Eq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Eq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/cmp/trait.Ord.js b/0.10.2/implementors/core/cmp/trait.Ord.js new file mode 100644 index 000000000..0784ba4cb --- /dev/null +++ b/0.10.2/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Ord for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/cmp/trait.PartialEq.js b/0.10.2/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..b88724be9 --- /dev/null +++ b/0.10.2/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialEq<Error> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl PartialEq<Status> for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl PartialEq<CellShape> for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl PartialEq<BondOrder> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl PartialEq<Match> for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl PartialEq<Property> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl PartialEq<FormatMetadata> for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/cmp/trait.PartialOrd.js b/0.10.2/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..d0dc2d685 --- /dev/null +++ b/0.10.2/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialOrd<BondOrder> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl PartialOrd<Property> for Property","synthetic":false,"types":["chemfiles::property::Property"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/convert/trait.From.js b/0.10.2/implementors/core/convert/trait.From.js new file mode 100644 index 000000000..156356c1d --- /dev/null +++ b/0.10.2/implementors/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl From<chfl_status> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl From<Utf8Error> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl From<chfl_cellshape> for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl From<CellShape> for chfl_cellshape","synthetic":false,"types":["chemfiles_sys::chfl_cellshape"]},{"text":"impl From<chfl_bond_order> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl From<bool> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<f64> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<String> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl<'a> From<&'a str> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<[f64; 3]> for Property","synthetic":false,"types":["chemfiles::property::Property"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/fmt/trait.Debug.js b/0.10.2/implementors/core/fmt/trait.Debug.js new file mode 100644 index 000000000..21a553777 --- /dev/null +++ b/0.10.2/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Debug for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Debug for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Debug for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Debug for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Debug for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Debug for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl Debug for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/fmt/trait.Display.js b/0.10.2/implementors/core/fmt/trait.Display.js new file mode 100644 index 000000000..cdacd5e88 --- /dev/null +++ b/0.10.2/implementors/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Display for Error","synthetic":false,"types":["chemfiles::errors::Error"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/iter/traits/collect/trait.IntoIterator.js b/0.10.2/implementors/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 000000000..f478370c2 --- /dev/null +++ b/0.10.2/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> IntoIterator for &'a Match","synthetic":false,"types":["chemfiles::selection::Match"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/iter/traits/iterator/trait.Iterator.js b/0.10.2/implementors/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 000000000..7bef8fef2 --- /dev/null +++ b/0.10.2/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Iterator for PropertiesIter<'a>","synthetic":false,"types":["chemfiles::property::PropertiesIter"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/marker/trait.Copy.js b/0.10.2/implementors/core/marker/trait.Copy.js new file mode 100644 index 000000000..292291348 --- /dev/null +++ b/0.10.2/implementors/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Copy for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/marker/trait.Freeze.js b/0.10.2/implementors/core/marker/trait.Freeze.js new file mode 100644 index 000000000..7a6ceb43d --- /dev/null +++ b/0.10.2/implementors/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Freeze for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Freeze for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl Freeze for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> Freeze for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Freeze for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Freeze for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl Freeze for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> Freeze for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Freeze for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl Freeze for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> Freeze for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Freeze for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Freeze for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> Freeze for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl Freeze for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl Freeze for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Freeze for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl Freeze for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Freeze for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> Freeze for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Freeze for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/marker/trait.Send.js b/0.10.2/implementors/core/marker/trait.Send.js new file mode 100644 index 000000000..7e2b45b5e --- /dev/null +++ b/0.10.2/implementors/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Send for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Send for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl !Send for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> !Send for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !Send for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Send for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl !Send for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> !Send for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !Send for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl !Send for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> !Send for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Send for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl !Send for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> !Send for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl !Send for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl !Send for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Send for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl !Send for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Send for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !Send for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Send for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/marker/trait.StructuralEq.js b/0.10.2/implementors/core/marker/trait.StructuralEq.js new file mode 100644 index 000000000..706c84330 --- /dev/null +++ b/0.10.2/implementors/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralEq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl StructuralEq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl StructuralEq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl StructuralEq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/marker/trait.StructuralPartialEq.js b/0.10.2/implementors/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 000000000..f07883adc --- /dev/null +++ b/0.10.2/implementors/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralPartialEq for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl StructuralPartialEq for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl StructuralPartialEq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl StructuralPartialEq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl StructuralPartialEq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl StructuralPartialEq for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl StructuralPartialEq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/marker/trait.Sync.js b/0.10.2/implementors/core/marker/trait.Sync.js new file mode 100644 index 000000000..505c4c942 --- /dev/null +++ b/0.10.2/implementors/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Sync for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Sync for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl !Sync for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> !Sync for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !Sync for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Sync for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl !Sync for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> !Sync for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !Sync for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl !Sync for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> !Sync for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Sync for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl !Sync for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> !Sync for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl !Sync for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl !Sync for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Sync for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl !Sync for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Sync for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !Sync for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Sync for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/marker/trait.Unpin.js b/0.10.2/implementors/core/marker/trait.Unpin.js new file mode 100644 index 000000000..5aa634457 --- /dev/null +++ b/0.10.2/implementors/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Unpin for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Unpin for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl Unpin for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> Unpin for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Unpin for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Unpin for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl Unpin for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> Unpin for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Unpin for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl Unpin for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> Unpin for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Unpin for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Unpin for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> Unpin for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl Unpin for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl Unpin for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Unpin for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl Unpin for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Unpin for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> Unpin for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Unpin for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/ops/deref/trait.Deref.js b/0.10.2/implementors/core/ops/deref/trait.Deref.js new file mode 100644 index 000000000..8126c0190 --- /dev/null +++ b/0.10.2/implementors/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Deref for AtomRef<'a>","synthetic":false,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Deref for AtomMut<'a>","synthetic":false,"types":["chemfiles::atom::AtomMut"]},{"text":"impl<'a> Deref for UnitCellRef<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Deref for UnitCellMut<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl<'a> Deref for ResidueRef<'a>","synthetic":false,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl<'a> Deref for TopologyRef<'a>","synthetic":false,"types":["chemfiles::topology::TopologyRef"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/ops/deref/trait.DerefMut.js b/0.10.2/implementors/core/ops/deref/trait.DerefMut.js new file mode 100644 index 000000000..1e78a1875 --- /dev/null +++ b/0.10.2/implementors/core/ops/deref/trait.DerefMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> DerefMut for AtomMut<'a>","synthetic":false,"types":["chemfiles::atom::AtomMut"]},{"text":"impl<'a> DerefMut for UnitCellMut<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellMut"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/ops/drop/trait.Drop.js b/0.10.2/implementors/core/ops/drop/trait.Drop.js new file mode 100644 index 000000000..d2cedb699 --- /dev/null +++ b/0.10.2/implementors/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Drop for Atom","synthetic":false,"types":["chemfiles::atom::Atom"]},{"text":"impl Drop for UnitCell","synthetic":false,"types":["chemfiles::cell::UnitCell"]},{"text":"impl Drop for Residue","synthetic":false,"types":["chemfiles::residue::Residue"]},{"text":"impl Drop for Topology","synthetic":false,"types":["chemfiles::topology::Topology"]},{"text":"impl Drop for Frame","synthetic":false,"types":["chemfiles::frame::Frame"]},{"text":"impl Drop for Trajectory","synthetic":false,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Drop for Selection","synthetic":false,"types":["chemfiles::selection::Selection"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/ops/index/trait.Index.js b/0.10.2/implementors/core/ops/index/trait.Index.js new file mode 100644 index 000000000..f1b5f2ce2 --- /dev/null +++ b/0.10.2/implementors/core/ops/index/trait.Index.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Index<usize> for Match","synthetic":false,"types":["chemfiles::selection::Match"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/0.10.2/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 000000000..5fdc8a884 --- /dev/null +++ b/0.10.2/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl RefUnwindSafe for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl RefUnwindSafe for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl RefUnwindSafe for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> RefUnwindSafe for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> RefUnwindSafe for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl RefUnwindSafe for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl RefUnwindSafe for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> RefUnwindSafe for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> RefUnwindSafe for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl RefUnwindSafe for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> RefUnwindSafe for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl RefUnwindSafe for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl RefUnwindSafe for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> RefUnwindSafe for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl RefUnwindSafe for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl RefUnwindSafe for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl RefUnwindSafe for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl RefUnwindSafe for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl RefUnwindSafe for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !RefUnwindSafe for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl RefUnwindSafe for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/0.10.2/implementors/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 000000000..256c14ddc --- /dev/null +++ b/0.10.2/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl UnwindSafe for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl UnwindSafe for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl UnwindSafe for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> UnwindSafe for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !UnwindSafe for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl UnwindSafe for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl UnwindSafe for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> UnwindSafe for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !UnwindSafe for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl UnwindSafe for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> UnwindSafe for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl UnwindSafe for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl UnwindSafe for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> UnwindSafe for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl UnwindSafe for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl UnwindSafe for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl UnwindSafe for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl UnwindSafe for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl UnwindSafe for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !UnwindSafe for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl UnwindSafe for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/implementors/std/error/trait.Error.js b/0.10.2/implementors/std/error/trait.Error.js new file mode 100644 index 000000000..8c8d3b053 --- /dev/null +++ b/0.10.2/implementors/std/error/trait.Error.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Error for Error","synthetic":false,"types":["chemfiles::errors::Error"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.2/index.html b/0.10.2/index.html new file mode 100644 index 000000000..8b8b920bb --- /dev/null +++ b/0.10.2/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/0.10.2/light.css b/0.10.2/light.css new file mode 100644 index 000000000..d4d3882e3 --- /dev/null +++ b/0.10.2/light.css @@ -0,0 +1 @@ + body{background-color:white;color:black;}h1,h2,h3,h4{color:black;}h1.fqn{border-bottom-color:#D5D5D5;}h2,h3,h4{border-bottom-color:#DDDDDD;}.in-band{background-color:white;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#F5F5F5;}pre,.rustdoc.source .example-wrap{background-color:#F5F5F5;}.sidebar{background-color:#F1F1F1;}*{scrollbar-color:rgba(36,37,39,0.6) #e6e6e6;}.sidebar{scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;}.logo-container.rust-logo>img{}::-webkit-scrollbar-track{background-color:#ecebeb;}::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar::-webkit-scrollbar-track{background-color:#dcdcdc;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar .current{background-color:#fff;}.source .sidebar{background-color:#fff;}.sidebar .location{border-color:#000;background-color:#fff;color:#333;}.sidebar .version{border-bottom-color:#DDD;}.sidebar-title{border-top-color:#777;border-bottom-color:#777;}.block a:hover{background:#F5F5F5;}.line-numbers span{color:#c67e2d;}.line-numbers .line-highlighted{background-color:#f6fdb0 !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom-color:#ddd;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#4E4C4C;}.search-results a:hover{background-color:#ddd;}.search-results a:focus{color:#000 !important;background-color:#ccc;}.search-results a:focus span{color:#000 !important;}a.result-trait:focus{background-color:#c7b6ff;}a.result-traitalias:focus{background-color:#c7b6ff;}a.result-mod:focus,a.result-externcrate:focus{background-color:#afc6e4;}a.result-enum:focus{background-color:#b4d1b9;}a.result-struct:focus{background-color:#e7b1a0;}a.result-union:focus{background-color:#b7bd49;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#c6afb3;}a.result-type:focus{background-color:#ffc891;}a.result-foreigntype:focus{background-color:#f5c4ff;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#8ce488;}a.result-constant:focus,a.result-static:focus{background-color:#c3e0ff;}a.result-primitive:focus{background-color:#9aecff;}a.result-keyword:focus{background-color:#f99650;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#508157;}.content span.struct,.content a.struct,.block a.current.struct{color:#ad448e;}.content span.type,.content a.type,.block a.current.type{color:#ba5d00;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#cd00e2;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#068000;}.content span.union,.content a.union,.block a.current.union{color:#767b27;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#546e8a;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#2c8093;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#4d76ae;}.content span.trait,.content a.trait,.block a.current.trait{color:#7c5af3;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#6841f1;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#9a6e31;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#de5249;}nav:not(.sidebar){border-bottom-color:#e0e0e0;}nav.main .current{border-top-color:#000;border-bottom-color:#000;}nav.main .separator{border:1px solid #000;}a{color:#000;}body.source .example-wrap pre.rust a{background:#eee;}.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),.docblock-short a:not(.srclink):not(.test-arrow),.item-info a,#help a{color:#3873AD;}a.test-arrow{color:#f5f5f5;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}#crate-search{color:#555;background-color:white;border-color:#e0e0e0;box-shadow:0 0 0 1px #e0e0e0,0 0 0 2px transparent;}.search-input{color:#555;background-color:white;box-shadow:0 0 0 1px #e0e0e0,0 0 0 2px transparent;}.search-input:focus{border-color:#66afe9;}.search-input:disabled{background-color:#e6e6e6;}#crate-search+.search-input:focus{box-shadow:0 0 8px #078dd8;}.module-item .stab,.import-item .stab{color:#000;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;}.stab.portability>code{background:none;}#help>div{background:#e9e9e9;border-color:#bfbfbf;}#help>div>span{border-bottom-color:#bfbfbf;}.since{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:black;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#8959A8;}pre.rust .kw-2,pre.rust .prelude-ty{color:#4271AE;}pre.rust .number,pre.rust .string{color:#718C00;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#C82829;}pre.rust .comment{color:#8E908C;}pre.rust .doccomment{color:#4D4D4C;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#B76514;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#c7c7c7;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target,:target>*{background:#FDFFD3;}:target{border-right:3px solid #ffb44c;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.5);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.5);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#eee;border-color:#999;}.notable-traits-tooltiptext .notable{border-bottom-color:#DDDDDD;}#titles>button:not(.selected){background-color:#e6e6e6;border-top-color:#e6e6e6;}#titles>button:hover,#titles>button.selected{background-color:#ffffff;border-top-color:#0089ff;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#F1F1F1;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#F1F1F1;border-right-color:#000;}#sidebar-filler{background-color:#F1F1F1;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow-color:#c6cbd1;}#theme-picker,#settings-menu,#help-button{border-color:#e0e0e0;background-color:#fff;}#theme-picker:hover,#theme-picker:focus,#settings-menu:hover,#settings-menu:focus,#help-button:hover,#help-button:focus{border-color:#717171;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(35%);}#theme-choices{border-color:#ccc;background-color:#fff;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#eee;}@media (max-width:700px){#theme-picker{background:#fff;}}#all-types{background-color:#fff;}#all-types:hover{background-color:#f9f9f9;}.search-results .result-name span.alias{color:#000;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#F1F1F1;}#sidebar-toggle:hover{background-color:#E0E0E0;}#source-sidebar{background-color:#F1F1F1;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#E0E0E0;}div.files>.selected{background-color:#fff;}.setting-line>.title{border-bottom-color:#D5D5D5;} \ No newline at end of file diff --git a/0.10.2/main.js b/0.10.2/main.js new file mode 100644 index 000000000..33ee852cf --- /dev/null +++ b/0.10.2/main.js @@ -0,0 +1,8 @@ +if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.indexOf(searchString,position)===position}}if(!String.prototype.endsWith){String.prototype.endsWith=function(suffix,length){var l=length||this.length;return this.indexOf(suffix,l-suffix.length)!==-1}}if(!DOMTokenList.prototype.add){DOMTokenList.prototype.add=function(className){if(className&&!hasClass(this,className)){if(this.className&&this.className.length>0){this.className+=" "+className}else{this.className=className}}}}if(!DOMTokenList.prototype.remove){DOMTokenList.prototype.remove=function(className){if(className&&this.className){this.className=(" "+this.className+" ").replace(" "+className+" "," ").trim()}}}(function(){var rustdocVars=document.getElementById("rustdoc-vars");if(rustdocVars){window.rootPath=rustdocVars.attributes["data-root-path"].value;window.currentCrate=rustdocVars.attributes["data-current-crate"].value;window.searchJS=rustdocVars.attributes["data-search-js"].value;window.searchIndexJS=rustdocVars.attributes["data-search-index-js"].value}var sidebarVars=document.getElementById("sidebar-vars");if(sidebarVars){window.sidebarCurrent={name:sidebarVars.attributes["data-name"].value,ty:sidebarVars.attributes["data-ty"].value,relpath:sidebarVars.attributes["data-relpath"].value,}}}());function getVirtualKey(ev){if("key"in ev&&typeof ev.key!="undefined"){return ev.key}var c=ev.charCode||ev.keyCode;if(c==27){return"Escape"}return String.fromCharCode(c)}var THEME_PICKER_ELEMENT_ID="theme-picker";var THEMES_ELEMENT_ID="theme-choices";function getThemesElement(){return document.getElementById(THEMES_ELEMENT_ID)}function getThemePickerElement(){return document.getElementById(THEME_PICKER_ELEMENT_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function showThemeButtonState(){var themePicker=getThemePickerElement();var themeChoices=getThemesElement();themeChoices.style.display="block";themePicker.style.borderBottomRightRadius="0";themePicker.style.borderBottomLeftRadius="0"}function hideThemeButtonState(){var themePicker=getThemePickerElement();var themeChoices=getThemesElement();themeChoices.style.display="none";themePicker.style.borderBottomRightRadius="3px";themePicker.style.borderBottomLeftRadius="3px"}(function(){var themeChoices=getThemesElement();var themePicker=getThemePickerElement();var availableThemes=["ayu","dark","light"];function switchThemeButtonState(){if(themeChoices.style.display==="block"){hideThemeButtonState()}else{showThemeButtonState()}}function handleThemeButtonsBlur(e){var active=document.activeElement;var related=e.relatedTarget;if(active.id!==THEME_PICKER_ELEMENT_ID&&(!active.parentNode||active.parentNode.id!==THEMES_ELEMENT_ID)&&(!related||(related.id!==THEME_PICKER_ELEMENT_ID&&(!related.parentNode||related.parentNode.id!==THEMES_ELEMENT_ID)))){hideThemeButtonState()}}themePicker.onclick=switchThemeButtonState;themePicker.onblur=handleThemeButtonsBlur;availableThemes.forEach(function(item){var but=document.createElement("button");but.textContent=item;but.onclick=function(){switchTheme(window.currentTheme,window.mainTheme,item,true);useSystemTheme(false)};but.onblur=handleThemeButtonsBlur;themeChoices.appendChild(but)})}());(function(){"use strict";window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:function(){return document.getElementById("search")},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:function(){if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},focus:function(){searchState.input.focus()},defocus:function(){searchState.input.blur()},showResults:function(search){if(search===null||typeof search==='undefined'){search=searchState.outputElement()}addClass(main,"hidden");removeClass(search,"hidden");searchState.mouseMovedAfterSearch=false;document.title=searchState.title},hideResults:function(search){if(search===null||typeof search==='undefined'){search=searchState.outputElement()}addClass(search,"hidden");removeClass(main,"hidden");document.title=searchState.titleBeforeSearch;if(searchState.browserSupportsHistoryApi()){history.replaceState("",window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}},getQueryStringParams:function(){var params={};window.location.search.substring(1).split("&").map(function(s){var pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},putBackSearch:function(search_input){var search=searchState.outputElement();if(search_input.value!==""&&hasClass(search,"hidden")){searchState.showResults(search);if(searchState.browserSupportsHistoryApi()){var extra="?search="+encodeURIComponent(search_input.value);history.replaceState(search_input.value,"",getNakedUrl()+extra+window.location.hash)}document.title=searchState.title}},browserSupportsHistoryApi:function(){return window.history&&typeof window.history.pushState==="function"},setup:function(){var search_input=searchState.input;if(!searchState.input){return}function loadScript(url){var script=document.createElement('script');script.src=url;document.head.append(script)}var searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(window.searchJS);loadScript(window.searchIndexJS)}}search_input.addEventListener("focus",function(){searchState.putBackSearch(this);search_input.origPlaceholder=searchState.input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});search_input.addEventListener("blur",function(){search_input.placeholder=searchState.input.origPlaceholder});search_input.removeAttribute('disabled');searchState.addCrateDropdown(window.ALL_CRATES);var params=searchState.getQueryStringParams();if(params.search!==undefined){var search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search);loadSearch()}},addCrateDropdown:function(crates){var elem=document.getElementById("crate-search");if(!elem){return}var savedCrate=getSettingValue("saved-filter-crate");for(var i=0,len=crates.length;i0){return tmp}}return null}function showSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){addClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];if(sidebar){addClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(!filler){var div=document.createElement("div");div.id="sidebar-filler";sidebar.appendChild(div)}}}function hideSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){removeClass(elems,"show-it")}var sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"mobile");var filler=document.getElementById("sidebar-filler");if(filler){filler.remove()}document.getElementsByTagName("body")[0].style.marginTop=""}var toggleAllDocsId="toggle-all-docs";var main=document.getElementById("main");var savedHash="";function handleHashes(ev){var elem;var search=searchState.outputElement();if(ev!==null&&search&&!hasClass(search,"hidden")&&ev.newURL){searchState.hideResults(search);var hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(searchState.browserSupportsHistoryApi()){history.replaceState(hash,"",getNakedUrl()+window.location.search+"#"+hash)}elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}expandSection(savedHash.slice(1))}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function getHelpElement(build){if(build){buildHelperPopup()}return document.getElementById("help")}function displayHelp(display,ev,help){if(display){help=help?help:getHelpElement(true);if(hasClass(help,"hidden")){ev.preventDefault();removeClass(help,"hidden");addClass(document.body,"blur")}}else{help=help?help:getHelpElement(false);if(help&&!hasClass(help,"hidden")){ev.preventDefault();addClass(help,"hidden");removeClass(document.body,"blur")}}}function handleEscape(ev){var help=getHelpElement(false);var search=searchState.outputElement();if(help&&!hasClass(help,"hidden")){displayHelp(false,ev,help)}else if(search&&!hasClass(search,"hidden")){searchState.clearInputTimeout();ev.preventDefault();searchState.hideResults(search)}searchState.defocus();hideThemeButtonState()}var disableShortcuts=getSettingValue("disable-shortcuts")==="true";function handleShortcut(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":displayHelp(false,ev);ev.preventDefault();searchState.focus();break;case"+":case"-":ev.preventDefault();toggleAllDocs();break;case"?":displayHelp(true,ev);break;case"t":case"T":displayHelp(false,ev);ev.preventDefault();var themePicker=getThemePickerElement();themePicker.click();themePicker.focus();break;default:if(getThemePickerElement().parentNode.contains(ev.target)){handleThemeKeyDown(ev)}}}}function handleThemeKeyDown(ev){var active=document.activeElement;var themes=getThemesElement();switch(getVirtualKey(ev)){case"ArrowUp":ev.preventDefault();if(active.previousElementSibling&&ev.target.id!==THEME_PICKER_ELEMENT_ID){active.previousElementSibling.focus()}else{showThemeButtonState();themes.lastElementChild.focus()}break;case"ArrowDown":ev.preventDefault();if(active.nextElementSibling&&ev.target.id!==THEME_PICKER_ELEMENT_ID){active.nextElementSibling.focus()}else{showThemeButtonState();themes.firstElementChild.focus()}break;case"Enter":case"Return":case"Space":if(ev.target.id===THEME_PICKER_ELEMENT_ID&&themes.style.display==="none"){ev.preventDefault();showThemeButtonState();themes.firstElementChild.focus()}break;case"Home":ev.preventDefault();themes.firstElementChild.focus();break;case"End":ev.preventDefault();themes.lastElementChild.focus();break}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);(function(){var x=document.getElementsByClassName("version-selector");if(x.length>0){x[0].onchange=function(){var i,match,url=document.location.href,stripped="",len=window.rootPath.match(/\.\.\//g).length+1;for(i=0;i .in-band > .trait").textContent;var baseIdName="impl-"+traitName+"-";var libs=Object.getOwnPropertyNames(imp);for(var i=0,llength=libs.length;ithe rustdoc book.";var container=document.createElement("div");var shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["T","Focus the theme picker menu"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(function(x){return"
"+x[0].split(" ").map(function(y,index){return(index&1)===0?""+y+"":" "+y+" "}).join("")+"
"+x[1]+"
"}).join("");var div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";var infos=["Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + * -> vec)","Search multiple things at once by splitting your query with comma (e.g., \ + str,u8 or String,struct:Vec,test)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for items inside another one by searching for a path: vec::Vec",].map(function(x){return"

"+x+"

"}).join("");var div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;container.appendChild(book_info);container.appendChild(div_shortcuts);container.appendChild(div_infos);popup.appendChild(container);insertAfter(popup,searchState.outputElement());buildHelperPopup=function(){}};onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){var reset_button_timeout=null;window.copy_path=function(but){var parent=but.parentElement;var path=[];onEach(parent.childNodes,function(child){if(child.tagName==='A'){path.push(child.textContent)}});var el=document.createElement('textarea');el.value=path.join('::');el.setAttribute('readonly','');el.style.position='absolute';el.style.left='-9999px';document.body.appendChild(el);el.select();document.execCommand('copy');document.body.removeChild(el);but.children[0].style.display='none';var tmp;if(but.childNodes.length<2){tmp=document.createTextNode('✓');but.appendChild(tmp)}else{onEachLazy(but.childNodes,function(e){if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent='✓'}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent='';reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/0.10.2/normalize.css b/0.10.2/normalize.css new file mode 100644 index 000000000..469959f13 --- /dev/null +++ b/0.10.2/normalize.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/0.10.2/noscript.css b/0.10.2/noscript.css new file mode 100644 index 000000000..aea68efbc --- /dev/null +++ b/0.10.2/noscript.css @@ -0,0 +1 @@ + #main .attributes{margin-left:0 !important;}#copy-path{display:none;} \ No newline at end of file diff --git a/0.10.2/noto-sans-kr-v13-korean-regular-LICENSE.txt b/0.10.2/noto-sans-kr-v13-korean-regular-LICENSE.txt new file mode 100644 index 000000000..922d5fdc1 --- /dev/null +++ b/0.10.2/noto-sans-kr-v13-korean-regular-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2014, 2015 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.2/noto-sans-kr-v13-korean-regular.woff b/0.10.2/noto-sans-kr-v13-korean-regular.woff new file mode 100644 index 000000000..01d6b6b54 Binary files /dev/null and b/0.10.2/noto-sans-kr-v13-korean-regular.woff differ diff --git a/0.10.2/rust-logo.png b/0.10.2/rust-logo.png new file mode 100644 index 000000000..74b4bd695 Binary files /dev/null and b/0.10.2/rust-logo.png differ diff --git a/0.10.2/rustdoc.css b/0.10.2/rustdoc.css new file mode 100644 index 000000000..29c1a7eb5 --- /dev/null +++ b/0.10.2/rustdoc.css @@ -0,0 +1 @@ + @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular.woff2") format("woff2"),url("FiraSans-Regular.woff") format('woff');font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium.woff2") format("woff2"),url("FiraSans-Medium.woff") format('woff');font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular.ttf.woff2") format("woff2"),url("SourceSerif4-Regular.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It.ttf.woff2") format("woff2"),url("SourceSerif4-It.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold.ttf.woff2") format("woff2"),url("SourceSerif4-Bold.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular.ttf.woff2") format("woff2"),url("SourceCodePro-Regular.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It.ttf.woff2") format("woff2"),url("SourceCodePro-It.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold.ttf.woff2") format("woff2"),url("SourceCodePro-Semibold.ttf.woff") format("woff");font-display:swap;}@font-face {font-family:'Noto Sans KR';src:url("noto-sans-kr-v13-korean-regular.woff") format("woff");font-display:swap;unicode-range:U+A960-A97F,U+AC00-D7AF,U+D7B0-D7FF;}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:16px/1.4 "Source Serif 4","Noto Sans KR",serif;margin:0;position:relative;padding:10px 15px 20px 15px;-webkit-font-feature-settings:"kern","liga";-moz-font-feature-settings:"kern","liga";font-feature-settings:"kern","liga";}h1{font-size:1.5em;}h2{font-size:1.4em;}h3{font-size:1.3em;}h1,h2,h3,h4{font-weight:500;margin:20px 0 15px 0;padding-bottom:6px;}h1.fqn{display:flex;border-bottom:1px dashed;margin-top:0;padding-left:1px;}h1.fqn>.in-band>a:hover{text-decoration:underline;}h2,h3,h4{border-bottom:1px solid;}h3.code-header,h4.code-header{font-size:1em;font-weight:600;border:none;padding:0;margin:0;}.impl,.impl-items .method,.methods .method,.impl-items .type,.methods .type,.impl-items .associatedconstant,.methods .associatedconstant,.impl-items .associatedtype,.methods .associatedtype{flex-basis:100%;font-weight:600;margin-top:16px;margin-bottom:10px;position:relative;}.impl,.method.trait-impl,.type.trait-impl,.associatedconstant.trait-impl,.associatedtype.trait-impl{padding-left:15px;}div.impl-items>div{padding-left:0;}h1,h2,h3,h4,.sidebar,a.source,.search-input,.search-results .result-name,.content table td:first-child>a,.item-left>a,div.item-list .out-of-band,span.since,#source-sidebar,#sidebar-toggle,details.rustdoc-toggle>summary::before,details.undocumented>summary::before,div.impl-items>div:not(.docblock):not(.item-info),.content ul.crate a.crate,a.srclink,#main>ul.docblock>li>a{font-family:"Fira Sans",Arial,sans-serif;}.content ul.crate a.crate{font-size:16px/1.6;}ol,ul{padding-left:25px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.6em;}p{margin:0 0 .6em 0;}summary{outline:none;}td,th{padding:0;}table{border-collapse:collapse;}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;}details:not(.rustdoc-toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.1em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;}.type-decl pre{overflow-x:auto;}.source .content pre{padding:20px;}img{max-width:100%;}li{position:relative;}.source .content{margin-top:50px;max-width:none;overflow:visible;margin-left:0px;}nav.sub{font-size:16px;text-transform:uppercase;}.sidebar{width:200px;position:fixed;left:0;top:0;bottom:0;overflow:auto;}*{scrollbar-width:initial;}.sidebar{scrollbar-width:thin;}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;}.sidebar .block>ul>li{margin-right:-10px;}.content,nav{max-width:960px;}.hidden{display:none !important;}.logo-container{height:100px;width:100px;position:relative;margin:20px auto;display:block;margin-top:10px;}.logo-container>img{max-width:100px;max-height:100px;height:100%;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;}.sidebar .location{border:1px solid;font-size:17px;margin:30px 10px 20px 10px;text-align:center;word-wrap:break-word;font-weight:inherit;padding:0;}.sidebar .version{font-size:15px;text-align:center;border-bottom:1px solid;overflow-wrap:break-word;word-wrap:break-word;word-break:break-word;}.location:empty{border:none;}.location a:first-of-type{font-weight:500;}.location a:hover{text-decoration:underline;}.block{padding:0;margin-bottom:14px;}.block h2,.block h3{text-align:center;}.block ul,.block li{margin:0 10px;padding:0;list-style:none;}.block a{display:block;text-overflow:ellipsis;overflow:hidden;line-height:15px;padding:7px 5px;font-size:14px;font-weight:300;transition:border 500ms ease-out;}.sidebar-title{border-top:1px solid;border-bottom:1px solid;text-align:center;font-size:17px;margin-bottom:5px;font-weight:inherit;padding:0;}.sidebar-links{margin-bottom:15px;}.sidebar-links>a{padding-left:10px;width:100%;}.sidebar-menu{display:none;}.content{padding:15px 0;}.source .content pre.rust{white-space:pre;overflow:auto;padding-left:0;}.rustdoc .example-wrap{display:inline-flex;margin-bottom:10px;}.example-wrap{position:relative;width:100%;}.example-wrap>pre.line-number{overflow:initial;border:1px solid;padding:13px 8px;text-align:right;border-top-left-radius:5px;border-bottom-left-radius:5px;}.example-wrap>pre.rust a:hover{text-decoration:underline;}.rustdoc:not(.source) .example-wrap>pre:not(.line-number){width:100%;overflow-x:auto;}.rustdoc .example-wrap>pre{margin:0;}#search{margin-left:230px;position:relative;}#results>table{width:100%;table-layout:fixed;}.content>.example-wrap pre.line-numbers{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.line-numbers span{cursor:pointer;}.docblock-short{overflow-wrap:anywhere;}.docblock-short p{display:inline;}.docblock-short p{overflow:hidden;text-overflow:ellipsis;margin:0;}.docblock>:not(pre)>code,.docblock-short>:not(pre)>code{white-space:pre-wrap;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5{border-bottom:1px solid;}.top-doc .docblock h1{font-size:1.3em;}.top-doc .docblock h2{font-size:1.15em;}.top-doc .docblock h3,.top-doc .docblock h4,.top-doc .docblock h5{font-size:1em;}.docblock h1{font-size:1em;}.docblock h2{font-size:0.95em;}.docblock h3,.docblock h4,.docblock h5{font-size:0.9em;}.docblock{margin-left:24px;position:relative;}.content .out-of-band{flex-grow:0;text-align:right;font-size:23px;margin:0px;padding:0 0 0 12px;font-weight:normal;}.method>.code-header,.trait-impl>.code-header,.invisible>.code-header{max-width:calc(100% - 41px);display:block;}.invisible{width:100%;display:inline-block;}.content .in-band{flex-grow:1;margin:0px;padding:0px;}.in-band>code,.in-band>.code-header{display:inline-block;}#main{position:relative;}#main>.since{top:inherit;font-family:"Fira Sans",Arial,sans-serif;}.content table:not(.table-display){border-spacing:0 5px;}.content td{vertical-align:top;}.content td:first-child{padding-right:20px;}.content td p:first-child{margin-top:0;}.content td h1,.content td h2{margin-left:0;font-size:1.1em;}.content tr:first-child td{border-top:0;}.docblock table{margin:.5em 0;width:calc(100% - 2px);overflow-x:auto;display:block;}.docblock table td{padding:.5em;border:1px dashed;}.docblock table th{padding:.5em;text-align:left;border:1px solid;}.fields+table{margin-bottom:1em;}.content .item-list{list-style-type:none;padding:0;}.content .multi-column{-moz-column-count:5;-moz-column-gap:2.5em;-webkit-column-count:5;-webkit-column-gap:2.5em;column-count:5;column-gap:2.5em;}.content .multi-column li{width:100%;display:inline-block;}.content>.methods>.method{font-size:1em;position:relative;}.content .method .where,.content .fn .where,.content .where.fmt-newline{display:block;font-size:0.8em;}.content .methods>div:not(.notable-traits):not(.method){margin-left:40px;margin-bottom:15px;}.content .docblock>.impl-items{margin-left:20px;margin-top:-34px;}.content .docblock>.impl-items .table-display{margin:0;}.content .docblock>.impl-items table td{padding:0;}.content .docblock>.impl-items .table-display,.impl-items table td{border:none;}.content .item-info code{font-size:90%;}.content .item-info{position:relative;margin-left:33px;}.sub-variant>div>.item-info{margin-top:initial;}.content .item-info::before{content:'⬑';font-size:25px;position:absolute;top:-6px;left:-19px;}.content .impl-items .method,.content .impl-items>.type,.impl-items>.associatedconstant,.impl-items>.associatedtype,.content .impl-items details>summary>.type,.impl-items details>summary>.associatedconstant,.impl-items details>summary>.associatedtype{margin-left:20px;}.content .impl-items .docblock,.content .impl-items .item-info{margin-bottom:.6em;}.content .impl-items>.item-info{margin-left:40px;}.methods>.item-info,.content .impl-items>.item-info{margin-top:-8px;}.impl-items{flex-basis:100%;}#main>.item-info{margin-top:0;}nav:not(.sidebar){border-bottom:1px solid;padding-bottom:10px;margin-bottom:10px;}nav.main{padding:20px 0;text-align:center;}nav.main .current{border-top:1px solid;border-bottom:1px solid;}nav.main .separator{border:1px solid;display:inline-block;height:23px;margin:0 20px;}nav.sum{text-align:right;}nav.sub form{display:inline;}nav.sub,.content{margin-left:230px;}a{text-decoration:none;background:transparent;}.small-section-header{display:flex;justify-content:space-between;position:relative;}.small-section-header:hover>.anchor{display:initial;}.in-band:hover>.anchor,.impl:hover>.anchor,.method.trait-impl:hover>.anchor,.type.trait-impl:hover>.anchor,.associatedconstant.trait-impl:hover>.anchor,.associatedtype.trait-impl:hover>.anchor{display:inline-block;position:absolute;}.anchor{display:none;position:absolute;left:0;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.anchor::before{content:'§';}.docblock a:not(.srclink):not(.test-arrow):hover,.docblock-short a:not(.srclink):not(.test-arrow):hover,.item-info a{text-decoration:underline;}.invisible>.srclink,.method>.code-header+.srclink{position:absolute;top:0;right:0;font-size:17px;font-weight:normal;}.block a.current.crate{font-weight:500;}.item-table{display:grid;column-gap:1.2rem;row-gap:0.0rem;grid-template-columns:auto 1fr;justify-items:start;}.item-left,.item-right{display:block;}.item-left{grid-column:1;}.item-right{grid-column:2;}.search-container{position:relative;}.search-container>div{display:inline-flex;width:calc(100% - 63px);}#crate-search{min-width:115px;margin-top:5px;padding:6px;padding-right:19px;flex:none;border:0;border-right:0;border-radius:4px 0 0 4px;outline:none;cursor:pointer;border-right:1px solid;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;text-overflow:"";background-repeat:no-repeat;background-color:transparent;background-size:20px;background-position:calc(100% - 1px) 56%;}.search-container>.top-button{position:absolute;right:0;top:10px;}.search-input{-moz-box-sizing:border-box !important;box-sizing:border-box !important;outline:none;border:none;border-radius:1px;margin-top:5px;padding:10px 16px;font-size:17px;transition:border-color 300ms ease;transition:border-radius 300ms ease-in-out;transition:box-shadow 300ms ease-in-out;width:100%;}#crate-search+.search-input{border-radius:0 1px 1px 0;width:calc(100% - 32px);}.search-input:focus{border-radius:2px;border:0;outline:0;}.search-results{display:none;padding-bottom:2em;}.search-results.active{display:block;clear:both;}.search-results .desc>span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:block;}.search-results>a{display:block;width:100%;margin-left:2px;margin-right:2px;border-bottom:1px solid #aaa3;}.search-results>a>div{display:flex;flex-flow:row wrap;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:50%;}.search-results .result-name{padding-right:1em;}.search-results .result-name>span{display:inline-block;margin:0;font-weight:normal;}body.blur>:not(#help){filter:blur(8px);-webkit-filter:blur(8px);opacity:.7;}#help{width:100%;height:100vh;position:fixed;top:0;left:0;display:flex;justify-content:center;align-items:center;}#help>div{flex:0 0 auto;box-shadow:0 0 6px rgba(0,0,0,.2);width:550px;height:auto;border:1px solid;}#help dt{float:left;clear:left;display:block;margin-right:0.5rem;}#help>div>span{text-align:center;display:block;margin:10px 0;font-size:18px;border-bottom:1px solid #ccc;padding-bottom:4px;margin-bottom:6px;}#help dd{margin:5px 35px;}#help .infos{padding-left:0;}#help h1,#help h2{margin-top:0;}#help>div div{width:50%;float:left;padding:0 20px 20px 17px;;}.item-info .stab{display:table;}.stab{border-width:1px;border-style:solid;padding:3px;margin-bottom:5px;font-size:90%;font-weight:normal;}.stab p{display:inline;}.stab .emoji{font-size:1.5em;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.module-item .stab,.import-item .stab{border-radius:3px;display:inline-block;font-size:80%;line-height:1.2;margin-bottom:0;margin-left:.3em;padding:2px;vertical-align:text-bottom;}.module-item.unstable,.import-item.unstable{opacity:0.65;}.since{font-weight:normal;font-size:initial;}.impl-items .since,.impl .since,.methods .since{padding-left:12px;padding-right:2px;position:initial;}.impl-items .srclink,.impl .srclink,.methods .srclink{font-size:17px;font-weight:normal;}.rightside{float:right;}.has-srclink{font-size:16px;margin-bottom:12px;justify-content:space-between;}.variants_table{width:100%;}.variants_table tbody tr td:first-child{width:1%;}td.summary-column{width:100%;}.summary{padding-right:0px;}pre.rust .question-mark{font-weight:bold;}a.test-arrow{display:inline-block;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:130%;top:5px;right:5px;z-index:1;}a.test-arrow:hover{text-decoration:none;}.section-header:hover a:before{position:absolute;left:-25px;padding-right:10px;content:'\2002\00a7\2002';}.section-header:hover a{text-decoration:none;}.section-header a{color:inherit;}.code-attribute{font-weight:300;}.since+.srclink{padding-left:10px;}.item-spacer{width:100%;height:12px;}.out-of-band>span.since{position:initial;font-size:20px;margin-right:5px;}.sub-variant,.sub-variant>h3{margin-top:0px !important;padding-top:1px;}#main .sub-variant>h3{font-size:15px;margin-left:25px;margin-bottom:5px;}.sub-variant>div{margin-left:20px;margin-bottom:10px;}.sub-variant>div>span{display:block;position:relative;}.toggle-label{display:inline-block;margin-left:4px;margin-top:3px;}.docblock>.section-header:first-child{margin-left:15px;margin-top:0;}.docblock>.section-header:first-child:hover>a:before{left:-10px;}:target>code,:target>.code-header{opacity:1;}:target{padding-right:3px;}.information{position:absolute;left:-25px;margin-top:7px;z-index:1;}.tooltip{position:relative;display:inline-block;cursor:pointer;}.tooltip::after{display:none;text-align:center;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;font-size:16px;}.tooltip.ignore::after{content:"This example is not tested";}.tooltip.compile_fail::after{content:"This example deliberately fails to compile";}.tooltip.should_panic::after{content:"This example panics";}.tooltip.edition::after{content:"This code runs with edition " attr(data-edition);}.tooltip::before{content:" ";position:absolute;top:50%;left:16px;margin-top:-5px;border-width:5px;border-style:solid;display:none;}.tooltip:hover::before,.tooltip:hover::after{display:inline;}.tooltip.compile_fail,.tooltip.should_panic,.tooltip.ignore{font-weight:bold;font-size:20px;}.notable-traits-tooltip{display:inline-block;cursor:pointer;}.notable-traits:hover .notable-traits-tooltiptext,.notable-traits .notable-traits-tooltiptext.force-tooltip{display:inline-block;}.notable-traits .notable-traits-tooltiptext{display:none;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;z-index:10;font-size:16px;cursor:default;position:absolute;border:1px solid;}.notable-traits-tooltip::after{content:"\00a0\00a0\00a0";}.notable-traits .notable,.notable-traits .docblock{margin:0;}.notable-traits .notable{margin:0;margin-bottom:13px;font-size:19px;font-weight:600;}.notable-traits .docblock code.content{margin:0;padding:0;font-size:20px;}pre.rust.rust-example-rendered{position:relative;}pre.rust{tab-size:4;-moz-tab-size:4;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#titles{height:35px;}#titles>button{float:left;width:33.3%;text-align:center;font-size:18px;cursor:pointer;border:0;border-top:2px solid;}#titles>button:not(:last-child){margin-right:1px;width:calc(33.3% - 1px);}#titles>button>div.count{display:inline-block;font-size:16px;}.notable-traits{cursor:pointer;z-index:2;margin-left:5px;}#all-types{text-align:center;border:1px solid;margin:0 10px;margin-bottom:10px;display:block;border-radius:7px;}#all-types>p{margin:5px 0;}#sidebar-toggle{position:fixed;top:30px;left:300px;z-index:10;padding:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;cursor:pointer;font-weight:bold;transition:left .5s;font-size:1.2em;border:1px solid;border-left:0;}#source-sidebar{position:fixed;top:0;bottom:0;left:0;width:300px;z-index:1;overflow:auto;transition:left .5s;border-right:1px solid;}#source-sidebar>.title{font-size:1.5em;text-align:center;border-bottom:1px solid;margin-bottom:6px;}.theme-picker{position:absolute;left:211px;top:19px;}.theme-picker button{outline:none;}#settings-menu,#help-button{position:absolute;top:10px;}#settings-menu{right:0;outline:none;}#theme-picker,#settings-menu,#help-button,#copy-path{padding:4px;width:27px;height:29px;border:1px solid;border-radius:3px;cursor:pointer;}#help-button{right:30px;font-family:"Fira Sans",Arial,sans-serif;text-align:center;font-size:17px;padding-top:2px;}#copy-path{background:initial;margin-left:10px;padding:0;padding-left:2px;border:0;}#theme-choices{display:none;position:absolute;left:0;top:28px;border:1px solid;border-radius:3px;z-index:1;cursor:pointer;}#theme-choices>button{border:none;width:100%;padding:4px 8px;text-align:center;background:rgba(0,0,0,0);}#theme-choices>button:not(:first-child){border-top:1px solid;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px;border-radius:3px;box-shadow:inset 0 -1px 0;cursor:default;}.hidden-by-impl-hider,.hidden-by-usual-hider{display:none !important;}#implementations-list>h3>span.in-band{width:100%;}.table-display{width:100%;border:0;border-collapse:collapse;border-spacing:0;font-size:16px;}.table-display tr td:first-child{padding-right:0;}.table-display tr td:last-child{float:right;}.table-display .out-of-band{position:relative;font-size:19px;display:block;}#implementors-list>.impl-items .table-display .out-of-band{font-size:17px;}.table-display td:hover .anchor{display:block;top:2px;left:-5px;}#main>ul{padding-left:10px;}#main>ul>li{list-style:none;}.non-exhaustive{margin-bottom:1em;}div.children{padding-left:27px;display:none;}div.name{cursor:pointer;position:relative;margin-left:16px;}div.files>a{display:block;padding:0 3px;}div.files>a:hover,div.name:hover{background-color:#a14b4b;}div.name.expand+.children{display:block;}div.name::before{content:"\25B6";padding-left:4px;font-size:0.7em;position:absolute;left:-16px;top:4px;}div.name.expand::before{transform:rotate(90deg);left:-15px;top:2px;}details.rustdoc-toggle>summary.hideme{cursor:pointer;}details.rustdoc-toggle>summary,details.undocumented>summary{list-style:none;}details.rustdoc-toggle>summary::-webkit-details-marker,details.rustdoc-toggle>summary::marker,details.undocumented>summary::-webkit-details-marker,details.undocumented>summary::marker{display:none;}details.rustdoc-toggle>summary.hideme>span{margin-left:9px;}details.rustdoc-toggle>summary::before{content:"";cursor:pointer;width:17px;height:max(17px,1.1em);background-repeat:no-repeat;background-position:top left;display:inline-block;vertical-align:middle;opacity:.5;}details.rustdoc-toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.rustdoc-toggle>summary.hideme::after{content:"";}details.rustdoc-toggle>summary:focus::before,details.rustdoc-toggle>summary:hover::before{opacity:1;}details.rustdoc-toggle.top-doc>summary,details.rustdoc-toggle.top-doc>summary::before,details.rustdoc-toggle.non-exhaustive>summary,details.rustdoc-toggle.non-exhaustive>summary::before{font-family:'Fira Sans';font-size:16px;}details.non-exhaustive{margin-bottom:8px;}details.rustdoc-toggle>summary.hideme::before{position:relative;}details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-23px;top:3px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before,.undocumented>details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-2px;}details.rustdoc-toggle[open] >summary.hideme{position:absolute;}details.rustdoc-toggle,details.undocumented{position:relative;}details.rustdoc-toggle[open] >summary.hideme>span{display:none;}details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{width:17px;height:max(17px,1.1em);background-repeat:no-repeat;background-position:top left;display:inline-block;content:"";}details.rustdoc-toggle[open] >summary::after,details.rustdoc-toggle[open] >summary.hideme::after{content:"Collapse";}details.undocumented>summary::before{padding-left:17px;height:max(17px,1.1em);background-repeat:no-repeat;background-position:top left;content:"Show hidden undocumented items";cursor:pointer;font-size:16px;font-weight:300;opacity:.5;}details.undocumented>summary:focus::before,details.undocumented>summary:hover::before{opacity:1;}details.undocumented[open] >summary::before{padding-left:17px;height:max(17px,1.1em);background-repeat:no-repeat background-position:top left;content:"Hide undocumented items";}@media (min-width:701px){.docblock>.information:first-child>.tooltip{margin-top:16px;}}@media (max-width:700px){body{padding-top:0px;}.rustdoc>.sidebar{height:45px;min-height:40px;margin:0;margin-left:-15px;padding:0 15px;position:static;z-index:11;}.sidebar>.location{float:right;margin:0px;margin-top:2px;padding:3px 10px 1px 10px;min-height:39px;background:inherit;text-align:left;font-size:24px;}.sidebar .location:empty{padding:0;}.sidebar .logo-container{width:35px;height:35px;margin-top:5px;margin-bottom:5px;float:left;margin-left:50px;}.sidebar .logo-container>img{max-width:35px;max-height:35px;}.sidebar-menu{position:fixed;z-index:10;font-size:2rem;cursor:pointer;width:45px;left:0;text-align:center;display:block;border-bottom:1px solid;border-right:1px solid;height:45px;}.rustdoc.source>.sidebar>.sidebar-menu{display:none;}.sidebar-elems{position:fixed;z-index:1;top:45px;bottom:0;width:246px;left:-246px;overflow-y:auto;border-right:1px solid;}.sidebar>.block.version{overflow:hidden;border-bottom:none;margin-bottom:0;height:100%;padding-left:12px;}.sidebar>.block.version>div.narrow-helper{float:left;width:1px;height:100%;}.sidebar>.block.version>p{margin:0;min-width:55px;display:flex;align-items:center;height:100%;}nav.sub{width:calc(100% - 32px);float:right;}.content{margin-left:0px;}#main,#search{margin-top:45px;padding:0;}#search{margin-left:0;}.anchor{display:none !important;}.theme-picker{left:10px;top:54px;z-index:1;}.notable-traits{position:absolute;left:-22px;top:24px;}#titles>button>div.count{float:left;width:100%;}#titles{height:50px;}.sidebar.mobile{position:fixed;width:100%;margin-left:0;background-color:rgba(0,0,0,0);height:100%;}.sidebar.mobile>div.version{overflow:hidden;max-height:33px;}.sidebar{width:calc(100% + 30px);}.show-it,.sidebar-elems:focus-within{z-index:2;left:0;}.show-it>.block.items{margin:8px 0;}.show-it>.block.items>ul{margin:0;}.show-it>.block.items>ul>li{text-align:center;margin:2px 0;}.show-it>.block.items>ul>li>a{font-size:21px;}#sidebar-filler{position:fixed;left:45px;width:calc(100% - 45px);top:0;height:45px;z-index:-1;border-bottom:1px solid;}#main>details.rustdoc-toggle>summary::before,#main>div>details.rustdoc-toggle>summary::before{left:-11px;}#all-types{margin:10px;}#sidebar-toggle{top:100px;width:30px;font-size:1.5rem;text-align:center;padding:0;}#source-sidebar{z-index:11;}#main>.line-numbers{margin-top:0;}.notable-traits .notable-traits-tooltiptext{left:0;top:100%;}#help-button{display:none;}.item-table{display:flex;flex-flow:column wrap;}.item-left,.item-right{width:100%;}.search-container>div{width:calc(100% - 32px);}.search-results>a{border-bottom:1px solid #aaa9;padding:5px 0px;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:100%;}.search-results div.desc,.search-results .result-description,.item-right{padding-left:2em;}}@media print{nav.sub,.content .out-of-band{display:none;}}@media (max-width:464px){#titles,#titles>button{height:73px;}#main,#search{margin-top:100px;}#main>table:not(.table-display) td{word-break:break-word;width:50%;}.search-container>div{display:block;width:calc(100% - 37px);}#crate-search{width:100%;border-radius:4px;border:0;}#crate-search+.search-input{width:calc(100% + 71px);margin-left:-36px;}#theme-picker,#settings-menu{padding:5px;width:31px;height:31px;}#theme-picker{margin-top:-2px;}#settings-menu{top:7px;}.docblock{margin-left:12px;}}details.undocumented[open] >summary::before,details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{background-image:url(toggle-minus.svg);}details.undocumented>summary::before,details.rustdoc-toggle>summary::before{background-image:url(toggle-plus.svg);} \ No newline at end of file diff --git a/0.10.2/search-index.js b/0.10.2/search-index.js new file mode 100644 index 000000000..2c8b3d86f --- /dev/null +++ b/0.10.2/search-index.js @@ -0,0 +1,4 @@ +var searchIndex = JSON.parse('{\ +"chemfiles":{"doc":"Chemfiles is a multi-language library written in modern …","t":[13,13,3,3,3,4,13,4,13,13,13,13,3,13,13,3,3,13,3,13,13,13,3,4,13,13,13,3,3,3,13,13,4,13,13,13,3,3,3,13,13,13,3,3,3,13,13,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,12,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,12,11,5,11,11,11,11,12,12,12,12,12],"n":["Amide","Aromatic","Atom","AtomMut","AtomRef","BondOrder","Bool","CellShape","ChemfilesError","ConfigurationError","Double","Double","Error","FileError","FormatError","FormatMetadata","Frame","Infinite","Match","MemoryError","Orthorhombic","OutOfBounds","PropertiesIter","Property","PropertyError","Quadruple","Quintuplet","Residue","ResidueRef","Selection","SelectionError","Single","Status","StdCppError","String","Success","Topology","TopologyRef","Trajectory","Triclinic","Triple","UTF8PathError","UnitCell","UnitCellMut","UnitCellRef","Unknown","Vector3D","add_atom","add_atom","add_atom","add_bond","add_bond","add_bond_with_order","add_bond_with_order","add_configuration","add_residue","add_residue","add_velocities","angle","angles","angles","angles_count","are_linked","atom","atom","atom_mut","atom_mut","atomic_number","atomic_type","atoms","atoms","bond_order","bond_orders","bonds","bonds","bonds_count","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","cell","cell_mut","charge","cleanup","clear_bonds","clear_bonds","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","contains","count","covalent_radius","deref","deref","deref","deref","deref","deref","deref_mut","deref_mut","description","description","dihedral","dihedrals","dihedrals_count","distance","drop","drop","drop","drop","drop","drop","drop","eq","eq","eq","eq","eq","eq","eq","evaluate","extension","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","formats_list","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_matrix","full_name","get","get","get","guess_bonds","guess_format","has_velocities","id","impropers","impropers_count","index","infinite","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into_iter","iter","last_error","len","lengths","list","mass","matrix","memory","memory_buffer","memory_reader","memory_writer","message","name","name","name","ne","ne","ne","ne","new","new","new","new","new","new","new","next","nsteps","open","open_with_format","out_of_plane","partial_cmp","partial_cmp","path","positions","positions","positions_mut","properties","properties","properties","read","read","read_step","reference","remove","remove","remove_bond","remove_bond","residue","residue_for_atom","residues","residues_count","resize","resize","set","set","set","set_angles","set_atomic_type","set_cell","set_cell","set_charge","set_lengths","set_mass","set_name","set_shape","set_step","set_topology","set_topology","set_topology_file","set_topology_with_format","set_warning_callback","shape","size","size","size","size","size_hint","status","step","string","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","topology","triclinic","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","unit_cell","vdw_radius","velocities","velocities","velocities_mut","version","volume","with_id","wrap","write","write","0","0","0","0"],"q":["chemfiles","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","chemfiles::Property","","",""],"d":["Amide bond (required by some file formats)","Aromatic bond (required by some file formats)","An Atom is a particle in the current Frame. It stores the …","An analog to a mutable reference to an atom (&mut Atom)","An analog to a reference to an atom (&Atom)","Possible bond order associated with bonds","Boolean property","Available unit cell shapes.","Exception in the C++ chemfiles library","Error in configuration files syntax","Double bond","Floating point property","Error type for Chemfiles.","Error while reading or writing a file","Error in file formatting, i.e. the file is invalid","FormatMetadata contains metadata associated with one …","A Frame contains data from one simulation step: the …","Infinite cell, to use when there is no cell.","A Match is a set of atomic indexes matching a given …","Error in memory allocations","Orthorhombic cell, with the three angles equals to 90°.","Error for out of bounds indexing","An iterator over the properties in an atom/frame/residue","A Property is a piece of data that can be associated with …","Error related to properties","Quadruple bond (present in some metals)","Quintuplet bond (present in some metals)","A Residue is a group of atoms belonging to the same …","An analog to a reference to a residue (&Residue)","A Selection allow to select atoms in a Frame, from a …","Error in selection string syntax","Single bond","Possible causes of error in chemfiles","Exception in the C++ standard library","String property","No error","A Topology contains the definition of all the atoms in the …","An analog to a reference to a topology (&Topology)","The Trajectory type is the main entry point when using …","Triclinic cell, with any values for the angles.","Triple bond","The given path is not valid UTF8","An UnitCell represent the box containing the atoms, and …","An analog to a mutable reference to an unit cell (…","An analog to a reference to an unit cell (&UnitCell)","Unknown or unspecified bond order","3-dimensional vector property","Add the atom at index atom in this residue.","Add an Atom at the end of this topology","Add an Atom and the corresponding position and optionally …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Read configuration data from the file at path.","Add a residue to this topology.","Add a copy of residue to this frame.","Add velocity data to this frame. If the frame already have …","Get the angle formed by the atoms at indexes i, j and k in …","Get the three angles of the cell, in degrees.","Get the list of angles in the topology.","Get the number of angles in the topology.","Check if the two residues first and second from the …","Get a reference of the atom at the given index in this …","Get a reference to the atom at the given index in this …","Get a mutable reference to the atom at the given index in …","Get a mutable reference to the atom at the given index in …","Try to get the atomic number of the atom from the atomic …","Get the atom type.","Get the list of atoms of this residue.","Does this format support storing atom names or types?","Get the bond order for the bond between the atoms at …","Get the bond order for all the bonds in the topology","Get the list of bonds in the topology.","Does this format support storing bonds between atoms?","Get the number of bonds in the topology.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get a reference to the UnitCell from this frame.","Get a mutable reference to the UnitCell from this frame.","Get the atom charge, in number of the electron charge e.","Clear any error from the C++ library","Remove all existing bonds, angles, dihedral angles and …","Remove all existing bonds, angles, dihedral angles and …","","","","","","","","","","","","","","","","","","","","","","","","","","","","Check if the atom at index i is in this residue","","Try to get the covalent radius of the atom from the atomic …","","","","","","","","","","Extended, user-facing description of the format.","Get the dihedral angle formed by the atoms at indexes i, j…","Get the list of dihedral angles in the topology.","Get the number of dihedral angles in the topology.","Get the distance between the atoms at indexes i and j in …","","","","","","","","","","","","","","","Evaluate a selection for a given frame, and return the …","Extension associated with the format.","","","","","","","","","Get the list of formats known by chemfiles, as well as all …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Create an UnitCell from a cell matrix. If matrix contains …","Try to get the full name of the atom from the atomic type. …","Get a property with the given name in this atom, if it …","Get a property with the given name in this frame, if it …","Get a property with the given name in this frame, if it …","Guess the bonds, angles and dihedrals in this frame.","Get the format that chemfiles would use to read a file at …","Check if this frame contains velocity data.","Get the identifier of this residue in the initial topology …","Get the list of improper dihedral angles in the topology.","Get the number of improper dihedral angles in the topology.","","Create an Infinite UnitCell.","","","","","","","","","","","","","","","","","","","","","","","Iterate over the atomic indexes in the match.","Get the last error message from the C++ library.","Get the length of the Match.","Get the three lengths of the cell, in Angstroms.","Evaluates a selection of size 1 on a given frame. This …","Get the atom mass, in atomic mass units.","Get the unit cell matricial representation.","Does this format support in-memory IO?","Obtain the memory buffer written to by the trajectory.","Read a memory buffer as though it was a formatted file.","Write to a memory buffer as though it was a formatted file.","A message describing the error cause","Get the atom name.","Get the name of this residue.","Name of the format.","","","","","Create an atom with the given name, and set the atom type …","Create an Orthorhombic UnitCell from the three lengths, in …","Create a new residue with the given name","Create a new empty topology.","Create an empty frame. It will be resized by the library …","Create a new selection from the given selection string.","Create a new match containing the atoms in the atoms slice.","","Get the number of steps (the number of frames) in a …","Open the file at the given path in the given mode.","Open the file at the given path using a specific file …","Get the out of plane distance formed by the atoms at …","","","Get file path for this trajectory.","Get a view into the positions of this frame.","Does this format support storing atomic positions?","Get a mutable view into the positions of this frame.","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Read the next step of this trajectory into a frame.","Is reading files in this format implemented?","Read a specific step of this trajectory into a frame.","URL pointing to the format definition/reference.","Remove an Atom from this topology by index. This modify …","Remove the atom at index i in this frame.","Remove any existing bond between the atoms at indexes i …","Remove any existing bond between the atoms at indexes i …","Get a reference to the residue at index index from this …","Get a copy of the residue containing the atom at index …","Does this format support storing residues?","Get the number of residues in this topology.","Resize this topology to hold natoms atoms, inserting dummy …","Resize the positions and the velocities in this frame, to …","Add a new property with the given name to this atom.","Add a new property with the given name to this residue.","Add a new property with the given name to this frame.","Set the three angles of the cell, in degrees.","Set the atom type to atomic_type.","Set the UnitCell of this frame to cell.","Set the unit cell associated with a trajectory. This cell …","Set the atom charge to charge, in number of the electron …","Set the three lengths of the cell, in Angstroms.","Set the atom mass to mass, in atomic mass units.","Set the atom name to name.","Set the shape of the unit cell to shape.","Set this frame step to step.","Set the Topology of this frame to topology.","Set the topology associated with this trajectory. This …","Set the topology associated with this trajectory by …","Set the topology associated with this trajectory by …","Use callback for every chemfiles warning. The callback …","Get the shape of the unit cell.","Get the number of atoms in this residue.","Get the current number of atoms in this topology.","Get the current number of atoms in this frame.","Get the size of the selection, i.e. the number of atoms we …","","The error status code","Get this frame step, i.e. the frame number in the …","Get the selection string used to create this selection.","","","","","","","","","","","","","","","Get a reference to the Topology of this frame.","Create an Triclinic UnitCell from the three lengths (in …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Does this format support storing unit cell information?","Try to get the Van der Waals radius of the atom from the …","Get a view into the velocities of this frame.","Does this format support storing atomic velocities?","Get a mutable view into the velocities of this frame.","Get the version of the chemfiles library.","Get the volume of the unit cell.","Create a new residue with the given name and id as …","Wrap a vector in this unit cell.","Write a frame to this trajectory.","Is writing files in this format implemented?","","","",""],"i":[1,1,0,0,0,0,2,0,3,3,1,2,0,3,3,0,0,4,0,3,4,3,0,0,3,1,1,0,0,0,3,1,0,3,2,3,0,0,0,4,1,3,0,0,0,1,2,5,6,7,6,7,6,7,0,6,7,7,7,8,6,6,6,6,7,6,7,9,9,5,10,6,6,6,10,6,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,7,7,9,20,6,7,9,8,5,6,7,18,20,3,4,1,21,2,10,9,8,5,6,7,18,20,3,4,1,21,2,10,1,5,19,9,11,12,13,14,15,16,12,14,20,10,7,6,6,7,9,8,5,6,7,17,18,20,3,4,1,21,2,10,18,10,20,20,3,4,1,21,2,10,0,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,20,20,3,4,4,1,1,21,2,2,2,2,2,2,10,8,9,9,5,7,7,0,7,5,6,6,21,8,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,19,21,20,21,8,18,9,8,10,17,17,17,20,9,5,10,20,21,2,10,9,8,5,6,7,18,21,19,17,17,17,7,1,2,17,7,10,7,9,5,7,17,10,17,10,6,7,6,7,6,6,10,6,6,7,9,5,7,8,9,7,17,9,8,9,9,8,7,7,17,17,17,0,8,5,6,7,18,19,20,7,18,9,8,5,6,7,18,20,3,4,1,21,2,10,20,7,8,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,10,9,7,10,7,0,8,5,8,17,10,22,23,24,25],"f":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["usize",15]]],[[["atom",3]]],[[["atom",3]]],[[["usize",15]]],[[["usize",15]]],[[["usize",15],["bondorder",4]]],[[["usize",15],["bondorder",4]]],[[],[["error",3],["result",4,["error"]]]],[[["residue",3]],[["error",3],["result",4,["error"]]]],[[["residue",3]],[["error",3],["result",4,["error"]]]],[[]],[[["usize",15]],["f64",15]],[[]],[[],["vec",3]],[[],["usize",15]],[[["residue",3]],["bool",15]],[[["usize",15]],["atomref",3]],[[["usize",15]],["atomref",3]],[[["usize",15]],["atommut",3]],[[["usize",15]],["atommut",3]],[[],["u64",15]],[[],["string",3]],[[],[["vec",3,["usize"]],["usize",15]]],null,[[["usize",15]],["bondorder",4]],[[],[["vec",3,["bondorder"]],["bondorder",4]]],[[],["vec",3]],null,[[],["usize",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["unitcellref",3]],[[],["unitcellmut",3]],[[],["f64",15]],[[]],[[]],[[]],[[],["atom",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["frame",3]],[[],["selection",3]],[[],["error",3]],[[],["status",4]],[[],["cellshape",4]],[[],["bondorder",4]],[[],["match",3]],[[],["property",4]],[[],["formatmetadata",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["bondorder",4]],["ordering",4]],[[["usize",15]],["bool",15]],[[],["usize",15]],[[],["f64",15]],[[],["atom",3]],[[],["atom",3]],[[],["unitcell",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["atom",3]],[[],["unitcell",3]],[[],["str",15]],null,[[["usize",15]],["f64",15]],[[],["vec",3]],[[],["usize",15]],[[["usize",15]],["f64",15]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["error",3]],["bool",15]],[[["status",4]],["bool",15]],[[["cellshape",4]],["bool",15]],[[["bondorder",4]],["bool",15]],[[["match",3]],["bool",15]],[[["property",4]],["bool",15]],[[["formatmetadata",3]],["bool",15]],[[["frame",3]],[["match",3],["vec",3,["match"]]]],null,[[["formatter",3]],[["error",3],["result",4,["error"]]]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[["formatter",3]],["result",6]],[[],[["vec",3,["formatmetadata"]],["formatmetadata",3]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["utf8error",3]]],[[]],[[["chfl_status",4]],["error",3]],[[]],[[]],[[["chfl_cellshape",4]],["cellshape",4]],[[["chfl_bond_order",4]],["bondorder",4]],[[]],[[]],[[["bool",15]]],[[["f64",15]]],[[["string",3]]],[[]],[[["str",15]]],[[]],[[]],[[],["unitcell",3]],[[],["string",3]],[[["str",15]],[["property",4],["option",4,["property"]]]],[[["str",15]],[["property",4],["option",4,["property"]]]],[[["str",15]],[["property",4],["option",4,["property"]]]],[[],[["error",3],["result",4,["error"]]]],[[["str",15]],["string",3]],[[],["bool",15]],[[],[["option",4,["i64"]],["i64",15]]],[[],["vec",3]],[[],["usize",15]],[[["usize",15]]],[[],["unitcell",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],[["usize",15],["iter",3,["usize"]]]],[[],["string",3]],[[],["usize",15]],[[]],[[["frame",3]],[["vec",3,["usize"]],["usize",15]]],[[],["f64",15]],[[]],null,[[],[["str",15],["result",4,["str","error"]],["error",3]]],[[],[["error",3],["result",4,["trajectory","error"]],["trajectory",3]]],[[],[["error",3],["result",4,["trajectory","error"]],["trajectory",3]]],null,[[],["string",3]],[[],["string",3]],null,[[["error",3]],["bool",15]],[[["match",3]],["bool",15]],[[["property",4]],["bool",15]],[[["formatmetadata",3]],["bool",15]],[[],["atom",3]],[[],["unitcell",3]],[[],["residue",3]],[[],["topology",3]],[[],["frame",3]],[[["str",15],["into",8,["str"]]],[["error",3],["result",4,["selection","error"]],["selection",3]]],[[],["match",3]],[[],["option",4]],[[],["usize",15]],[[["char",15]],[["error",3],["result",4,["trajectory","error"]],["trajectory",3]]],[[["char",15]],[["error",3],["result",4,["trajectory","error"]],["trajectory",3]]],[[["usize",15]],["f64",15]],[[["bondorder",4]],[["option",4,["ordering"]],["ordering",4]]],[[["property",4]],[["option",4,["ordering"]],["ordering",4]]],[[],["string",3]],[[]],null,[[]],[[],["propertiesiter",3]],[[],["propertiesiter",3]],[[],["propertiesiter",3]],[[["frame",3]],[["error",3],["result",4,["error"]]]],null,[[["usize",15],["frame",3]],[["error",3],["result",4,["error"]]]],null,[[["usize",15]]],[[["usize",15]]],[[["usize",15]]],[[["usize",15]]],[[["u64",15]],[["residueref",3],["option",4,["residueref"]]]],[[["usize",15]],[["residueref",3],["option",4,["residueref"]]]],null,[[],["u64",15]],[[["usize",15]]],[[["usize",15]]],[[["str",15]]],[[["str",15]]],[[["str",15]]],[[],[["error",3],["result",4,["error"]]]],[[]],[[["unitcell",3]]],[[["unitcell",3]]],[[["f64",15]]],[[],[["error",3],["result",4,["error"]]]],[[["f64",15]]],[[]],[[["cellshape",4]],[["error",3],["result",4,["error"]]]],[[["usize",15]]],[[["topology",3]],[["error",3],["result",4,["error"]]]],[[["topology",3]]],[[],[["error",3],["result",4,["error"]]]],[[],[["error",3],["result",4,["error"]]]],[[]],[[],["cellshape",4]],[[],["usize",15]],[[],["usize",15]],[[],["usize",15]],[[],["usize",15]],[[]],null,[[],["usize",15]],[[],["string",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],["string",3]],[[],["topologyref",3]],[[],["unitcell",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],[[],["typeid",3]],null,[[],["f64",15]],[[]],null,[[]],[[],["string",3]],[[],["f64",15]],[[["i64",15]],["residue",3]],[[]],[[["frame",3]],[["error",3],["result",4,["error"]]]],null,null,null,null,null],"p":[[4,"BondOrder"],[4,"Property"],[4,"Status"],[4,"CellShape"],[3,"Residue"],[3,"Topology"],[3,"Frame"],[3,"UnitCell"],[3,"Atom"],[3,"FormatMetadata"],[3,"AtomRef"],[3,"AtomMut"],[3,"UnitCellRef"],[3,"UnitCellMut"],[3,"ResidueRef"],[3,"TopologyRef"],[3,"Trajectory"],[3,"Selection"],[3,"PropertiesIter"],[3,"Error"],[3,"Match"],[13,"Bool"],[13,"Double"],[13,"String"],[13,"Vector3D"]]}\ +}'); +if (window.initSearch) {window.initSearch(searchIndex)}; \ No newline at end of file diff --git a/0.10.2/search.js b/0.10.2/search.js new file mode 100644 index 000000000..91de2a155 --- /dev/null +++ b/0.10.2/search.js @@ -0,0 +1 @@ +(function(){var itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias"];var TY_PRIMITIVE=itemTypes.indexOf("primitive");var TY_KEYWORD=itemTypes.indexOf("keyword");function printTab(nb){if(nb===0||nb===1||nb===2){searchState.currentTab=nb}var nb_copy=nb;onEachLazy(document.getElementById("titles").childNodes,function(elem){if(nb_copy===0){addClass(elem,"selected")}else{removeClass(elem,"selected")}nb_copy-=1});onEachLazy(document.getElementById("results").childNodes,function(elem){if(nb===0){addClass(elem,"active")}else{removeClass(elem,"active")}nb-=1})}function removeEmptyStringsFromArray(x){for(var i=0,len=x.length;i-1){var obj=searchIndex[results[i].id];obj.lev=results[i].lev;var res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType){var ar=[];for(var entry in results){if(hasOwnPropertyRustdoc(results,entry)){ar.push(results[entry])}}results=ar;var i,len,result;for(i=0,len=results.length;ib?+1:-1)}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});for(i=0,len=results.length;i"));return{name:val.substring(0,val.indexOf("<")),generics:values.split(/\s*,\s*/),}}return{name:val,generics:[],}}function checkGenerics(obj,val){var tmp_lev,elem_name;if(val.generics.length>0){if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>=val.generics.length){var elems=Object.create(null);var elength=obj[GENERICS_DATA].length;for(var x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length>0){var elems=Object.create(null);len=obj[GENERICS_DATA].length;for(x=0;xGENERICS_DATA&&obj[GENERICS_DATA].length!==0){var tmp_lev=checkGenerics(obj,val);if(tmp_lev<=MAX_LEV_DISTANCE){return tmp_lev}}}}else if(literalSearch){if((!val.generics||val.generics.length===0)&&obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){return obj[GENERICS_DATA].some(function(name){return name===val.name})}return false}lev_distance=Math.min(levenshtein(obj[NAME],val.name),lev_distance);if(lev_distance<=MAX_LEV_DISTANCE){lev_distance=Math.ceil((checkGenerics(obj,val)+lev_distance)/2)}else if(obj.length>GENERICS_DATA&&obj[GENERICS_DATA].length>0){var olength=obj[GENERICS_DATA].length;for(x=0;x0){var length=obj.type[INPUTS_DATA].length;for(var i=0;iOUTPUT_DATA){var ret=obj.type[OUTPUT_DATA];if(typeof ret[0]==="string"){ret=[ret]}for(var x=0,len=ret.length;xlength){return MAX_LEV_DISTANCE+1}for(var i=0;ilength){break}var lev_total=0;var aborted=false;for(var x=0;xMAX_LEV_DISTANCE){aborted=true;break}lev_total+=lev}if(!aborted){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER)return true;if(filter===type)return true;var name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates){var aliases=[];var crateAliases=[];if(filterCrates!==undefined){if(ALIASES[filterCrates]&&ALIASES[filterCrates][query.search]){var query_aliases=ALIASES[filterCrates][query.search];var len=query_aliases.length;for(var i=0;iMAX_RESULTS){ret.others.pop()}};onEach(aliases,pushFunc);onEach(crateAliases,pushFunc)}var nSearchWords=searchWords.length;var i,it;var ty;var fullId;var returned;var in_args;var len;if((val.charAt(0)==="\""||val.charAt(0)==="'")&&val.charAt(val.length-1)===val.charAt(0)){val=extractGenerics(val.substr(1,val.length-2));for(i=0;i")>-1){var trimmer=function(s){return s.trim()};var parts=val.split("->").map(trimmer);var input=parts[0];var inputs=input.split(",").map(trimmer).sort();for(i=0,len=inputs.length;i1?paths.length-1:1);var lev,j;for(j=0;j1){lev=checkPath(contains,paths[paths.length-1],ty);if(lev>MAX_LEV_DISTANCE){continue}else if(lev>0){lev_add=lev/10}}returned=MAX_LEV_DISTANCE+1;in_args=MAX_LEV_DISTANCE+1;var index=-1;lev=MAX_LEV_DISTANCE+1;fullId=ty.id;if(searchWords[j].indexOf(split[i])>-1||searchWords[j].indexOf(val)>-1||ty.normalizedName.indexOf(val)>-1){if(typePassesFilter(typeFilter,ty.ty)&&results[fullId]===undefined){index=ty.normalizedName.indexOf(val)}}if((lev=levenshtein(searchWords[j],val))<=MAX_LEV_DISTANCE){if(typePassesFilter(typeFilter,ty.ty)){lev+=1}else{lev=MAX_LEV_DISTANCE+1}}in_args=findArg(ty,valGenerics,false,typeFilter);returned=checkReturned(ty,valGenerics,false,typeFilter);lev+=lev_add;if(lev>0&&val.length>3&&searchWords[j].indexOf(val)>-1){if(val.length<6){lev-=1}else{lev=0}}if(in_args<=MAX_LEV_DISTANCE){if(results_in_args[fullId]===undefined){results_in_args[fullId]={id:j,index:index,lev:in_args,}}results_in_args[fullId].lev=Math.min(results_in_args[fullId].lev,in_args)}if(returned<=MAX_LEV_DISTANCE){if(results_returned[fullId]===undefined){results_returned[fullId]={id:j,index:index,lev:returned,}}results_returned[fullId].lev=Math.min(results_returned[fullId].lev,returned)}if(typePassesFilter(typeFilter,ty.ty)&&(index!==-1||lev<=MAX_LEV_DISTANCE)){if(index!==-1&&paths.length<2){lev=0}if(results[fullId]===undefined){results[fullId]={id:j,index:index,lev:lev,}}results[fullId].lev=Math.min(results[fullId].lev,lev)}}}var ret={"in_args":sortResults(results_in_args,true),"returned":sortResults(results_returned,true),"others":sortResults(results,false),};handleAliases(ret,query,filterCrates);return ret}function validateResult(name,path,keys,parent){for(var i=0,len=keys.length;i-1||path.indexOf(keys[i])>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(keys[i])>-1)||levenshtein(name,keys[i])<=MAX_LEV_DISTANCE)){return false}}return true}function getQuery(raw){var matches,type,query;query=raw;matches=query.match(/^(fn|mod|struct|enum|trait|type|const|macro)\s*:\s*/i);if(matches){type=matches[1].replace(/^const$/,"constant");query=query.substring(matches[0].length)}return{raw:raw,query:query,type:type,id:query+type}}function nextTab(direction){var next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){var target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#titles > button").item(searchState.currentTab);if(target){target.focus()}}function buildHrefAndPath(item){var displayPath;var href;var type=itemTypes[item.ty];var name=item.name;var path=item.path;if(type==="mod"){displayPath=path+"::";href=window.rootPath+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="primitive"||type==="keyword"){displayPath="";href=window.rootPath+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=window.rootPath+name+"/index.html"}else if(item.parent!==undefined){var myparent=item.parent;var anchor="#"+type+"."+name;var parentType=itemTypes[myparent.ty];var pageType=parentType;var pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){var enumNameIdx=item.path.lastIndexOf("::");var enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=window.rootPath+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=window.rootPath+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function escape(content){var h1=document.createElement("h1");h1.textContent=content;return h1.innerHTML}function pathSplitter(path){var tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){var extraClass="";if(display===true){extraClass=" active"}var output=document.createElement("div");var duplicates={};var length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(function(item){if(item.is_alias!==true){if(duplicates[item.fullPath]){return}duplicates[item.fullPath]=true}var name=item.name;var type=itemTypes[item.ty];length+=1;var extra="";if(type==="primitive"){extra=" (primitive type)"}else if(type==="keyword"){extra=" (keyword)"}var link=document.createElement("a");link.className="result-"+type;link.href=item.href;var wrapper=document.createElement("div");var resultName=document.createElement("div");resultName.className="result-name";if(item.is_alias){var alias=document.createElement("span");alias.className="alias";var bold=document.createElement("b");bold.innerText=item.alias;alias.appendChild(bold);alias.insertAdjacentHTML("beforeend"," - see ");resultName.appendChild(alias)}resultName.insertAdjacentHTML("beforeend",item.displayPath+""+name+extra+"");wrapper.appendChild(resultName);var description=document.createElement("div");description.className="desc";var spanDesc=document.createElement("span");spanDesc.insertAdjacentHTML("beforeend",item.desc);description.appendChild(spanDesc);wrapper.appendChild(description);link.appendChild(wrapper);output.appendChild(link)})}else{output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first){var search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==searchState.loadingText))){var elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}var query=getQuery(searchState.input.value);currentResults=query.id;var ret_others=addTab(results.others,query);var ret_in_args=addTab(results.in_args,query,false);var ret_returned=addTab(results.returned,query,false);var currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}var output="

Results for "+escape(query.query)+(query.type?" (type: "+escape(query.type)+")":"")+"

"+"
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
";var resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;search.appendChild(resultsElem);searchState.focusedByTab=[null,null,null];searchState.showResults(search);var elems=document.getElementById("titles").childNodes;elems[0].onclick=function(){printTab(0)};elems[1].onclick=function(){printTab(1)};elems[2].onclick=function(){printTab(2)};printTab(currentTab)}function execSearch(query,searchWords,filterCrates){function getSmallest(arrays,positions,notDuplicates){var start=null;for(var it=0,len=positions.length;itpositions[it]&&(start===null||start>arrays[it][positions[it]].lev)&&!notDuplicates[arrays[it][positions[it]].fullPath]){start=arrays[it][positions[it]].lev}}return start}function mergeArrays(arrays){var ret=[];var positions=[];var notDuplicates={};for(var x=0,arrays_len=arrays.length;xpositions[x]&&arrays[x][positions[x]].lev===smallest&&!notDuplicates[arrays[x][positions[x]].fullPath]){ret.push(arrays[x][positions[x]]);notDuplicates[arrays[x][positions[x]].fullPath]=true;positions[x]+=1}}}return ret}function tokenizeQuery(raw){var i,matched;var l=raw.length;var depth=0;var nextAngle=/(<|>)/g;var ret=[];var start=0;for(i=0;i'){depth+=1}break;case">":if(depth>0){depth-=1}break;case",":if(depth===0){ret.push(raw.substring(start,i));start=i+1}break}}if(start!==i){ret.push(raw.substring(start,i))}return ret}var queries=tokenizeQuery(query.raw);var results={"in_args":[],"returned":[],"others":[],};for(var i=0,len=queries.length;i1){return{"in_args":mergeArrays(results.in_args),"returned":mergeArrays(results.returned),"others":mergeArrays(results.others),}}return{"in_args":results.in_args[0],"returned":results.returned[0],"others":results.others[0],}}function getFilterCrates(){var elem=document.getElementById("crate-search");if(elem&&elem.value!=="All crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return undefined}function search(e,forced){var params=searchState.getQueryStringParams();var query=getQuery(searchState.input.value.trim());if(e){e.preventDefault()}if(query.query.length===0){return}if(!forced&&query.id===currentResults){if(query.query.length>0){searchState.putBackSearch(searchState.input)}return}searchState.title="Results for "+query.query+" - Rust";if(searchState.browserSupportsHistoryApi()){var newURL=getNakedUrl()+"?search="+encodeURIComponent(query.raw)+window.location.hash;if(!history.state&&!params.search){history.pushState(query,"",newURL)}else{history.replaceState(query,"",newURL)}}var filterCrates=getFilterCrates();showResults(execSearch(query,index,filterCrates),params.go_to_first)}function buildIndex(rawSearchIndex){searchIndex=[];var searchWords=[];var i,word;var currentIndex=0;var id=0;for(var crate in rawSearchIndex){if(!hasOwnPropertyRustdoc(rawSearchIndex,crate)){continue}var crateSize=0;searchWords.push(crate);var crateRow={crate:crate,ty:1,name:crate,path:"",desc:rawSearchIndex[crate].doc,parent:undefined,type:null,id:id,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),};id+=1;searchIndex.push(crateRow);currentIndex+=1;var itemTypes=rawSearchIndex[crate].t;var itemNames=rawSearchIndex[crate].n;var itemPaths=rawSearchIndex[crate].q;var itemDescs=rawSearchIndex[crate].d;var itemParentIdxs=rawSearchIndex[crate].i;var itemFunctionSearchTypes=rawSearchIndex[crate].f;var paths=rawSearchIndex[crate].p;var aliases=rawSearchIndex[crate].a;var len=paths.length;for(i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:itemFunctionSearchTypes[i],id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){ALIASES[crate]={};var j,local_aliases;for(var alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}if(!hasOwnPropertyRustdoc(ALIASES[crate],alias_name)){ALIASES[crate][alias_name]=[]}local_aliases=aliases[alias_name];for(j=0,len=local_aliases.length;j0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=function(){var qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}index=buildIndex(rawSearchIndex);registerSearchEvents();if(searchState.getQueryStringParams().search){search()}};if(window.searchIndex!==undefined){initSearch(window.searchIndex)}})() \ No newline at end of file diff --git a/0.10.2/settings.css b/0.10.2/settings.css new file mode 100644 index 000000000..670986588 --- /dev/null +++ b/0.10.2/settings.css @@ -0,0 +1 @@ +.setting-line{padding:5px;position:relative;}.setting-line>div{display:inline-block;vertical-align:top;font-size:17px;padding-top:2px;}.setting-line>.title{font-size:19px;width:100%;max-width:none;border-bottom:1px solid;}.toggle{position:relative;display:inline-block;width:45px;height:27px;margin-right:20px;}.toggle input{opacity:0;position:absolute;}.select-wrapper{float:right;position:relative;height:27px;min-width:25%;}.select-wrapper select{appearance:none;-moz-appearance:none;-webkit-appearance:none;background:none;border:2px solid #ccc;padding-right:28px;width:100%;}.select-wrapper img{pointer-events:none;position:absolute;right:0;bottom:0;background:#ccc;height:100%;width:28px;padding:0px 4px;}.select-wrapper select option{color:initial;}.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:.3s;transition:.3s;}.slider:before{position:absolute;content:"";height:19px;width:19px;left:4px;bottom:4px;background-color:white;-webkit-transition:.3s;transition:.3s;}input:checked+.slider{background-color:#2196F3;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}input:checked+.slider:before{-webkit-transform:translateX(19px);-ms-transform:translateX(19px);transform:translateX(19px);}.setting-line>.sub-settings{padding-left:42px;width:100%;display:block;} \ No newline at end of file diff --git a/0.10.2/settings.html b/0.10.2/settings.html new file mode 100644 index 000000000..9f98cbfbd --- /dev/null +++ b/0.10.2/settings.html @@ -0,0 +1,4 @@ +Rustdoc settings

Rustdoc settings

Theme preferences
Use system theme
Preferred dark theme
Preferred light theme
+
Auto-hide item contents for large items.
Auto-hide item methods' documentation
Auto-hide trait implementation documentation
Directly go to item in search if there is only one result
Show line numbers on code examples
Disable keyboard shortcuts
+ + \ No newline at end of file diff --git a/0.10.2/settings.js b/0.10.2/settings.js new file mode 100644 index 000000000..b4d6fdcd7 --- /dev/null +++ b/0.10.2/settings.js @@ -0,0 +1 @@ +(function(){function changeSetting(settingName,value){updateLocalStorage("rustdoc-"+settingName,value);switch(settingName){case"preferred-dark-theme":case"preferred-light-theme":case"use-system-theme":updateSystemTheme();break}}function handleKey(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey){return}switch(getVirtualKey(ev)){case"Enter":case"Return":case"Space":ev.target.checked=!ev.target.checked;ev.preventDefault();break}}function setEvents(){onEachLazy(document.getElementsByClassName("slider"),function(elem){var toggle=elem.previousElementSibling;var settingId=toggle.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=function(){changeSetting(this.id,this.checked)};toggle.onkeyup=handleKey;toggle.onkeyrelease=handleKey});onEachLazy(document.getElementsByClassName("select-wrapper"),function(elem){var select=elem.getElementsByTagName("select")[0];var settingId=select.id;var settingValue=getSettingValue(settingId);if(settingValue!==null){select.value=settingValue}select.onchange=function(){changeSetting(this.id,this.value)}})}window.addEventListener("DOMContentLoaded",setEvents)})() \ No newline at end of file diff --git a/0.10.2/source-files.js b/0.10.2/source-files.js new file mode 100644 index 000000000..c49ec708c --- /dev/null +++ b/0.10.2/source-files.js @@ -0,0 +1,3 @@ +var N = null;var sourcesIndex = {}; +sourcesIndex["chemfiles"] = {"name":"","files":["atom.rs","cell.rs","errors.rs","frame.rs","lib.rs","misc.rs","property.rs","residue.rs","selection.rs","strings.rs","topology.rs","trajectory.rs"]}; +createSourceSidebar(); diff --git a/0.10.2/source-script.js b/0.10.2/source-script.js new file mode 100644 index 000000000..5dc8fee0f --- /dev/null +++ b/0.10.2/source-script.js @@ -0,0 +1 @@ +(function(){function getCurrentFilePath(){var parts=window.location.pathname.split("/");var rootPathParts=window.rootPath.split("/");for(var i=0,len=rootPathParts.length;i"){sidebar.style.left="";this.style.left="";child.innerText="<";updateLocalStorage("rustdoc-source-sidebar-show","true")}else{sidebar.style.left="-300px";this.style.left="0";child.innerText=">";updateLocalStorage("rustdoc-source-sidebar-show","false")}}function createSidebarToggle(){var sidebarToggle=document.createElement("div");sidebarToggle.id="sidebar-toggle";sidebarToggle.onclick=toggleSidebar;var inner1=document.createElement("div");inner1.style.position="relative";var inner2=document.createElement("div");inner2.style.paddingTop="3px";if(getCurrentValue("rustdoc-source-sidebar-show")==="true"){inner2.innerText="<"}else{inner2.innerText=">";sidebarToggle.style.left="0"}inner1.appendChild(inner2);sidebarToggle.appendChild(inner1);return sidebarToggle}function createSourceSidebar(){if(!window.rootPath.endsWith("/")){window.rootPath+="/"}var main=document.getElementById("main");var sidebarToggle=createSidebarToggle();main.insertBefore(sidebarToggle,main.firstChild);var sidebar=document.createElement("div");sidebar.id="source-sidebar";if(getCurrentValue("rustdoc-source-sidebar-show")!=="true"){sidebar.style.left="-300px"}var currentFile=getCurrentFilePath();var hasFoundFile=false;var title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(function(key){sourcesIndex[key].name=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",currentFile,hasFoundFile)});main.insertBefore(sidebar,main.firstChild);var selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}var lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSourceLines(scrollTo,match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}var from=parseInt(match[1],10);var to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(tocur_line_id){var tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",function(){var match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSourceLines(false,match)}});onEachLazy(document.getElementsByClassName("line-numbers"),function(el){el.addEventListener("click",handleSourceHighlight)});highlightSourceLines(true);window.createSourceSidebar=createSourceSidebar})() \ No newline at end of file diff --git a/0.10.2/src/chemfiles/atom.rs.html b/0.10.2/src/chemfiles/atom.rs.html new file mode 100644 index 000000000..5e1dcca8a --- /dev/null +++ b/0.10.2/src/chemfiles/atom.rs.html @@ -0,0 +1,1056 @@ +atom.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null};
+use strings;
+
+use property::{Property, RawProperty, PropertiesIter};
+
+/// An `Atom` is a particle in the current `Frame`. It stores the following
+/// atomic properties:
+///
+/// - atom name;
+/// - atom type;
+/// - atom mass;
+/// - atom charge.
+///
+/// The atom name is usually an unique identifier (`H1`, `C_a`) while the
+/// atom type will be shared between all particles of the same type: `H`,
+/// `Ow`, `CH3`.
+pub struct Atom {
+    handle: *mut CHFL_ATOM,
+}
+
+/// An analog to a reference to an atom (`&Atom`)
+pub struct AtomRef<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a Atom>
+}
+
+impl<'a> Deref for AtomRef<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an atom (`&mut Atom`)
+pub struct AtomMut<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a mut Atom>
+}
+
+impl<'a> Deref for AtomMut<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for AtomMut<'a> {
+    fn deref_mut(&mut self) -> &mut Atom {
+        &mut self.inner
+    }
+}
+
+impl Clone for Atom {
+    fn clone(&self) -> Atom {
+        unsafe {
+            let new_handle = chfl_atom_copy(self.as_ptr());
+            Atom::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Atom {
+    /// Create an owned `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_ATOM) -> Atom {
+        check_not_null(ptr);
+        Atom {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_ATOM) -> AtomRef<'a> {
+        AtomRef {
+            inner: Atom::from_ptr(ptr as *mut CHFL_ATOM),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a mutably borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_ATOM) -> AtomMut<'a> {
+        AtomMut {
+            inner: Atom::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_ATOM {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_ATOM {
+        self.handle
+    }
+
+    /// Create an atom with the given `name`, and set the atom type to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Atom {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_atom(buffer.as_ptr());
+            Atom::from_ptr(handle)
+        }
+    }
+
+    /// Get the atom mass, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.mass(), 4.002602);
+    /// ```
+    pub fn mass(&self) -> f64 {
+        let mut mass = 0.0;
+        unsafe {
+            check_success(chfl_atom_mass(self.as_ptr(), &mut mass));
+        }
+        return mass;
+    }
+
+    /// Set the atom mass to `mass`, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_mass(34.9);
+    /// assert_eq!(atom.mass(), 34.9);
+    /// ```
+    pub fn set_mass(&mut self, mass: f64) {
+        unsafe {
+            check_success(chfl_atom_set_mass(self.as_mut_ptr(), mass));
+        }
+    }
+
+    /// Get the atom charge, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.charge(), 0.0);
+    /// ```
+    pub fn charge(&self) -> f64 {
+        let mut charge = 0.0;
+        unsafe {
+            check_success(chfl_atom_charge(self.as_ptr(), &mut charge));
+        }
+        return charge;
+    }
+
+    /// Set the atom charge to `charge`, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_charge(-2.0);
+    /// assert_eq!(atom.charge(), -2.0);
+    /// ```
+    pub fn set_charge(&mut self, charge: f64) {
+        unsafe {
+            check_success(chfl_atom_set_charge(self.as_mut_ptr(), charge));
+        }
+    }
+
+    /// Get the atom name.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_atom_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_name).expect("getting name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Get the atom type.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.atomic_type(), "He");
+    /// ```
+    pub fn atomic_type(&self) -> String {
+        let get_type = |ptr, len| unsafe { chfl_atom_type(self.as_ptr(), ptr, len) };
+        let buffer = strings::call_autogrow_buffer(10, get_type).expect("getting type failed");
+        return strings::from_c(buffer.as_ptr());
+    }
+
+    /// Set the atom name to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_name("Zn3");
+    /// assert_eq!(atom.name(), "Zn3");
+    /// ```
+    pub fn set_name<'a>(&mut self, name: impl Into<&'a str>) {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            check_success(chfl_atom_set_name(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Set the atom type to `atomic_type`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_atomic_type("F");
+    /// assert_eq!(atom.atomic_type(), "F");
+    /// ```
+    pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>) {
+        let buffer = strings::to_c(atomic_type.into());
+        unsafe {
+            check_success(chfl_atom_set_type(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Try to get the full name of the atom from the atomic type. For example,
+    /// the full name of "He" is "Helium", and so on. If the name can not be
+    /// found, this function returns the empty string.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("Zn");
+    /// assert_eq!(atom.full_name(), "Zinc");
+    /// ```
+    pub fn full_name(&self) -> String {
+        let get_full_name = |ptr, len| unsafe { chfl_atom_full_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_full_name).expect("getting full name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Try to get the Van der Waals radius of the atom from the atomic type.
+    /// If the radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+    /// assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+    /// ```
+    pub fn vdw_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_vdw_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the covalent radius of the atom from the atomic type. If the
+    /// radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+    /// assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+    /// ```
+    pub fn covalent_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_covalent_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the atomic number of the atom from the atomic type. If the
+    /// number can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").atomic_number(), 2);
+    /// assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+    /// ```
+    pub fn atomic_number(&self) -> u64 {
+        let mut number = 0;
+        unsafe {
+            check_success(chfl_atom_atomic_number(self.as_ptr(), &mut number));
+        }
+        return number;
+    }
+
+    /// Add a new `property` with the given `name` to this atom.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("a bool", true);
+    /// atom.set("a string", "test");
+    ///
+    /// assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+    /// assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_atom_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+
+    /// Get a property with the given `name` in this atom, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(atom.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_atom_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                let property = Property::from_raw(raw);
+                Some(property)
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this atom
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    /// atom.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in atom.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_atom_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_atom_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Atom {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+
+        let copy = atom.clone();
+        assert_eq!(copy.name(), "He");
+
+        atom.set_name("Na");
+        assert_eq!(atom.name(), "Na");
+        assert_eq!(copy.name(), "He");
+    }
+
+    #[test]
+    fn mass() {
+        let mut atom = Atom::new("He");
+        assert_ulps_eq!(atom.mass(), 4.002602);
+        atom.set_mass(15.0);
+        assert_eq!(atom.mass(), 15.0);
+    }
+
+    #[test]
+    fn charge() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.charge(), 0.0);
+        atom.set_charge(-1.5);
+        assert_eq!(atom.charge(), -1.5);
+    }
+
+    #[test]
+    fn name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+        atom.set_name("Zn-12");
+        assert_eq!(atom.name(), "Zn-12");
+    }
+
+    #[test]
+    fn atomic_type() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.atomic_type(), "He");
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.atomic_type(), "Zn");
+    }
+
+    #[test]
+    fn full_name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.full_name(), "Helium");
+
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.full_name(), "Zinc");
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.full_name(), "");
+    }
+
+    #[test]
+    fn radii() {
+        let atom = Atom::new("He");
+        assert_ulps_eq!(atom.vdw_radius(), 1.4);
+        assert_ulps_eq!(atom.covalent_radius(), 0.32);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.vdw_radius(), 0.0);
+        assert_eq!(atom.covalent_radius(), 0.0);
+    }
+
+    #[test]
+    fn atomic_number() {
+        let atom = Atom::new("He");
+        assert_eq!(atom.atomic_number(), 2);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.atomic_number(), 0);
+    }
+
+    #[test]
+    fn property() {
+        let mut atom = Atom::new("F");
+
+        atom.set("foo", -22.0);
+        assert_eq!(atom.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(atom.get("bar"), None);
+
+        atom.set("bar", Property::String("here".into()));
+        for (name, property) in atom.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/cell.rs.html b/0.10.2/src/chemfiles/cell.rs.html new file mode 100644 index 000000000..050f0d141 --- /dev/null +++ b/0.10.2/src/chemfiles/cell.rs.html @@ -0,0 +1,1104 @@ +cell.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null, check, Error};
+
+/// Available unit cell shapes.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum CellShape {
+    /// Orthorhombic cell, with the three angles equals to 90°.
+    Orthorhombic,
+    /// Triclinic cell, with any values for the angles.
+    Triclinic,
+    /// Infinite cell, to use when there is no cell.
+    Infinite,
+}
+
+impl From<chfl_cellshape> for CellShape {
+    fn from(celltype: chfl_cellshape) -> CellShape {
+        match celltype {
+            chfl_cellshape::CHFL_CELL_ORTHORHOMBIC => CellShape::Orthorhombic,
+            chfl_cellshape::CHFL_CELL_TRICLINIC => CellShape::Triclinic,
+            chfl_cellshape::CHFL_CELL_INFINITE => CellShape::Infinite,
+        }
+    }
+}
+
+impl From<CellShape> for chfl_cellshape {
+    fn from(celltype: CellShape) -> chfl_cellshape {
+        match celltype {
+            CellShape::Orthorhombic => chfl_cellshape::CHFL_CELL_ORTHORHOMBIC,
+            CellShape::Triclinic => chfl_cellshape::CHFL_CELL_TRICLINIC,
+            CellShape::Infinite => chfl_cellshape::CHFL_CELL_INFINITE,
+        }
+    }
+}
+
+/// An `UnitCell` represent the box containing the atoms, and its periodicity.
+///
+/// An unit cell is fully represented by three lengths (a, b, c); and three
+/// angles (alpha, beta, gamma). The angles are stored in degrees, and the
+/// lengths in Angstroms.
+///
+/// A cell also has a matricial representation, by projecting the three base
+/// vector into an orthonormal base. We choose to represent such matrix as an
+/// upper triangular matrix:
+///
+/// ```text
+/// | a_x   b_x   c_x |
+/// |  0    b_y   c_y |
+/// |  0     0    c_z |
+/// ```
+pub struct UnitCell {
+    handle: *mut CHFL_CELL,
+}
+
+/// An analog to a reference to an unit cell (`&UnitCell`)
+pub struct UnitCellRef<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a UnitCell>
+}
+
+impl<'a> Deref for UnitCellRef<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an unit cell (`&mut UnitCell`)
+pub struct UnitCellMut<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a mut UnitCell>
+}
+
+impl<'a> Deref for UnitCellMut<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for UnitCellMut<'a> {
+    fn deref_mut(&mut self) -> &mut UnitCell {
+        &mut self.inner
+    }
+}
+
+impl Clone for UnitCell {
+    fn clone(&self) -> UnitCell {
+        unsafe {
+            let new_handle = chfl_cell_copy(self.as_ptr());
+            UnitCell::from_ptr(new_handle)
+        }
+    }
+}
+
+impl UnitCell {
+    /// Create an owned `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_CELL) -> UnitCell {
+        check_not_null(ptr);
+        UnitCell {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime.
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_CELL) -> UnitCellRef<'a> {
+        UnitCellRef {
+            inner: UnitCell::from_ptr(ptr as *mut CHFL_CELL),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible for
+    /// setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_CELL) -> UnitCellMut<'a> {
+        UnitCellMut {
+            inner: UnitCell::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_CELL {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_CELL {
+        self.handle
+    }
+
+    /// Create an `Orthorhombic` `UnitCell` from the three lengths, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn new(lengths: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), ptr::null());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `Infinite` `UnitCell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::infinite();
+    ///
+    /// assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn infinite() -> UnitCell {
+        let mut cell = UnitCell::new([0.0, 0.0, 0.0]);
+        cell.set_shape(CellShape::Infinite).expect("could not set cell shape");
+        return cell;
+    }
+
+    /// Create an `Triclinic` `UnitCell` from the three lengths (in Angstroms)
+    /// and three angles (in degree). `alpha` is the angle between the vectors
+    /// `b` and `c`; `beta` is the between the vectors `a` and `c` and `gamma`
+    /// is the angle between the vectors `a` and `b`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// assert_eq!(cell.angles()[0], 98.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), angles.as_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `UnitCell` from a cell matrix. If `matrix` contains only
+    /// zeros, then an `Infinite` cell is created. If only the diagonal of the
+    /// matrix is non-zero, then the cell is `Orthorhombic`. Else a
+    /// `Triclinic` cell is created. The matrix entries should be in Angstroms.
+    ///
+    /// # Panics
+    ///
+    /// If the matrix has a negative determinant, or more generally is not
+    /// representing a unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::from_matrix([
+    ///     [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+    /// ]);
+    ///
+    /// assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn from_matrix(mut matrix: [[f64; 3]; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell_from_matrix(matrix.as_mut_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Get the three lengths of the cell, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// ```
+    pub fn lengths(&self) -> [f64; 3] {
+        let mut lengths = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_lengths(self.as_ptr(), lengths.as_mut_ptr()));
+        }
+        return lengths;
+    }
+
+    /// Set the three lengths of the cell, in Angstroms.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is infinite, or if one of the
+    /// lengths is negative.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+    /// assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+    ///
+    /// assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+    /// ```
+    pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_lengths(self.as_mut_ptr(), lengths.as_ptr()))
+        }
+    }
+
+    /// Get the three angles of the cell, in degrees.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([20.0, 20.0, 20.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    ///
+    /// let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// ```
+    pub fn angles(&self) -> [f64; 3] {
+        let mut angles = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_angles(self.as_ptr(), angles.as_mut_ptr()));
+        }
+        return angles;
+    }
+
+    /// Set the three angles of the cell, in degrees.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is not `Triclinic`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    ///
+    /// cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// ```
+    pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_angles(self.as_mut_ptr(), angles.as_ptr()))
+        }
+    }
+
+    /// Get the unit cell matricial representation.
+    ///
+    /// The unit cell representation is obtained by aligning the a vector along
+    /// the *x* axis and putting the b vector in the *xy* plane. This make the
+    /// matrix an upper triangular matrix:
+    ///
+    /// ```text
+    /// | a_x   b_x   c_x |
+    /// |  0    b_y   c_y |
+    /// |  0     0    c_z |
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let matrix = cell.matrix();
+    ///
+    /// assert_eq!(matrix[0][0], 10.0);
+    /// assert_eq!(matrix[1][1], 20.0);
+    /// assert_eq!(matrix[2][2], 30.0);
+    ///
+    /// assert!(matrix[1][2].abs() < 1e-9);
+    /// ```
+    pub fn matrix(&self) -> [[f64; 3]; 3] {
+        let mut matrix = [[0.0; 3]; 3];
+        unsafe {
+            check_success(chfl_cell_matrix(self.as_ptr(), matrix.as_mut_ptr()));
+        }
+        return matrix;
+    }
+
+    /// Get the shape of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn shape(&self) -> CellShape {
+        let mut shape = chfl_cellshape::CHFL_CELL_INFINITE;
+        unsafe {
+            check_success(chfl_cell_shape(self.as_ptr(), &mut shape));
+        }
+        return CellShape::from(shape);
+    }
+
+    /// Set the shape of the unit cell to `shape`.
+    ///
+    /// # Errors
+    ///
+    /// This can fail if the cell length or angles are incompatible with the
+    /// new shape.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    ///
+    /// cell.set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_shape(self.as_mut_ptr(), shape.into()))
+        }
+    }
+
+    /// Get the volume of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+    /// ```
+    pub fn volume(&self) -> f64 {
+        let mut volume = 0.0;
+        unsafe {
+            check_success(chfl_cell_volume(self.as_ptr(), &mut volume));
+        }
+        return volume;
+    }
+
+    /// Wrap a `vector` in this unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let mut vector = [12.0, 5.2, -45.3];
+    /// cell.wrap(&mut vector);
+    /// assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+    /// ```
+    pub fn wrap(&self, vector: &mut [f64; 3]) {
+        unsafe {
+            check_success(chfl_cell_wrap(self.as_ptr(), vector.as_mut_ptr()));
+        }
+    }
+}
+
+impl Drop for UnitCell {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+
+        let copy = cell.clone();
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+    }
+
+    #[test]
+    fn lengths() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+    }
+
+    #[test]
+    fn angles() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        crate::assert_vector3d_eq(&cell.angles(), &[90.0, 90.0, 90.0], 1e-6);
+
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        cell.set_angles([80.0, 89.0, 100.0]).unwrap();
+
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 89.0, 100.0], 1e-6);
+
+        let cell = UnitCell::triclinic([1., 2., 3.], [80., 90., 100.]);
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 90.0, 100.0], 1e-6);
+    }
+
+    #[test]
+    fn volume() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.volume(), 2.0 * 3.0 * 4.0);
+    }
+
+    #[test]
+    fn wrap() {
+        let cell = UnitCell::new([10.0, 20.0, 30.0]);
+        let mut vector = [12.0, 5.2, -45.3];
+        cell.wrap(&mut vector);
+        crate::assert_vector3d_eq(&vector, &[2.0, 5.2, 14.7], 1e-6);
+    }
+
+    #[test]
+    fn matrix() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+
+        let matrix = cell.matrix();
+        let result = [[2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 4.0]];
+
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn from_matrix() {
+        let cell = UnitCell::from_matrix([[10.0, 0.0, 0.0], [0.0, 21.0, 0.0], [0.0, 0.0, 32.0]]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        assert_eq!(cell.lengths(), [10.0, 21.0, 32.0]);
+
+        let result_matrix = [
+            [123.0, 4.08386, 71.7295],
+            [0.0, 233.964, 133.571],
+            [0.0, 0.0, 309.901],
+        ];
+        let cell = UnitCell::from_matrix(result_matrix);
+
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+        for i in 0..3 {
+            assert_ulps_eq!(
+                cell.lengths()[i],
+                [123.0, 234.0, 345.0][i],
+                epsilon = 1e-3
+            );
+            assert_ulps_eq!(cell.angles()[i], [67.0, 78.0, 89.0][i], epsilon = 1e-3);
+        }
+
+        let matrix = cell.matrix();
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result_matrix[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn shape() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+        let cell = UnitCell::infinite();
+        assert_eq!(cell.shape(), CellShape::Infinite);
+
+        let cell = UnitCell::triclinic([1.0, 2.0, 3.0], [80.0, 90.0, 100.0]);
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+
+        let mut cell = UnitCell::new([10.0, 10.0, 10.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/errors.rs.html b/0.10.2/src/chemfiles/errors.rs.html new file mode 100644 index 000000000..02f33eef8 --- /dev/null +++ b/0.10.2/src/chemfiles/errors.rs.html @@ -0,0 +1,458 @@ +errors.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+extern crate libc;
+
+use std::error;
+use std::fmt;
+use std::panic::{self, RefUnwindSafe};
+use std::path::Path;
+
+use self::libc::c_char;
+
+use chemfiles_sys::*;
+use strings;
+
+#[derive(Clone, Debug, PartialEq)]
+/// Error type for Chemfiles.
+pub struct Error {
+    /// The error status code
+    pub status: Status,
+    /// A message describing the error cause
+    pub message: String,
+}
+
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Clone, Debug, PartialEq)]
+/// Possible causes of error in chemfiles
+pub enum Status {
+    /// No error
+    Success = chfl_status::CHFL_SUCCESS as isize,
+    /// Error in memory allocations
+    MemoryError = chfl_status::CHFL_MEMORY_ERROR as isize,
+    /// Error while reading or writing a file
+    FileError = chfl_status::CHFL_FILE_ERROR as isize,
+    /// Error in file formatting, *i.e.* the file is invalid
+    FormatError = chfl_status::CHFL_FORMAT_ERROR as isize,
+    /// Error in selection string syntax
+    SelectionError = chfl_status::CHFL_SELECTION_ERROR as isize,
+    /// Error in configuration files syntax
+    ConfigurationError = chfl_status::CHFL_CONFIGURATION_ERROR as isize,
+    /// Error for out of bounds indexing
+    OutOfBounds = chfl_status::CHFL_OUT_OF_BOUNDS as isize,
+    /// Error related to properties
+    PropertyError = chfl_status::CHFL_PROPERTY_ERROR as isize,
+    /// Exception in the C++ chemfiles library
+    ChemfilesError = chfl_status::CHFL_GENERIC_ERROR as isize,
+    /// Exception in the C++ standard library
+    StdCppError = chfl_status::CHFL_CXX_ERROR as isize,
+    /// The given path is not valid UTF8
+    // TODO: rename this to UTF8Error in the next breaking release
+    UTF8PathError,
+}
+
+impl From<chfl_status> for Error {
+    fn from(status: chfl_status) -> Error {
+        let status = match status {
+            chfl_status::CHFL_SUCCESS => Status::Success,
+            chfl_status::CHFL_CXX_ERROR => Status::StdCppError,
+            chfl_status::CHFL_GENERIC_ERROR => Status::ChemfilesError,
+            chfl_status::CHFL_MEMORY_ERROR => Status::MemoryError,
+            chfl_status::CHFL_FILE_ERROR => Status::FileError,
+            chfl_status::CHFL_FORMAT_ERROR => Status::FormatError,
+            chfl_status::CHFL_SELECTION_ERROR => Status::SelectionError,
+            chfl_status::CHFL_CONFIGURATION_ERROR => Status::ConfigurationError,
+            chfl_status::CHFL_OUT_OF_BOUNDS => Status::OutOfBounds,
+            chfl_status::CHFL_PROPERTY_ERROR => Status::PropertyError,
+        };
+
+        let message = Error::last_error();
+        Error {
+            status,
+            message,
+        }
+    }
+}
+
+impl From<std::str::Utf8Error> for Error {
+    fn from(_: std::str::Utf8Error) -> Self {
+        Error {
+            status: Status::UTF8PathError,
+            message: "failed to convert data to UTF8 string".into(),
+        }
+    }
+}
+
+impl Error {
+    /// Create a new error because the given `path` is invalid UTF-8 data
+    pub(crate) fn utf8_path_error(path: &Path) -> Error {
+        Error {
+            status: Status::UTF8PathError,
+            message: format!("Could not convert '{}' to UTF8", path.display()),
+        }
+    }
+
+    /// Get the last error message from the C++ library.
+    pub fn last_error() -> String {
+        unsafe { strings::from_c(chfl_last_error()) }
+    }
+
+    /// Clear any error from the C++ library
+    pub fn cleanup() {
+        unsafe {
+            check(chfl_clear_errors()).expect("error in chfl_clear_errors. Things went very bad");
+        }
+    }
+}
+
+/// Check return value of a C function, and get the error if needed.
+pub(crate) fn check(status: chfl_status) -> Result<(), Error> {
+    if status == chfl_status::CHFL_SUCCESS {
+        Ok(())
+    } else {
+        Err(Error::from(status))
+    }
+}
+
+/// Check return value of a C function, panic if it failed.
+pub(crate) fn check_success(status: chfl_status) {
+    if status != chfl_status::CHFL_SUCCESS {
+        panic!("unexpected failure: {}", Error::last_error());
+    }
+}
+
+/// Check a pointer for null.
+pub(crate) fn check_not_null<T>(ptr: *const T) {
+    if ptr.is_null() {
+        panic!("unexpected null pointer: {}", Error::last_error());
+    }
+}
+
+pub trait WarningCallback: RefUnwindSafe + Fn(&str) {}
+impl<T> WarningCallback for T
+where
+    T: RefUnwindSafe + Fn(&str),
+{
+}
+
+static mut LOGGING_CALLBACK: Option<*mut dyn WarningCallback<Output = ()>> = None;
+
+extern "C" fn warning_callback(message: *const c_char) {
+    unsafe {
+        let callback = &*LOGGING_CALLBACK.expect("No callback provided, this is an internal bug");
+        // ignore result. If a panic happened, everything is going badly anyway
+        let _result = panic::catch_unwind(|| {
+            callback(&strings::from_c(message));
+        });
+    }
+}
+
+/// Use `callback` for every chemfiles warning. The callback will be passed
+/// the warning message. This will drop any previous warning callback.
+pub fn set_warning_callback<F>(callback: F) where F: WarningCallback + 'static {
+    // box callback to ensure it stays accessible
+    let callback = Box::into_raw(Box::new(callback));
+    unsafe {
+        if let Some(previous) = LOGGING_CALLBACK {
+            // drop the previous callback
+            let previous = Box::from_raw(previous);
+            std::mem::drop(previous);
+            // set the LOGGING_CALLBACK to the new one
+            LOGGING_CALLBACK = Some(callback);
+        } else {
+            // set the LOGGING_CALLBACK
+            LOGGING_CALLBACK = Some(callback);
+            // Tell C code to use Rust-provided callback
+            check_success(chfl_set_warning_callback(warning_callback));
+        }
+    }
+}
+
+
+impl fmt::Display for Error {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        write!(fmt, "{}", self.message)
+    }
+}
+
+impl error::Error for Error {
+    fn description(&self) -> &str {
+        match self.status {
+            Status::Success => "Success",
+            Status::StdCppError => "Exception from the C++ standard library",
+            Status::ChemfilesError => "Exception from the chemfiles library",
+            Status::MemoryError => "Error in memory allocations",
+            Status::FileError => "Error while reading or writing a file",
+            Status::FormatError => "Error in file formatting, i.e. the file is invalid",
+            Status::SelectionError => "Error in selection string syntax",
+            Status::UTF8PathError => "A string is not valid UTF8",
+            Status::ConfigurationError => "Error in configuration files",
+            Status::OutOfBounds => "Out of bounds indexing",
+            Status::PropertyError => "Error in property",
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use Trajectory;
+
+    #[test]
+    fn errors() {
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+        assert!(Trajectory::open("nope", 'r').is_err());
+        assert_eq!(
+            Error::last_error(),
+            "file at \'nope\' does not have an extension, provide a format name to read it"
+        );
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+    }
+
+    #[test]
+    fn codes() {
+        assert_eq!(Error::from(chfl_status::CHFL_SUCCESS).status, Status::Success);
+        assert_eq!(Error::from(chfl_status::CHFL_CXX_ERROR).status, Status::StdCppError);
+        assert_eq!(Error::from(chfl_status::CHFL_GENERIC_ERROR).status, Status::ChemfilesError);
+        assert_eq!(Error::from(chfl_status::CHFL_MEMORY_ERROR).status, Status::MemoryError);
+        assert_eq!(Error::from(chfl_status::CHFL_FILE_ERROR).status, Status::FileError);
+        assert_eq!(Error::from(chfl_status::CHFL_FORMAT_ERROR).status, Status::FormatError);
+        assert_eq!(Error::from(chfl_status::CHFL_SELECTION_ERROR).status, Status::SelectionError);
+        assert_eq!(Error::from(chfl_status::CHFL_OUT_OF_BOUNDS).status, Status::OutOfBounds);
+        assert_eq!(Error::from(chfl_status::CHFL_PROPERTY_ERROR).status, Status::PropertyError);
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/frame.rs.html b/0.10.2/src/chemfiles/frame.rs.html new file mode 100644 index 000000000..30c9a9798 --- /dev/null +++ b/0.10.2/src/chemfiles/frame.rs.html @@ -0,0 +1,2298 @@ +frame.rs - source
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::ptr;
+use std::slice;
+
+use chemfiles_sys::*;
+use strings;
+use errors::{check_not_null, check_success, check, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Topology, TopologyRef, Residue, BondOrder};
+use super::{UnitCell, UnitCellRef, UnitCellMut};
+use property::{Property, RawProperty, PropertiesIter};
+
+/// A `Frame` contains data from one simulation step: the current unit
+/// cell, the topology, the positions, and the velocities of the particles in
+/// the system. If some information is missing (topology or velocity or unit
+/// cell), the corresponding data is filled with a default value.
+pub struct Frame {
+    handle: *mut CHFL_FRAME,
+}
+
+impl Clone for Frame {
+    fn clone(&self) -> Frame {
+        unsafe {
+            let new_handle = chfl_frame_copy(self.as_ptr());
+            Frame::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Frame {
+    /// Create a `Frame` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_FRAME) -> Frame {
+        check_not_null(ptr);
+        Frame {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Create an empty frame. It will be resized by the library as needed.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    ///
+    /// assert_eq!(frame.size(), 0);
+    /// ```
+    pub fn new() -> Frame {
+        unsafe {
+            Frame::from_ptr(chfl_frame())
+        }
+    }
+
+    /// Get a reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// let atom = frame.atom(0);
+    /// assert_eq!(atom.name(), "Zn");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_frame(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// assert_eq!(frame.atom(0).name(), "Zn");
+    ///
+    /// frame.atom_mut(0).set_name("Fe");
+    /// assert_eq!(frame.atom(0).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_frame(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.size(), 0);
+    ///
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_frame_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize the positions and the velocities in this frame, to make space for
+    /// `natoms` atoms. Previous data is conserved, as well as the presence of
+    /// absence of velocities.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_frame_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` and the corresponding position and optionally velocity
+    /// data to this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+    ///
+    /// frame.add_velocities();
+    /// frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+    /// ```
+    pub fn add_atom(
+        &mut self,
+        atom: &Atom,
+        position: [f64; 3],
+        velocity: impl Into<Option<[f64; 3]>>,
+    )
+    {
+        let velocity = velocity.into();
+        let velocity_ptr = match velocity {
+            Some(ref data) => data.as_ptr(),
+            None => ptr::null(),
+        };
+
+        unsafe {
+            check_success(chfl_frame_add_atom(
+                self.as_mut_ptr(),
+                atom.as_ptr(),
+                position.as_ptr(),
+                velocity_ptr
+            ));
+        }
+
+    }
+
+    /// Remove the atom at index `i` in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+    /// assert_eq!(frame.size(), 3);
+    ///
+    /// frame.remove(1);
+    /// assert_eq!(frame.size(), 2);
+    /// assert_eq!(frame.atom(1).name(), "Sn");
+    /// ```
+    pub fn remove(&mut self, i: usize) {
+        unsafe {
+            check_success(chfl_frame_remove(self.as_mut_ptr(), i as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    /// assert_eq!(frame.topology().bonds_count(), 3);
+    ///
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+    /// assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(2);
+    ///
+    /// frame.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_frame_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// the frame.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    ///
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+    ///
+    /// frame.remove_bond(2, 4);
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_remove_bond(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+            ));
+        }
+    }
+
+    /// Add a copy of `residue` to this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue id is already in this frame's
+    /// topology, or if the residue contain atoms that are already in another
+    /// residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Residue};
+    /// let mut frame = Frame::new();
+    ///
+    /// let residue = Residue::new("foo");
+    /// frame.add_residue(&residue).unwrap();
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.residues_count(), 1);
+    /// assert_eq!(topology.residue(0).unwrap().name(), "foo");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Get the distance between the atoms at indexes `i` and `j` in this frame,
+    /// accounting for periodic boundary conditions. The result is expressed in
+    /// Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+    ///
+    /// assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+    /// ```
+    pub fn distance(&self, i: usize, j: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_distance(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get the angle formed by the atoms at indexes `i`, `j` and `k` in this
+    /// frame, accounting for periodic boundary conditions. The result is
+    /// expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+    /// ```
+    pub fn angle(&self, i: usize, j: usize, k: usize) -> f64 {
+        let mut angle = 0.0;
+        unsafe {
+            check_success(chfl_frame_angle(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                &mut angle,
+            ));
+        }
+        return angle;
+    }
+
+    /// Get the dihedral angle formed by the atoms at indexes `i`, `j`, `k` and
+    /// `m` in this frame, accounting for periodic boundary conditions. The
+    /// result is expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+    ///
+    /// assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+    /// ```
+    pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut dihedral = 0.0;
+        unsafe {
+            check_success(chfl_frame_dihedral(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut dihedral,
+            ));
+        }
+        return dihedral;
+    }
+
+    /// Get the out of plane distance formed by the atoms at indexes `i`, `j`,
+    /// `k` and `m` in this frame, accounting for periodic boundary conditions.
+    /// The result is expressed in angstroms.
+    ///
+    /// This is the distance between the atom j and the ikm plane. The j atom
+    /// is the center of the improper dihedral angle formed by i, j, k and m.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+    /// frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+    /// ```
+    pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_out_of_plane(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get a view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions.len(), 67);
+    /// assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn positions(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms
+            ));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// {
+    ///     let positions = frame.positions_mut();
+    ///     assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    ///     positions[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn positions_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Get a view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    ///
+    /// let velocities = frame.velocities();
+    /// assert_eq!(velocities.len(), 67);
+    /// assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn velocities(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    /// {
+    ///     let velocities = frame.velocities_mut();
+    ///     assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    ///     velocities[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let velocities = frame.velocities();
+    /// assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn velocities_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Check if this frame contains velocity data.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn has_velocities(&self) -> bool {
+        let mut res = 0;
+        unsafe {
+            check_success(chfl_frame_has_velocities(self.as_ptr(), &mut res));
+        }
+        return res != 0;
+    }
+
+    /// Add velocity data to this frame. If the frame already have velocities,
+    /// this does nothing.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn add_velocities(&mut self) {
+        unsafe {
+            check_success(chfl_frame_add_velocities(self.as_mut_ptr()));
+        }
+    }
+
+    /// Get a reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let frame = Frame::new();
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn cell(&self) -> UnitCellRef {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW());
+            UnitCell::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// assert_eq!(frame.cell().shape(), CellShape::Infinite);
+    ///
+    /// frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+    /// ```
+    pub fn cell_mut(&mut self) -> UnitCellMut {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr());
+            UnitCell::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Set the `UnitCell` of this frame to `cell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, UnitCell, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_frame_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get a reference to the `Topology` of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(42);
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.size(), 42);
+    /// ```
+    pub fn topology(&self) -> TopologyRef {
+        unsafe {
+            let handle = chfl_topology_from_frame(self.as_ptr());
+            Topology::ref_from_ptr(handle)
+        }
+    }
+
+    /// Set the `Topology` of this frame to `topology`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology contains a different number of atoms
+    /// than this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Topology, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.resize(2);
+    ///
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_bond(0, 1);
+    ///
+    /// frame.set_topology(&topology).unwrap();
+    /// assert_eq!(frame.atom(0).name(), "Cl");
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_set_topology(self.as_mut_ptr(), topology.as_ptr()))
+        }
+    }
+
+    /// Get this frame step, i.e. the frame number in the trajectory
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    /// ```
+    pub fn step(&self) -> usize {
+        let mut step = 0;
+        unsafe {
+            check_success(chfl_frame_step(self.as_ptr(), &mut step));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return step as usize;
+    }
+
+    /// Set this frame step to `step`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    ///
+    /// frame.set_step(10);
+    /// assert_eq!(frame.step(), 10);
+    /// ```
+    pub fn set_step(&mut self, step: usize) {
+        unsafe {
+            check_success(chfl_frame_set_step(self.as_mut_ptr(), step as u64));
+        }
+    }
+
+    /// Guess the bonds, angles and dihedrals in this `frame`.
+    ///
+    /// The bonds are guessed using a distance-based algorithm, and then angles
+    /// and dihedrals are guessed from the bonds.
+    ///
+    /// # Errors
+    ////
+    /// This function can fail if the covalent radius is unknown for some atoms
+    /// in the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    ///
+    /// frame.guess_bonds().unwrap();
+    /// assert_eq!(frame.topology().bonds_count(), 1);
+    /// ```
+    pub fn guess_bonds(&mut self) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_guess_bonds(self.as_mut_ptr()))
+        }
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology of the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, Frame};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(1, 2);
+    ///
+    /// assert_eq!(frame.topology().bonds().len(), 2);
+    /// assert_eq!(frame.topology().angles().len(), 1);
+    ///
+    /// frame.clear_bonds();
+    /// assert!(frame.topology().bonds().is_empty());
+    /// assert!(frame.topology().angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_frame_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a new `property` with the given `name` to this frame.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("a string", "hello");
+    /// frame.set("a double", 4.3);
+    ///
+    /// assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_frame_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(frame.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_frame_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    /// frame.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in frame.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_frame_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_frame_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Frame {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Topology, UnitCell};
+
+    #[test]
+    fn clone() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+        let copy = frame.clone();
+        assert_eq!(copy.size(), 0);
+
+        frame.resize(42);
+        assert_eq!(frame.size(), 42);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+
+        frame.resize(12);
+        assert_eq!(frame.size(), 12);
+    }
+
+    #[test]
+    fn add_atom() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        let positions = &[[1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        frame.add_velocities();
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], [4.0, 3.0, 2.0]);
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+        assert_eq!(frame.atom(1).name(), "F");
+
+        let positions = &[[1.0, 1.0, 2.0], [1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        let velocities = &[[0.0, 0.0, 0.0], [4.0, 3.0, 2.0]];
+        assert_eq!(frame.velocities(), velocities);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_atom() {
+        let mut frame = Frame::new();
+        frame.resize(22);
+        let _atom = frame.atom(23);
+    }
+
+    #[test]
+    fn remove_atom() {
+        let mut frame = Frame::new();
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], None);
+
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        frame.remove(0);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "F");
+    }
+
+    #[test]
+    #[should_panic]
+    fn remove_out_of_bounds() {
+        let mut frame = Frame::new();
+        frame.resize(32);
+
+        frame.remove(100);
+    }
+
+    #[test]
+    fn positions() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.positions_mut().clone_from_slice(expected);
+        assert_eq!(frame.positions(), expected);
+    }
+
+    #[test]
+    fn velocities() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        assert!(!frame.has_velocities());
+        frame.add_velocities();
+        assert!(frame.has_velocities());
+
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.velocities_mut().clone_from_slice(expected);
+        assert_eq!(frame.velocities(), expected);
+    }
+
+    #[test]
+    fn cell() {
+        let mut frame = Frame::new();
+        frame.set_cell(&UnitCell::new([3.0, 4.0, 5.0]));
+        let cell = frame.cell();
+        assert_eq!(cell.lengths(), [3.0, 4.0, 5.0]);
+    }
+
+    #[test]
+    fn topology() {
+        let mut frame = Frame::new();
+        frame.resize(2);
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Zn"));
+        topology.add_atom(&Atom::new("Ar"));
+
+        assert!(frame.set_topology(&topology).is_ok());
+
+        let topology = frame.topology();
+
+        assert_eq!(topology.atom(0).name(), "Zn");
+        assert_eq!(topology.atom(1).name(), "Ar");
+
+        assert_eq!(frame.atom(0).name(), "Zn");
+        assert_eq!(frame.atom(1).name(), "Ar");
+    }
+
+    #[test]
+    fn bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        assert_eq!(frame.topology().bonds_count(), 0);
+
+        frame.add_bond(0, 1);
+        frame.add_bond(9, 2);
+        frame.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(frame.topology().bonds_count(), 3);
+
+        assert_eq!(frame.topology().bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(frame.topology().bond_orders(), expected);
+
+        assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(frame.topology().bond_order(3, 7), BondOrder::Aromatic);
+
+        frame.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        frame.remove_bond(8, 7);
+        assert_eq!(frame.topology().bonds_count(), 2);
+
+        frame.clear_bonds();
+        assert_eq!(frame.topology().bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn residues() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.topology().residues_count(), 0);
+
+        let residue = &Residue::new("foobar");
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+
+        assert_eq!(frame.topology().residues_count(), 3);
+        assert_eq!(frame.topology().residue(0).unwrap().name(), "foobar");
+    }
+
+    #[test]
+    fn step() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.step(), 0);
+        frame.set_step(42);
+        assert_eq!(frame.step(), 42);
+    }
+
+    #[test]
+    fn property() {
+        let mut frame = Frame::new();
+        frame.set("foo", -22.0);
+        assert_eq!(frame.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(frame.get("bar"), None);
+
+        frame.set("bar", Property::String("here".into()));
+        for (name, property) in frame.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+
+    #[test]
+    fn pbc_geometry() {
+        use std::f64::consts::PI;
+
+        let mut frame = Frame::new();
+        let atom = &Atom::new("");
+
+        frame.add_atom(atom, [1.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 1.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 2.0], None);
+
+        assert_eq!(frame.distance(0, 2), f64::sqrt(2.0));
+        assert_eq!(frame.angle(0, 1, 2), PI / 2.0);
+        assert_eq!(frame.dihedral(0, 1, 2, 3), PI / 2.0);
+        assert_eq!(frame.out_of_plane(1, 4, 0, 2), 2.0);
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/lib.rs.html b/0.10.2/src/chemfiles/lib.rs.html new file mode 100644 index 000000000..10b9c7ba0 --- /dev/null +++ b/0.10.2/src/chemfiles/lib.rs.html @@ -0,0 +1,284 @@ +lib.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! Chemfiles is a multi-language library written in modern C++ for reading and
+//! writing from and to molecular trajectory files. These files are created by
+//! your favorite theoretical chemistry program, and contains information about
+//! atomic or residues names and positions. Some format also have additional
+//! information, such as velocities, forces, energy, …
+//!
+//! This crate expose the C API of chemfiles to Rust, and make all the
+//! functionalities accessible. For more information on the C++ library,
+//! please see its [documentation][cxx_doc]. Specifically, the following pages
+//! are worth reading:
+//!
+//! - The [overview][overview] of the classes organization;
+//! - The list of [supported formats][formats];
+//! - The documentation for the [selection language][selections];
+//!
+//! [cxx_doc]: https://chemfiles.org/chemfiles
+//! [overview]: https://chemfiles.org/chemfiles/latest/overview.html
+//! [formats]: https://chemfiles.org/chemfiles/latest/formats.html
+//! [selections]: https://chemfiles.org/chemfiles/latest/selections.html
+
+#![deny(missing_docs)]
+#![warn(trivial_casts, unused_import_braces, variant_size_differences)]
+#![warn(unused_results)]
+// Configuration for clippy lints
+#![warn(clippy::all, clippy::pedantic)]
+#![allow(clippy::needless_return, clippy::module_name_repetitions)]
+#![allow(clippy::must_use_candidate, clippy::wildcard_imports)]
+
+// Allow a few more clippy lints in test mode
+#![cfg_attr(test, allow(clippy::float_cmp, clippy::unreadable_literal, clippy::shadow_unrelated))]
+
+// deny(warnings) in doc tests
+#![doc(test(attr(deny(warnings))))]
+#![doc(test(attr(allow(unused_variables))))]
+
+#[cfg(test)]
+#[macro_use]
+extern crate approx;
+
+extern crate chemfiles_sys;
+use chemfiles_sys::{chfl_add_configuration, chfl_version};
+
+mod strings;
+
+mod errors;
+pub use errors::{Error, Status};
+pub use errors::set_warning_callback;
+
+mod atom;
+pub use atom::Atom;
+pub use atom::AtomRef;
+pub use atom::AtomMut;
+
+mod cell;
+pub use cell::UnitCell;
+pub use cell::UnitCellRef;
+pub use cell::UnitCellMut;
+pub use cell::CellShape;
+
+mod residue;
+pub use residue::Residue;
+pub use residue::ResidueRef;
+
+mod topology;
+pub use topology::Topology;
+pub use topology::TopologyRef;
+pub use topology::BondOrder;
+
+mod frame;
+pub use frame::Frame;
+
+mod trajectory;
+pub use trajectory::Trajectory;
+
+mod selection;
+pub use selection::{Match, Selection};
+
+mod property;
+pub use property::Property;
+pub use property::PropertiesIter;
+
+mod misc;
+pub use misc::{FormatMetadata, formats_list, guess_format};
+
+/// Get the version of the chemfiles library.
+///
+/// # Example
+/// ```
+/// let version = chemfiles::version();
+/// assert!(version.starts_with("0.10"));
+/// ```
+pub fn version() -> String {
+    unsafe { strings::from_c(chfl_version()) }
+}
+
+/// Read configuration data from the file at `path`.
+///
+/// By default, chemfiles reads configuration from any file named
+/// `.chemfiles.toml` in the current directory or any parent directory. This
+/// function can be used to add data from another configuration file. Data from
+/// the new configuration file will overwrite any existing data.
+///
+/// # Errors
+///
+/// This function will fail if there is no file at `path`, or if the file is
+/// incorrectly formatted.
+///
+/// # Example
+/// ```no_run
+/// chemfiles::add_configuration("local-config.toml").unwrap();
+/// // from now on, the data from "local-config.toml" will be used
+/// ```
+pub fn add_configuration<S>(path: S) -> Result<(), Error>
+where
+    S: AsRef<str>,
+{
+    let buffer = strings::to_c(path.as_ref());
+    unsafe {
+        errors::check(chfl_add_configuration(buffer.as_ptr()))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    fn version() {
+        assert!(!crate::version().is_empty());
+        assert!(crate::version().starts_with("0.10"));
+    }
+}
+
+#[cfg(test)]
+fn assert_vector3d_eq(lhs: &[f64; 3], rhs: &[f64; 3], eps: f64) {
+    lhs.iter()
+        .zip(rhs)
+        .for_each(|(l, r)| assert_ulps_eq!(l, r, epsilon = eps));
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/misc.rs.html b/0.10.2/src/chemfiles/misc.rs.html new file mode 100644 index 000000000..407f737fe --- /dev/null +++ b/0.10.2/src/chemfiles/misc.rs.html @@ -0,0 +1,276 @@ +misc.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2020 Guillaume Fraux -- BSD licensed
+
+use std::convert::TryInto;
+use std::ffi::CStr;
+
+use chemfiles_sys::{chfl_format_metadata, chfl_formats_list, chfl_free, chfl_guess_format};
+use errors::check_success;
+
+/// `FormatMetadata` contains metadata associated with one format.
+#[allow(clippy::struct_excessive_bools)]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct FormatMetadata {
+    /// Name of the format.
+    pub name: &'static str,
+    /// Extension associated with the format.
+    pub extension: Option<&'static str>,
+    /// Extended, user-facing description of the format.
+    pub description: &'static str,
+    /// URL pointing to the format definition/reference.
+    pub reference: &'static str,
+    /// Is reading files in this format implemented?
+    pub read: bool,
+    /// Is writing files in this format implemented?
+    pub write: bool,
+    /// Does this format support in-memory IO?
+    pub memory: bool,
+    /// Does this format support storing atomic positions?
+    pub positions: bool,
+    /// Does this format support storing atomic velocities?
+    pub velocities: bool,
+    /// Does this format support storing unit cell information?
+    pub unit_cell: bool,
+    /// Does this format support storing atom names or types?
+    pub atoms: bool,
+    /// Does this format support storing bonds between atoms?
+    pub bonds: bool,
+    /// Does this format support storing residues?
+    pub residues: bool,
+}
+
+impl FormatMetadata {
+    pub(crate) fn from_raw(raw: &chfl_format_metadata) -> Self {
+        let str_from_ptr = |ptr| unsafe {
+            CStr::from_ptr(ptr)
+                .to_str()
+                .expect("Invalid Rust str from C")
+        };
+        let extension = if raw.extension.is_null() {
+            None
+        } else {
+            Some(str_from_ptr(raw.extension))
+        };
+        Self {
+            name: str_from_ptr(raw.name),
+            extension,
+            description: str_from_ptr(raw.description),
+            reference: str_from_ptr(raw.reference),
+            read: raw.read,
+            write: raw.write,
+            memory: raw.memory,
+            positions: raw.positions,
+            velocities: raw.velocities,
+            unit_cell: raw.unit_cell,
+            atoms: raw.atoms,
+            bonds: raw.bonds,
+            residues: raw.residues,
+        }
+    }
+}
+
+/// Get the list of formats known by chemfiles, as well as all associated metadata.
+///
+/// # Example
+/// ```
+/// let formats = chemfiles::formats_list();
+/// println!("chemfiles supports {} formats:", formats.len());
+/// for format in &formats {
+///     println!(
+///         "   {:<15} {}",
+///         format.name,
+///         format.extension.as_deref().unwrap_or("")
+///     );
+/// }
+/// ```
+#[must_use]
+pub fn formats_list() -> Vec<FormatMetadata> {
+    let mut formats = std::ptr::null_mut();
+    let mut count: u64 = 0;
+    let formats_slice = unsafe {
+        check_success(chfl_formats_list(&mut formats, &mut count));
+        std::slice::from_raw_parts(formats, count.try_into().expect("failed to convert u64 to usize"))
+    };
+    let formats_vec = formats_slice
+        .iter()
+        .map(|fm| FormatMetadata::from_raw(fm))
+        .collect();
+    unsafe {
+        let _ = chfl_free(formats as *const _);
+    }
+    return formats_vec;
+}
+
+#[allow(clippy::doc_markdown)]
+/// Get the format that chemfiles would use to read a file at the given
+/// ``path``.
+///
+/// The format is mostly guessed from the path extension, chemfiles only tries
+/// to read the file to distinguish between CIF and mmCIF files. Opening the
+/// file using the returned format string might still fail. For example, it will
+/// fail if the file is not actually formatted according to the guessed format;
+/// or the format/compression combination is not supported (e.g. `XTC / GZ` will
+/// not work since the XTC reader does not support compressed files).
+///
+/// The returned format is represented in a way compatible with the various
+/// `Trajectory` constructors, i.e. `"<format name> [/ <compression>]"`, where
+/// compression is optional.
+///
+/// # Examples
+/// ```
+/// let format = chemfiles::guess_format("trajectory.xyz.xz");
+/// assert_eq!(format, "XYZ / XZ");
+///
+/// let format = chemfiles::guess_format("trajectory.nc");
+/// assert_eq!(format, "Amber NetCDF");
+/// ```
+pub fn guess_format(path: &str) -> String {
+    let path = crate::strings::to_c(path);
+    let mut buffer = vec![0; 128];
+    unsafe {
+        check_success(chfl_guess_format(
+            path.as_ptr(), buffer.as_mut_ptr(), buffer.len() as u64
+        ));
+    }
+    return crate::strings::from_c(buffer.as_ptr());
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/property.rs.html b/0.10.2/src/chemfiles/property.rs.html new file mode 100644 index 000000000..b3bc3f096 --- /dev/null +++ b/0.10.2/src/chemfiles/property.rs.html @@ -0,0 +1,584 @@ +property.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::vec::IntoIter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use strings;
+
+/// A thin wrapper around `CHFL_PROPERTY`
+pub(crate) struct RawProperty {
+    handle: *mut CHFL_PROPERTY,
+}
+
+impl RawProperty {
+    /// Create a `RawProperty` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    pub unsafe fn from_ptr(ptr: *mut CHFL_PROPERTY) -> RawProperty {
+        check_not_null(ptr);
+        RawProperty {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    pub fn as_ptr(&self) -> *const CHFL_PROPERTY {
+        self.handle
+    }
+
+    fn double(value: f64) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_double(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn bool(value: bool) -> RawProperty {
+        let value = if value { 1 } else { 0 };
+        unsafe {
+            let handle = chfl_property_bool(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn vector3d(value: [f64; 3]) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_vector3d(value.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn string(value: &str) -> RawProperty {
+        let buffer = strings::to_c(value);
+        unsafe {
+            let handle = chfl_property_string(buffer.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn get_kind(&self) -> chfl_property_kind {
+        let mut kind = chfl_property_kind::CHFL_PROPERTY_BOOL;
+        unsafe {
+            check_success(chfl_property_get_kind(self.as_ptr(), &mut kind));
+        }
+        return kind;
+    }
+
+    fn get_bool(&self) -> Result<bool, Error> {
+        let mut value = 0;
+        unsafe {
+            check(chfl_property_get_bool(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value != 0);
+    }
+
+    fn get_double(&self) -> Result<f64, Error> {
+        let mut value = 0.0;
+        unsafe {
+            check(chfl_property_get_double(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value);
+    }
+
+    fn get_string(&self) -> Result<String, Error> {
+        let get_string = |ptr, len| unsafe { chfl_property_get_string(self.as_ptr(), ptr, len) };
+        let value = strings::call_autogrow_buffer(64, get_string)?;
+        return Ok(strings::from_c(value.as_ptr()));
+    }
+
+    fn get_vector3d(&self) -> Result<[f64; 3], Error> {
+        let mut value = [0.0; 3];
+        unsafe {
+            check(chfl_property_get_vector3d(self.as_ptr(), value.as_mut_ptr()))?;
+        }
+        return Ok(value);
+    }
+}
+
+impl Drop for RawProperty {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+/// A `Property` is a piece of data that can be associated with an `Atom` or a
+/// `Frame`.
+#[derive(Debug, Clone, PartialEq, PartialOrd)]
+pub enum Property {
+    /// Boolean property
+    Bool(bool),
+    /// Floating point property
+    Double(f64),
+    /// String property
+    String(String),
+    /// 3-dimensional vector property
+    Vector3D([f64; 3]),
+}
+
+impl From<bool> for Property {
+    fn from(value: bool) -> Self {
+        Property::Bool(value)
+    }
+}
+
+impl From<f64> for Property {
+    fn from(value: f64) -> Self {
+        Property::Double(value)
+    }
+}
+
+impl From<String> for Property {
+    fn from(value: String) -> Self {
+        Property::String(value)
+    }
+}
+
+impl<'a> From<&'a str> for Property {
+    fn from(value: &'a str) -> Self {
+        Property::String(value.into())
+    }
+}
+
+impl From<[f64; 3]> for Property {
+    fn from(value: [f64; 3]) -> Self {
+        Property::Vector3D(value)
+    }
+}
+
+impl Property {
+    pub(crate) fn as_raw(&self) -> RawProperty {
+        match *self {
+            Property::Bool(value) => RawProperty::bool(value),
+            Property::Double(value) => RawProperty::double(value),
+            Property::String(ref value) => RawProperty::string(value),
+            Property::Vector3D(value) => RawProperty::vector3d(value),
+        }
+    }
+
+    #[allow(clippy::needless_pass_by_value)]  // raw property
+    pub(crate) fn from_raw(raw: RawProperty) -> Property {
+        match raw.get_kind() {
+            chfl_property_kind::CHFL_PROPERTY_BOOL => {
+                Property::Bool(raw.get_bool().expect("shoudl be a bool"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_DOUBLE => {
+                Property::Double(raw.get_double().expect("should be a double"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_STRING => {
+                Property::String(raw.get_string().expect("should be a string"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_VECTOR3D => {
+                Property::Vector3D(raw.get_vector3d().expect("should be a vector3d"))
+            }
+        }
+    }
+}
+
+/// An iterator over the properties in an atom/frame/residue
+pub struct PropertiesIter<'a> where  {
+    pub(crate) names: IntoIter<String>,
+    pub(crate) getter: Box<dyn Fn(&str) -> Property + 'a>,
+}
+
+impl<'a> Iterator for PropertiesIter<'a> {
+    type Item = (String, Property);
+    fn next(&mut self) -> Option<Self::Item> {
+        self.names.next().map(|name| {
+            let property = (self.getter)(&*name);
+            (name, property)
+        })
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.names.size_hint()
+    }
+
+    fn count(self) -> usize {
+        self.names.count()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    mod raw {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = RawProperty::bool(false);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(property.get_bool(), Ok(false));
+        }
+
+        #[test]
+        fn double() {
+            let property = RawProperty::double(45.0);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(property.get_double(), Ok(45.0));
+        }
+
+        #[test]
+        fn string() {
+            let property = RawProperty::string("test");
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(property.get_string(), Ok("test".into()));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = RawProperty::vector3d([1.2, 3.4, 5.6]);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(property.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+        }
+    }
+
+    mod rust {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = Property::Bool(false);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(raw.get_bool(), Ok(false));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn double() {
+            let property = Property::Double(45.0);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(raw.get_double(), Ok(45.0));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn string() {
+            let property = Property::String("test".into());
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(raw.get_string(), Ok("test".into()));
+
+            assert_eq!(Property::from_raw(raw), property);
+
+            let property = Property::String("long string ".repeat(128));
+            let raw = property.as_raw();
+            assert_eq!(raw.get_string(), Ok("long string ".repeat(128)));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = Property::Vector3D([1.2, 3.4, 5.6]);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(raw.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/residue.rs.html b/0.10.2/src/chemfiles/residue.rs.html new file mode 100644 index 000000000..c569f85b5 --- /dev/null +++ b/0.10.2/src/chemfiles/residue.rs.html @@ -0,0 +1,826 @@ +residue.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_not_null, check_success};
+use property::{Property, RawProperty, PropertiesIter};
+use strings;
+
+/// A `Residue` is a group of atoms belonging to the same logical unit. They
+/// can be small molecules, amino-acids in a protein, monomers in polymers,
+/// *etc.*
+pub struct Residue {
+    handle: *mut CHFL_RESIDUE,
+}
+
+/// An analog to a reference to a residue (`&Residue`)
+pub struct ResidueRef<'a> {
+    inner: Residue,
+    marker: PhantomData<&'a Residue>
+}
+
+impl<'a> Deref for ResidueRef<'a> {
+    type Target = Residue;
+    fn deref(&self) -> &Residue {
+        &self.inner
+    }
+}
+
+impl Clone for Residue {
+    fn clone(&self) -> Residue {
+        unsafe {
+            let new_handle = chfl_residue_copy(self.as_ptr());
+            Residue::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Residue {
+    /// Create a `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_RESIDUE) -> Residue {
+        check_not_null(ptr);
+        Residue {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_RESIDUE) -> ResidueRef<'a> {
+        ResidueRef {
+            inner: Residue::from_ptr(ptr as *mut CHFL_RESIDUE),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Create a new residue with the given `name`
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("ALA");
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), None);
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue(buffer.as_ptr());
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Create a new residue with the given `name` and `id` as identifier.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("ALA", 67);
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), Some(67));
+    /// ```
+    pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue_with_id(buffer.as_ptr(), id);
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Get the number of atoms in this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    ///
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// assert_eq!(residue.size(), 3);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_residue_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the identifier of this residue in the initial topology file.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("", 42);
+    /// assert_eq!(residue.id(), Some(42));
+    /// ```
+    pub fn id(&self) -> Option<i64> {
+        let mut resid = 0;
+        let status = unsafe {
+            chfl_residue_id(self.as_ptr(), &mut resid)
+        };
+
+        if status == chfl_status::CHFL_SUCCESS {
+            return Some(resid);
+        } else if status == chfl_status::CHFL_GENERIC_ERROR {
+            return None;
+        }
+
+        // call check_success to panic in case of error
+        check_success(status);
+        unreachable!();
+    }
+
+    /// Get the name of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("water");
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_residue_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(64, get_name).expect("getting residue name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Add the atom at index `atom` in this residue.
+    ///
+    /// This will fail if the atom is already in the residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// assert_eq!(residue.contains(56), true);
+    ///
+    /// // Adding the same atom twice is fine
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// ```
+    pub fn add_atom(&mut self, atom: usize) {
+        unsafe {
+            check_success(chfl_residue_add_atom(self.as_mut_ptr(), atom as u64));
+        }
+    }
+
+    /// Check if the atom at index `i` is in this residue
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.contains(56), true);
+    /// ```
+    pub fn contains(&self, atom: usize) -> bool {
+        let mut inside = 0;
+        unsafe {
+            check_success(chfl_residue_contains(self.as_ptr(), atom as u64, &mut inside));
+        }
+        return inside != 0;
+    }
+
+    /// Get the list of atoms of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.atoms(), vec![]);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.atoms(), vec![56]);
+    /// ```
+    pub fn atoms(&self) -> Vec<usize> {
+        let size = self.size();
+        let count = size as u64;
+        let mut indices = vec![u64::max_value(); size];
+        unsafe {
+            check_success(chfl_residue_atoms(
+                self.as_ptr(),
+                indices.as_mut_ptr(),
+                count,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return indices.into_iter().map(|idx| idx as usize).collect();
+    }
+
+    /// Add a new `property` with the given `name` to this residue.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("a string", "hello");
+    /// residue.set("a double", 3.2);
+    ///
+    /// assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_residue_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(residue.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_residue_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    /// residue.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in residue.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_residue_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_residue_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(&*name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Residue {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        let copy = residue.clone();
+        assert_eq!(copy.size(), 0);
+
+        residue.add_atom(3);
+        residue.add_atom(7);
+        assert_eq!(residue.size(), 2);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn name() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.name(), "A");
+    }
+
+    #[test]
+    fn id() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.id(), None);
+
+        let residue = Residue::with_id("A", 42);
+        assert_eq!(residue.id(), Some(42));
+
+        let residue = Residue::with_id("A", -3);
+        assert_eq!(residue.id(), Some(-3));
+    }
+
+    #[test]
+    fn atoms() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        residue.add_atom(0);
+        residue.add_atom(3);
+        residue.add_atom(45);
+        assert_eq!(residue.size(), 3);
+
+        assert!(residue.contains(3));
+        assert!(!residue.contains(5));
+
+        assert_eq!(residue.atoms(), vec![0, 3, 45]);
+    }
+
+    #[test]
+    fn property() {
+        let mut residue = Residue::new("ALA");
+
+        residue.set("foo", -22.0);
+        assert_eq!(residue.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(residue.get("bar"), None);
+
+        residue.set("bar", Property::String("here".into()));
+        for (name, property) in residue.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/selection.rs.html b/0.10.2/src/chemfiles/selection.rs.html new file mode 100644 index 000000000..20a4b6543 --- /dev/null +++ b/0.10.2/src/chemfiles/selection.rs.html @@ -0,0 +1,860 @@ +selection.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Index};
+use std::iter::IntoIterator;
+use std::slice::Iter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error, Status};
+use strings;
+use frame::Frame;
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+/// A `Match` is a set of atomic indexes matching a given selection. It can
+/// mostly be used like a `&[usize]`.
+pub struct Match {
+    size: usize,
+    atoms: [usize; 4],
+}
+
+#[allow(clippy::len_without_is_empty)]
+impl Match {
+    /// Get the length of the Match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// ```
+    pub fn len(&self) -> usize {
+        self.size
+    }
+
+    /// Create a new match containing the atoms in the `atoms` slice.
+    ///
+    /// # Panics
+    ///
+    /// If the slice contains more than 4 elements, which is the maximal size
+    /// of a match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// assert_eq!(atomic_match[0], 3);
+    /// assert_eq!(atomic_match[1], 4);
+    /// assert_eq!(atomic_match[2], 5);
+    /// ```
+    pub fn new(atoms: &[usize]) -> Match {
+        assert!(atoms.len() <= 4);
+        let size = atoms.len();
+        let mut matches = [usize::max_value(); 4];
+        for (i, atom) in atoms.iter().enumerate() {
+            matches[i] = *atom;
+        }
+        Match {
+            size,
+            atoms: matches,
+        }
+    }
+
+    /// Iterate over the atomic indexes in the match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// let mut iter = atomic_match.iter();
+    ///
+    /// assert_eq!(iter.next(), Some(&3));
+    /// assert_eq!(iter.next(), Some(&4));
+    /// assert_eq!(iter.next(), Some(&5));
+    /// assert_eq!(iter.next(), None);
+    /// ```
+    pub fn iter(&self) -> Iter<usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+impl Index<usize> for Match {
+    type Output = usize;
+    fn index(&self, i: usize) -> &Self::Output {
+        assert!(i < self.len());
+        &self.atoms[i]
+    }
+}
+
+impl<'a> IntoIterator for &'a Match {
+    type Item = &'a usize;
+    type IntoIter = Iter<'a, usize>;
+    fn into_iter(self) -> Iter<'a, usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+/// A `Selection` allow to select atoms in a `Frame`, from a selection
+/// language. The selection language is built by combining basic operations.
+/// Each basic operation follows the `<selector>[(<variable>)] <operator>
+/// <value>` structure, where `<operator>` is a comparison operator in
+/// `== != < <= > >=`.
+pub struct Selection {
+    handle: *mut CHFL_SELECTION,
+}
+
+impl Clone for Selection {
+    fn clone(&self) -> Selection {
+        unsafe {
+            let new_handle = chfl_selection_copy(self.as_ptr());
+            Selection::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Drop for Selection {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl Selection {
+    /// Create a `Selection` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_SELECTION) -> Selection {
+        check_not_null(ptr);
+        Selection {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Create a new selection from the given selection string.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the selection string is invalid.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// ```
+    pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error> {
+        let buffer = strings::to_c(selection.into());
+        unsafe {
+            let handle = chfl_selection(buffer.as_ptr());
+            if handle.is_null() {
+                Err(Error {
+                    status: Status::SelectionError,
+                    message: Error::last_error()
+                })
+            } else {
+                Ok(Selection::from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the size of the selection, i.e. the number of atoms we are selecting
+    /// together.
+    ///
+    /// This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond'
+    /// context, 3 for the 'three' and 'angles' context and 4 for the 'four'
+    /// and 'dihedral' context.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// assert_eq!(selection.size(), 2);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_selection_size(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the selection string used to create this selection.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("name H").unwrap();
+    /// assert_eq!(selection.string(), "name H");
+    /// ```
+    pub fn string(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_selection_string(self.as_ptr(), ptr, len) };
+        let selection = strings::call_autogrow_buffer(1024, get_string).expect("failed to get selection string");
+        return strings::from_c(selection.as_ptr());
+    }
+
+    /// Evaluate a selection for a given frame, and return the corresponding
+    /// matches.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// let matches = selection.evaluate(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    ///
+    /// assert_eq!(matches[0].len(), 2);
+    /// assert_eq!(matches[0][0], 0);
+    /// assert_eq!(matches[0][1], 1);
+    ///
+    /// assert_eq!(matches[1].len(), 2);
+    /// assert_eq!(matches[1][0], 2);
+    /// assert_eq!(matches[1][1], 1);
+    /// ```
+    pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match> {
+        #![allow(clippy::cast_possible_truncation)]
+        let mut count = 0;
+        unsafe {
+            check(chfl_selection_evaluate(
+                self.as_mut_ptr(), frame.as_ptr(), &mut count
+            )).expect("failed to evaluate selection");
+        }
+
+        let size = count as usize;
+        let mut chfl_matches = vec![chfl_match { size: 0, atoms: [0; 4] }; size];
+        unsafe {
+            check(chfl_selection_matches(
+                self.handle,
+                chfl_matches.as_mut_ptr(),
+                count
+            )).expect("failed to extract matches");
+        }
+
+        return chfl_matches.into_iter()
+            .map(|chfl_match| Match {
+                size: chfl_match.size as usize,
+                atoms: [
+                    chfl_match.atoms[0] as usize,
+                    chfl_match.atoms[1] as usize,
+                    chfl_match.atoms[2] as usize,
+                    chfl_match.atoms[3] as usize,
+                ],
+            })
+            .collect();
+    }
+
+    /// Evaluates a selection of size 1 on a given `frame`. This function
+    /// returns the list of atomic indexes in the frame matching this selection.
+    ///
+    /// # Panics
+    ///
+    /// If the selection size is not 1
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("name H").unwrap();
+    /// let matches = selection.list(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    /// assert_eq!(matches[0], 0);
+    /// assert_eq!(matches[1], 2);
+    /// ```
+    pub fn list(&mut self, frame: &Frame) -> Vec<usize> {
+        if self.size() != 1 {
+            panic!("can not call `Selection::list` on a multiple selection");
+        }
+        return self.evaluate(frame)
+            .into_iter()
+            .map(|m| m[0] as usize)
+            .collect();
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use Frame;
+    use Topology;
+    use Atom;
+
+    #[test]
+    fn clone() {
+        let selection = Selection::new("name H").unwrap();
+
+        let copy = selection.clone();
+        assert_eq!(selection.size(), 1);
+        assert_eq!(copy.size(), 1);
+    }
+
+    fn testing_frame() -> Frame {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("H"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("H"));
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(2, 3);
+
+        let mut frame = Frame::new();
+        frame.resize(4);
+        frame.set_topology(&topology).unwrap();
+        return frame;
+    }
+
+    mod matches {
+        use super::*;
+
+        #[test]
+        fn index() {
+            let m = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+            assert_eq!(m[2], 3);
+            assert_eq!(m[3], 4);
+
+            let m = Match::new(&[1, 2]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+        }
+
+        #[test]
+        fn iter() {
+            let match_ = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(match_.iter().copied().collect::<Vec<usize>>(), vec![1, 2, 3, 4]);
+
+            let v = vec![1, 2, 3, 4];
+            for (i, &m) in match_.iter().enumerate() {
+                assert_eq!(v[i], m);
+            }
+        }
+
+        #[test]
+        #[should_panic]
+        fn out_of_bound() {
+            let m = Match::new(&[1, 2]);
+            let _ = m[2];
+        }
+
+        #[test]
+        #[should_panic]
+        fn too_big() {
+            let _ = Match::new(&[1, 2, 3, 5, 4]);
+        }
+    }
+
+    #[test]
+    fn size() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.size(), 1);
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 3);
+
+        let selection = Selection::new("four: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 4);
+    }
+
+    #[test]
+    fn string() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.string(), "name H");
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.string(), "angles: name(#1) H");
+    }
+
+    #[test]
+    fn evaluate() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.evaluate(&frame);
+        assert_eq!(res, &[Match::new(&[0]), Match::new(&[3])]);
+
+        let mut selection = Selection::new("angles: all").unwrap();
+        let res = selection.evaluate(&frame);
+        for m in &[Match::new(&[0, 1, 2]), Match::new(&[1, 2, 3])] {
+            assert!(res.iter().any(|r| r == m));
+        }
+    }
+
+    #[test]
+    fn list() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.list(&frame);
+        assert_eq!(res, vec![0, 3]);
+    }
+
+    #[test]
+    #[should_panic = "can not call `Selection::list` on a multiple selection"]
+    fn list_on_size_1_selection() {
+        let frame = testing_frame();
+        let mut selection = Selection::new("pairs: name(#1) H").unwrap();
+        let _list = selection.list(&frame);
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/strings.rs.html b/0.10.2/src/chemfiles/strings.rs.html new file mode 100644 index 000000000..6994ede6b --- /dev/null +++ b/0.10.2/src/chemfiles/strings.rs.html @@ -0,0 +1,118 @@ +strings.rs - source
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! String conversions between C and Rust
+use std::ffi::{CStr, CString};
+
+use chemfiles_sys::chfl_status;
+use errors::{check, Error};
+
+/// Create a Rust string from a C string. Clones all characters in `buffer`.
+pub fn from_c(buffer: *const i8) -> String {
+    unsafe {
+        let rust_str = CStr::from_ptr(buffer)
+            .to_str()
+            .expect("Invalid Rust string from C");
+        return String::from(rust_str);
+    }
+}
+
+/// Create a C string from a Rust string.
+pub fn to_c(string: &str) -> CString {
+    CString::new(string).expect("Invalid C string from Rust")
+}
+
+/// Check if a string buffer was big enough when passed to a C function
+fn buffer_was_big_enough(buffer: &[i8]) -> bool {
+    let len = buffer.len();
+    if len < 2 {
+        false
+    } else {
+        // The C code should always set the last element to 0
+        debug_assert_eq!(buffer[len - 1], 0);
+        buffer[len - 2] == 0
+    }
+}
+
+/// Call `callback` C function with a string buffer and it length, using
+/// `initial` as the buffer initial size. If the buffer was filled and the
+/// result truncated by the C library, grow the buffer and try again until we
+/// get all the data. Then return the filled buffer to the caller.
+pub fn call_autogrow_buffer<F>(initial: usize, callback: F) -> Result<Vec<i8>, Error>
+where
+    F: Fn(*mut i8, u64) -> chfl_status,
+{
+    let mut size = initial;
+    let mut buffer = vec![0; size];
+    check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+
+    while !buffer_was_big_enough(&buffer) {
+        // Grow the buffer and retry
+        size *= 2;
+        buffer.resize(size, 0);
+        check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+    }
+
+    Ok(buffer)
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/topology.rs.html b/0.10.2/src/chemfiles/topology.rs.html new file mode 100644 index 000000000..3097d9688 --- /dev/null +++ b/0.10.2/src/chemfiles/topology.rs.html @@ -0,0 +1,2014 @@ +topology.rs - source
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 359
+ 360
+ 361
+ 362
+ 363
+ 364
+ 365
+ 366
+ 367
+ 368
+ 369
+ 370
+ 371
+ 372
+ 373
+ 374
+ 375
+ 376
+ 377
+ 378
+ 379
+ 380
+ 381
+ 382
+ 383
+ 384
+ 385
+ 386
+ 387
+ 388
+ 389
+ 390
+ 391
+ 392
+ 393
+ 394
+ 395
+ 396
+ 397
+ 398
+ 399
+ 400
+ 401
+ 402
+ 403
+ 404
+ 405
+ 406
+ 407
+ 408
+ 409
+ 410
+ 411
+ 412
+ 413
+ 414
+ 415
+ 416
+ 417
+ 418
+ 419
+ 420
+ 421
+ 422
+ 423
+ 424
+ 425
+ 426
+ 427
+ 428
+ 429
+ 430
+ 431
+ 432
+ 433
+ 434
+ 435
+ 436
+ 437
+ 438
+ 439
+ 440
+ 441
+ 442
+ 443
+ 444
+ 445
+ 446
+ 447
+ 448
+ 449
+ 450
+ 451
+ 452
+ 453
+ 454
+ 455
+ 456
+ 457
+ 458
+ 459
+ 460
+ 461
+ 462
+ 463
+ 464
+ 465
+ 466
+ 467
+ 468
+ 469
+ 470
+ 471
+ 472
+ 473
+ 474
+ 475
+ 476
+ 477
+ 478
+ 479
+ 480
+ 481
+ 482
+ 483
+ 484
+ 485
+ 486
+ 487
+ 488
+ 489
+ 490
+ 491
+ 492
+ 493
+ 494
+ 495
+ 496
+ 497
+ 498
+ 499
+ 500
+ 501
+ 502
+ 503
+ 504
+ 505
+ 506
+ 507
+ 508
+ 509
+ 510
+ 511
+ 512
+ 513
+ 514
+ 515
+ 516
+ 517
+ 518
+ 519
+ 520
+ 521
+ 522
+ 523
+ 524
+ 525
+ 526
+ 527
+ 528
+ 529
+ 530
+ 531
+ 532
+ 533
+ 534
+ 535
+ 536
+ 537
+ 538
+ 539
+ 540
+ 541
+ 542
+ 543
+ 544
+ 545
+ 546
+ 547
+ 548
+ 549
+ 550
+ 551
+ 552
+ 553
+ 554
+ 555
+ 556
+ 557
+ 558
+ 559
+ 560
+ 561
+ 562
+ 563
+ 564
+ 565
+ 566
+ 567
+ 568
+ 569
+ 570
+ 571
+ 572
+ 573
+ 574
+ 575
+ 576
+ 577
+ 578
+ 579
+ 580
+ 581
+ 582
+ 583
+ 584
+ 585
+ 586
+ 587
+ 588
+ 589
+ 590
+ 591
+ 592
+ 593
+ 594
+ 595
+ 596
+ 597
+ 598
+ 599
+ 600
+ 601
+ 602
+ 603
+ 604
+ 605
+ 606
+ 607
+ 608
+ 609
+ 610
+ 611
+ 612
+ 613
+ 614
+ 615
+ 616
+ 617
+ 618
+ 619
+ 620
+ 621
+ 622
+ 623
+ 624
+ 625
+ 626
+ 627
+ 628
+ 629
+ 630
+ 631
+ 632
+ 633
+ 634
+ 635
+ 636
+ 637
+ 638
+ 639
+ 640
+ 641
+ 642
+ 643
+ 644
+ 645
+ 646
+ 647
+ 648
+ 649
+ 650
+ 651
+ 652
+ 653
+ 654
+ 655
+ 656
+ 657
+ 658
+ 659
+ 660
+ 661
+ 662
+ 663
+ 664
+ 665
+ 666
+ 667
+ 668
+ 669
+ 670
+ 671
+ 672
+ 673
+ 674
+ 675
+ 676
+ 677
+ 678
+ 679
+ 680
+ 681
+ 682
+ 683
+ 684
+ 685
+ 686
+ 687
+ 688
+ 689
+ 690
+ 691
+ 692
+ 693
+ 694
+ 695
+ 696
+ 697
+ 698
+ 699
+ 700
+ 701
+ 702
+ 703
+ 704
+ 705
+ 706
+ 707
+ 708
+ 709
+ 710
+ 711
+ 712
+ 713
+ 714
+ 715
+ 716
+ 717
+ 718
+ 719
+ 720
+ 721
+ 722
+ 723
+ 724
+ 725
+ 726
+ 727
+ 728
+ 729
+ 730
+ 731
+ 732
+ 733
+ 734
+ 735
+ 736
+ 737
+ 738
+ 739
+ 740
+ 741
+ 742
+ 743
+ 744
+ 745
+ 746
+ 747
+ 748
+ 749
+ 750
+ 751
+ 752
+ 753
+ 754
+ 755
+ 756
+ 757
+ 758
+ 759
+ 760
+ 761
+ 762
+ 763
+ 764
+ 765
+ 766
+ 767
+ 768
+ 769
+ 770
+ 771
+ 772
+ 773
+ 774
+ 775
+ 776
+ 777
+ 778
+ 779
+ 780
+ 781
+ 782
+ 783
+ 784
+ 785
+ 786
+ 787
+ 788
+ 789
+ 790
+ 791
+ 792
+ 793
+ 794
+ 795
+ 796
+ 797
+ 798
+ 799
+ 800
+ 801
+ 802
+ 803
+ 804
+ 805
+ 806
+ 807
+ 808
+ 809
+ 810
+ 811
+ 812
+ 813
+ 814
+ 815
+ 816
+ 817
+ 818
+ 819
+ 820
+ 821
+ 822
+ 823
+ 824
+ 825
+ 826
+ 827
+ 828
+ 829
+ 830
+ 831
+ 832
+ 833
+ 834
+ 835
+ 836
+ 837
+ 838
+ 839
+ 840
+ 841
+ 842
+ 843
+ 844
+ 845
+ 846
+ 847
+ 848
+ 849
+ 850
+ 851
+ 852
+ 853
+ 854
+ 855
+ 856
+ 857
+ 858
+ 859
+ 860
+ 861
+ 862
+ 863
+ 864
+ 865
+ 866
+ 867
+ 868
+ 869
+ 870
+ 871
+ 872
+ 873
+ 874
+ 875
+ 876
+ 877
+ 878
+ 879
+ 880
+ 881
+ 882
+ 883
+ 884
+ 885
+ 886
+ 887
+ 888
+ 889
+ 890
+ 891
+ 892
+ 893
+ 894
+ 895
+ 896
+ 897
+ 898
+ 899
+ 900
+ 901
+ 902
+ 903
+ 904
+ 905
+ 906
+ 907
+ 908
+ 909
+ 910
+ 911
+ 912
+ 913
+ 914
+ 915
+ 916
+ 917
+ 918
+ 919
+ 920
+ 921
+ 922
+ 923
+ 924
+ 925
+ 926
+ 927
+ 928
+ 929
+ 930
+ 931
+ 932
+ 933
+ 934
+ 935
+ 936
+ 937
+ 938
+ 939
+ 940
+ 941
+ 942
+ 943
+ 944
+ 945
+ 946
+ 947
+ 948
+ 949
+ 950
+ 951
+ 952
+ 953
+ 954
+ 955
+ 956
+ 957
+ 958
+ 959
+ 960
+ 961
+ 962
+ 963
+ 964
+ 965
+ 966
+ 967
+ 968
+ 969
+ 970
+ 971
+ 972
+ 973
+ 974
+ 975
+ 976
+ 977
+ 978
+ 979
+ 980
+ 981
+ 982
+ 983
+ 984
+ 985
+ 986
+ 987
+ 988
+ 989
+ 990
+ 991
+ 992
+ 993
+ 994
+ 995
+ 996
+ 997
+ 998
+ 999
+1000
+1001
+1002
+1003
+1004
+1005
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Residue, ResidueRef};
+
+/// Possible bond order associated with bonds
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+pub enum BondOrder {
+    /// Unknown or unspecified bond order
+    Unknown = chfl_bond_order::CHFL_BOND_UNKNOWN as isize,
+    /// Single bond
+    Single = chfl_bond_order::CHFL_BOND_SINGLE as isize,
+    /// Double bond
+    Double = chfl_bond_order::CHFL_BOND_DOUBLE as isize,
+    /// Triple bond
+    Triple = chfl_bond_order::CHFL_BOND_TRIPLE as isize,
+    /// Quadruple bond (present in some metals)
+    Quadruple = chfl_bond_order::CHFL_BOND_QUADRUPLE as isize,
+    /// Quintuplet bond (present in some metals)
+    Quintuplet = chfl_bond_order::CHFL_BOND_QUINTUPLET as isize,
+    /// Amide bond (required by some file formats)
+    Amide = chfl_bond_order::CHFL_BOND_AMIDE as isize,
+    /// Aromatic bond (required by some file formats)
+    Aromatic = chfl_bond_order::CHFL_BOND_AROMATIC as isize,
+}
+
+impl BondOrder {
+    pub(crate) fn as_raw(self) -> chfl_bond_order {
+        match self {
+            BondOrder::Unknown => chfl_bond_order::CHFL_BOND_UNKNOWN,
+            BondOrder::Single => chfl_bond_order::CHFL_BOND_SINGLE,
+            BondOrder::Double => chfl_bond_order::CHFL_BOND_DOUBLE,
+            BondOrder::Triple => chfl_bond_order::CHFL_BOND_TRIPLE,
+            BondOrder::Quadruple => chfl_bond_order::CHFL_BOND_QUADRUPLE,
+            BondOrder::Quintuplet => chfl_bond_order::CHFL_BOND_QUINTUPLET,
+            BondOrder::Amide => chfl_bond_order::CHFL_BOND_AMIDE,
+            BondOrder::Aromatic => chfl_bond_order::CHFL_BOND_AROMATIC,
+        }
+    }
+}
+
+impl From<chfl_bond_order> for BondOrder {
+    fn from(order: chfl_bond_order) -> BondOrder {
+        match order {
+            chfl_bond_order::CHFL_BOND_UNKNOWN => BondOrder::Unknown,
+            chfl_bond_order::CHFL_BOND_SINGLE => BondOrder::Single,
+            chfl_bond_order::CHFL_BOND_DOUBLE => BondOrder::Double,
+            chfl_bond_order::CHFL_BOND_TRIPLE => BondOrder::Triple,
+            chfl_bond_order::CHFL_BOND_QUADRUPLE => BondOrder::Quadruple,
+            chfl_bond_order::CHFL_BOND_QUINTUPLET => BondOrder::Quintuplet,
+            chfl_bond_order::CHFL_BOND_AMIDE => BondOrder::Amide,
+            chfl_bond_order::CHFL_BOND_AROMATIC => BondOrder::Aromatic,
+        }
+    }
+}
+
+/// A `Topology` contains the definition of all the atoms in the system, and
+/// the liaisons between the atoms (bonds, angles, dihedrals, ...). It will
+/// also contain all the residues information if it is available.
+pub struct Topology {
+    handle: *mut CHFL_TOPOLOGY,
+}
+
+/// An analog to a reference to a topology (`&Topology`)
+pub struct TopologyRef<'a> {
+    inner: Topology,
+    marker: PhantomData<&'a Topology>
+}
+
+impl<'a> Deref for TopologyRef<'a> {
+    type Target = Topology;
+    fn deref(&self) -> &Topology {
+        &self.inner
+    }
+}
+
+impl Clone for Topology {
+    fn clone(&self) -> Topology {
+        unsafe {
+            let new_handle = chfl_topology_copy(self.as_ptr());
+            Topology::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Topology {
+    /// Create a `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TOPOLOGY) -> Topology {
+        check_not_null(ptr);
+        Topology {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_TOPOLOGY) -> TopologyRef<'a> {
+        TopologyRef {
+            inner: Topology::from_ptr(ptr as *mut CHFL_TOPOLOGY),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Create a new empty topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    /// ```
+    pub fn new() -> Topology {
+        unsafe {
+            Topology::from_ptr(chfl_topology())
+        }
+    }
+
+    /// Get a reference of the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// let atom = topology.atom(4);
+    /// assert_eq!(atom.name(), "");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// assert_eq!(topology.atom(4).name(), "");
+    ///
+    /// topology.atom_mut(4).set_name("Fe");
+    /// assert_eq!(topology.atom(4).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr(), index as u64
+            );
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_topology_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize this topology to hold `natoms` atoms, inserting dummy atoms if
+    /// the new size if bigger than the old one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_topology_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` at the end of this topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Atom};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Mg"));
+    ///
+    /// let atom = topology.atom(0);
+    /// assert_eq!(atom.name(), "Mg");
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom) {
+        unsafe {
+            check_success(chfl_topology_add_atom(self.as_mut_ptr(), atom.as_ptr()));
+        }
+    }
+
+    /// Remove an `Atom` from this topology by `index`. This modify all the
+    /// other atoms indexes.
+    ///
+    /// # Panics
+    ///
+    /// If the `index` is out of bounds
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(9);
+    /// assert_eq!(topology.size(), 9);
+    ///
+    /// topology.remove(7);
+    /// assert_eq!(topology.size(), 8);
+    /// ```
+    pub fn remove(&mut self, index: usize) {
+        unsafe {
+            check_success(chfl_topology_remove(self.as_mut_ptr(), index as u64));
+        }
+    }
+
+    /// Get the number of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds_count(), 3);
+    /// ```
+    pub fn bonds_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_bonds_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.angles_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles_count(), 2);
+    /// ```
+    pub fn angles_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_angles_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.dihedrals_count(), 1);
+    /// ```
+    pub fn dihedrals_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_dihedrals_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    /// assert_eq!(topology.impropers_count(), 1);
+    /// ```
+    pub fn impropers_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_impropers_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the list of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+    /// ```
+    pub fn bonds(&self) -> Vec<[usize; 2]> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![[u64::max_value(); 2]; size];
+        unsafe {
+            check_success(chfl_topology_bonds(self.as_ptr(), bonds.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return bonds
+            .into_iter()
+            .map(|bond| [bond[0] as usize, bond[1] as usize])
+            .collect();
+    }
+
+    /// Get the list of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+    /// ```
+    pub fn angles(&self) -> Vec<[usize; 3]> {
+        let size = self.angles_count();
+        let count = size as u64;
+        let mut angles = vec![[u64::max_value(); 3]; size];
+        unsafe {
+            check_success(chfl_topology_angles(self.as_ptr(), angles.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return angles
+            .into_iter()
+            .map(|angle| [angle[0] as usize, angle[1] as usize, angle[2] as usize])
+            .collect();
+    }
+
+    /// Get the list of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    ///
+    /// assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+    /// ```
+    pub fn dihedrals(&self) -> Vec<[usize; 4]> {
+        let size = self.dihedrals_count();
+        let count = size as u64;
+        let mut dihedrals = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_dihedrals(
+                self.as_ptr(), dihedrals.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return dihedrals
+            .into_iter()
+            .map(|dihedral| {
+                [
+                    dihedral[0] as usize,
+                    dihedral[1] as usize,
+                    dihedral[2] as usize,
+                    dihedral[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Get the list of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    ///
+    /// assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+    /// ```
+    pub fn impropers(&self) -> Vec<[usize; 4]> {
+        let size = self.impropers_count();
+        let count = size as u64;
+        let mut impropers = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_impropers(
+                self.as_ptr(), impropers.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return impropers
+            .into_iter()
+            .map(|improper| {
+                [
+                    improper[0] as usize,
+                    improper[1] as usize,
+                    improper[2] as usize,
+                    improper[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    /// assert_eq!(topology.angles().len(), 1);
+    ///
+    /// topology.clear_bonds();
+    /// assert!(topology.bonds().is_empty());
+    /// assert!(topology.angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_topology_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_topology_bond_with_order(
+                self.as_mut_ptr(), i as u64, j as u64, order.as_raw()
+            ));
+        }
+    }
+
+    /// Get the bond order for the bond between the atoms at indexes `i` and
+    /// `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn bond_order(&self, i: usize, j: usize) -> BondOrder {
+        let mut order = chfl_bond_order::CHFL_BOND_UNKNOWN;
+        unsafe {
+            check_success(chfl_topology_bond_order(
+                self.as_ptr(), i as u64, j as u64, &mut order
+            ));
+        }
+        return order.into()
+    }
+
+    /// Get the bond order for all the bonds in the topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(3);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// topology.add_bond_with_order(0, 2, BondOrder::Single);
+    ///
+    /// assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+    /// ```
+    pub fn bond_orders(&self) -> Vec<BondOrder> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![BondOrder::Unknown; size];
+        unsafe {
+            check_success(chfl_topology_bond_orders(
+                self.as_ptr(),
+                // Casting BondOrder to chfl_bond_order is safe, as they are
+                // both `repr(C)` enums with the same values.
+                bonds.as_mut_ptr().cast(),
+                count
+            ));
+        }
+        return bonds;
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// this topology.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// topology.remove_bond(0, 1);
+    /// assert_eq!(topology.bonds_count(), 1);
+    ///
+    /// // Removing a bond that does not exists is fine
+    /// topology.remove_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 1);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Get a reference to the residue at index `index` from this topology.
+    ///
+    /// The residue index in the topology is not always the same as the residue
+    /// `id`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn residue(&self, index: u64) -> Option<ResidueRef> {
+        unsafe {
+            let handle = chfl_residue_from_topology(self.as_ptr(), index as u64);
+            if handle.is_null() {
+                None
+            } else {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get a copy of the residue containing the atom at index `index` in this
+    /// topology, if any.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.resize(8);
+    ///
+    /// let mut residue = Residue::new("water");
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// topology.add_residue(&residue).unwrap();
+    ///
+    /// let residue = topology.residue_for_atom(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    ///
+    /// assert!(topology.residue_for_atom(6).is_none());
+    /// ```
+    pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef> {
+        let handle = unsafe {
+            chfl_residue_for_atom(self.as_ptr(), index as u64)
+        };
+        if handle.is_null() {
+            None
+        } else {
+            unsafe {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the number of residues in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.residues_count(), 0);
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    /// assert_eq!(topology.residues_count(), 2);
+    /// ```
+    pub fn residues_count(&self) -> u64 {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_residues_count(self.as_ptr(), &mut count));
+        }
+        return count;
+    }
+
+    /// Add a residue to this topology.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue `id` is not already in the topology,
+    /// or if the residue contains atoms that are already in another residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_topology_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Check if the two residues `first` and `second` from the `topology` are
+    /// linked together, *i.e.* if there is a bond between one atom in the
+    /// first residue and one atom in the second one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    ///
+    /// let first = topology.residue(0).unwrap();
+    /// let second = topology.residue(1).unwrap();
+    /// assert_eq!(topology.are_linked(&first, &second), false);
+    /// ```
+    pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool {
+        let mut linked = 0;
+        unsafe {
+            check_success(chfl_topology_residues_linked(
+                self.as_ptr(),
+                first.as_ptr(),
+                second.as_ptr(),
+                &mut linked
+            ));
+        }
+        return linked != 0;
+    }
+}
+
+impl Drop for Topology {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Residue};
+
+    #[test]
+    fn clone() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        let copy = topology.clone();
+        assert_eq!(copy.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+
+        topology.remove(7);
+        assert_eq!(topology.size(), 9);
+
+        topology.add_atom(&Atom::new("Hg"));
+        assert_eq!(topology.size(), 10);
+    }
+
+    #[test]
+    fn atoms() {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(3).name(), "Fe");
+    }
+
+    #[test]
+    fn remove() {
+        let mut topology = Topology::new();
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "W");
+
+        topology.remove(1);
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "Fe");
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove() {
+        let mut topology = Topology::new();
+        topology.resize(18);
+        topology.remove(33);
+    }
+
+
+    #[test]
+    fn bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.bonds_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(9, 2);
+        topology.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(topology.bonds_count(), 3);
+
+        assert_eq!(topology.bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(topology.bond_orders(), expected);
+
+        assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(topology.bond_order(3, 7), BondOrder::Aromatic);
+
+        topology.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        topology.remove_bond(8, 7);
+        assert_eq!(topology.bonds_count(), 2);
+
+        topology.clear_bonds();
+        assert_eq!(topology.bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn angles() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.angles_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 7);
+        topology.add_bond(3, 5);
+        assert_eq!(topology.angles_count(), 2);
+
+        assert_eq!(topology.angles(), vec![[0, 1, 2], [5, 3, 7]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.angles_count(), 0);
+    }
+
+    #[test]
+    fn dihedrals() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.dihedrals_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 2);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(7, 10);
+        assert_eq!(topology.dihedrals_count(), 2);
+
+        assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3], [5, 4, 7, 10]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.dihedrals_count(), 0);
+    }
+
+    #[test]
+    fn impropers() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.impropers_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(0, 2);
+        topology.add_bond(0, 3);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(4, 8);
+        assert_eq!(topology.impropers_count(), 2);
+
+        assert_eq!(topology.impropers(), vec![[1, 0, 2, 3], [5, 4, 7, 8]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.impropers_count(), 0);
+    }
+
+    #[test]
+    fn residues() {
+        let mut topology = Topology::new();
+        topology.resize(4);
+        assert_eq!(topology.residues_count(), 0);
+
+        let mut residue = Residue::new("Foo");
+        residue.add_atom(0);
+        residue.add_atom(2);
+
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 1);
+
+        assert_eq!(topology.residue(0).unwrap().name(), "Foo");
+        {
+            let residue = topology.residue_for_atom(2).unwrap();
+            assert_eq!(residue.name(), "Foo");
+        }
+
+        let mut residue = Residue::new("Bar");
+        residue.add_atom(3);
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 2);
+
+        let first = topology.residue(0).unwrap();
+        let second = topology.residue(0).unwrap();
+        assert!(topology.are_linked(&first, &second));
+
+        // missing residue
+        assert!(topology.residue_for_atom(1).is_none());
+        // out of bounds
+        assert!(topology.residue_for_atom(67).is_none());
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/src/chemfiles/trajectory.rs.html b/0.10.2/src/chemfiles/trajectory.rs.html new file mode 100644 index 000000000..d3be889a2 --- /dev/null +++ b/0.10.2/src/chemfiles/trajectory.rs.html @@ -0,0 +1,1178 @@ +trajectory.rs - source
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::convert::TryInto;
+use std::path::Path;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check, check_success, Error, Status};
+use strings;
+
+use {Frame, Topology, UnitCell};
+
+/// The `Trajectory` type is the main entry point when using chemfiles. A
+/// `Trajectory` behave a bit like a file, allowing to read and/or write
+/// `Frame`.
+pub struct Trajectory {
+    handle: *mut CHFL_TRAJECTORY,
+}
+
+impl Trajectory {
+    /// Create a `Trajectory` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TRAJECTORY) -> Result<Trajectory, Error> {
+        if ptr.is_null() {
+            Err(Error {
+                status: Status::FileError,
+                message: Error::last_error()
+            })
+        } else {
+            Ok(Trajectory {
+                handle: ptr
+            })
+        }
+    }
+
+    /// Get the underlying C pointer as a pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Open the file at the given `path` in the given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// ```
+    pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_open(path.as_ptr(), mode as i8);
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Open the file at the given `path` using a specific file `format` and the
+    /// given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// Specifying a format is needed when the file format does not match the
+    /// extension, or when there is not standard extension for this format. If
+    /// `format` is an empty string, the format will be guessed from the
+    /// extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+    /// ```
+    pub fn open_with_format<'a, P, S>(filename: P, mode: char, format: S) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let filename =
+            filename.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(filename.as_ref()))?;
+
+        let filename = strings::to_c(filename);
+        let format = strings::to_c(format.into());
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_with_format(
+                filename.as_ptr(), mode as i8, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read a memory buffer as though it was a formatted file.
+    ///
+    /// The memory buffer used to store the file is given using the `data`
+    /// argument. The `format` parameter is required and should follow the same
+    /// rules as in the main `Trajectory` constructor.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or if the format do not support in-memory readers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+    /// let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+    /// let mut frame = Frame::new();
+    /// trajectory.read(&mut frame).unwrap();
+    /// assert_eq!(frame.size(), 6);
+    /// ```
+    pub fn memory_reader<'a, S>(data: S, format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let data = strings::to_c(data.into());
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_reader(
+                data.as_ptr(), data.as_bytes().len() as u64, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Write to a memory buffer as though it was a formatted file.
+    ///
+    /// The `format` parameter should follow the same rules as in the main
+    /// `Trajectory` constructor, except that compression specification
+    /// is not supported.
+    ///
+    /// The `memory_buffer` function can be used to retrieve the data written
+    /// to memory of the `Trajectory`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the format do not support in-memory writers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Trajectory;
+    /// let trajectory_memory = Trajectory::memory_writer("SMI");
+    ///
+    /// // Binary formats typically do not support this feature
+    /// assert!(Trajectory::memory_writer("XTC").is_err());
+    /// ```
+    pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_writer(format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read the next step of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of atom
+    /// in the next step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read(&mut frame).unwrap();
+    /// ```
+    pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read(self.as_mut_ptr(), frame.as_mut_ptr()))
+        }
+    }
+
+    /// Read a specific `step` of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of
+    /// atom at this step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read_step(10, &mut frame).unwrap();
+    /// ```
+    pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read_step(self.as_mut_ptr(), step as u64, frame.as_mut_ptr()))
+        }
+    }
+
+    /// Write a `frame` to this trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.write(&mut frame).unwrap();
+    /// ```
+    pub fn write(&mut self, frame: &Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_write(self.as_mut_ptr(), frame.as_ptr()))
+        }
+    }
+
+    /// Set the `topology` associated with this trajectory. This topology will
+    /// be used when reading and writing the files, replacing any topology in
+    /// the frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Atom, Topology};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_atom(&Atom::new("O"));
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    ///
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_topology(&topology);
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) {
+        unsafe {
+            check_success(chfl_trajectory_set_topology(self.as_mut_ptr(), topology.as_ptr()));
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in `format`;
+    /// and extracting the topology of this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_file("topology.pdb").unwrap();
+    /// ```
+    pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), ptr::null()))
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in
+    /// `format`; and extracting the topology of this frame.
+    ///
+    /// If `format` is an empty string, the format will be guessed from the
+    /// `path` extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+    /// ```
+    pub fn set_topology_with_format<'a, P, S>(&mut self, path: P, format: S) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let format = strings::to_c(format.into());
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), format.as_ptr()))
+        }
+    }
+
+    /// Set the unit `cell` associated with a trajectory. This cell will be
+    /// used when reading and writing the files, replacing any unit cell in the
+    /// frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, UnitCell};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_trajectory_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get the number of steps (the number of frames) in a trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// println!("This trajectory contains {} steps", trajectory.nsteps());
+    /// ```
+    // FIXME should this take &self instead? The file can be modified by this
+    // function, but the format should reset the state.
+    pub fn nsteps(&mut self) -> usize {
+        let mut res = 0;
+        unsafe {
+            check(chfl_trajectory_nsteps(self.as_mut_ptr(), &mut res)).expect(
+                "failed to get the number of steps in this trajectory"
+            );
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return res as usize;
+    }
+
+    /// Obtain the memory buffer written to by the trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This fails if the trajectory was not opened with
+    /// `Trajectory::memory_writer`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, BondOrder, Frame, Trajectory};
+    /// let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+    ///
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_bond_with_order(0, 1, BondOrder::Single);
+    ///
+    /// trajectory_memory.write(&frame).unwrap();
+    ///
+    /// let result = trajectory_memory.memory_buffer();
+    /// assert_eq!(result.unwrap(), "CC\n");
+    /// ```
+    #[allow(clippy::cast_possible_truncation)]
+    pub fn memory_buffer(&self) -> Result<&str, Error> {
+            let mut ptr: *const i8 = std::ptr::null();
+            let mut count: u64 = 0;
+            let buffer = unsafe {
+                check(chfl_trajectory_memory_buffer(self.as_ptr(), &mut ptr, &mut count))?;
+                 std::slice::from_raw_parts(
+                    ptr.cast(), count.try_into().expect("failed to convert u64 to usize")
+                )
+            };
+
+            let string = std::str::from_utf8(buffer)?;
+            Ok(string)
+    }
+
+    /// Get file path for this trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// assert_eq!(trajectory.path(), "water.xyz");
+    /// ```
+    pub fn path(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_trajectory_path(self.as_ptr(), ptr, len) };
+        let path = strings::call_autogrow_buffer(1024, get_string).expect("failed to get path string");
+        return strings::from_c(path.as_ptr());
+    }
+}
+
+impl Drop for Trajectory {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_trajectory_close(self.as_ptr());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use std::fs;
+    use std::path::Path;
+    use std::io::Read;
+
+    use approx::assert_ulps_eq;
+
+    use {Atom, CellShape, Frame, Topology, UnitCell};
+
+    #[test]
+    fn read() {
+        let root = Path::new(file!()).parent().unwrap().join("..");
+        let filename = root.join("data").join("water.xyz");
+        let mut file = Trajectory::open(filename.to_str().unwrap(), 'r').unwrap();
+
+        if cfg!(target_family = "unix") {
+            assert_eq!(file.path(), "src/../data/water.xyz");
+        } else if cfg!(target_family = "windows") {
+            assert_eq!(file.path(), "src\\..\\data\\water.xyz");
+        } else {
+            panic!("please add test for this OS!");
+        }
+
+        assert_eq!(file.nsteps(), 100);
+
+        let mut frame = Frame::new();
+        assert!(file.read(&mut frame).is_ok());
+
+        assert_eq!(frame.size(), 297);
+        assert_ulps_eq!(frame.positions()[0][0], 0.417219);
+        assert_ulps_eq!(frame.positions()[0][1], 8.303366);
+        assert_ulps_eq!(frame.positions()[0][2], 11.737172);
+        assert_ulps_eq!(frame.positions()[124][0], 5.099554);
+        assert_ulps_eq!(frame.positions()[124][1], -0.045104);
+        assert_ulps_eq!(frame.positions()[124][2], 14.153846);
+
+        assert_eq!(frame.atom(0).name(), "O");
+
+        file.set_cell(&UnitCell::new([30.0, 30.0, 30.0]));
+        assert!(file.read_step(41, &mut frame).is_ok());
+        let cell = frame.cell().clone();
+        assert_eq!(cell.lengths(), [30.0, 30.0, 30.0]);
+
+
+        assert_ulps_eq!(frame.positions()[0][0], 0.761277);
+        assert_ulps_eq!(frame.positions()[0][1], 8.106125);
+        assert_ulps_eq!(frame.positions()[0][2], 10.622949);
+        assert_ulps_eq!(frame.positions()[124][0], 5.13242);
+        assert_ulps_eq!(frame.positions()[124][1], 0.079862);
+        assert_ulps_eq!(frame.positions()[124][2], 14.194161);
+
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 0);
+        }
+
+        assert!(frame.guess_bonds().is_ok());
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 180);
+            assert_eq!(topology.angles_count(), 84);
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("Cs");
+        for _ in 0..297 {
+            topology.add_atom(&atom);
+        }
+
+        file.set_topology(&topology);
+        assert!(file.read_step(10, &mut frame).is_ok());
+        assert_eq!(frame.atom(42).name(), "Cs");
+
+        let filename = root.join("data").join("topology.xyz");
+        assert!(file.set_topology_file(filename.to_str().unwrap()).is_ok());
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.atom(100).name(), "Rd");
+
+        let filename = root.join("data").join("helium.xyz.but.not.really");
+        let filename = filename.to_str().unwrap();
+        let mut file = Trajectory::open_with_format(filename, 'r', "XYZ").unwrap();
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.size(), 125);
+    }
+
+    fn write_file(path: &str) {
+        let mut file = Trajectory::open(path, 'w').unwrap();
+        let mut frame = Frame::new();
+        frame.resize(4);
+
+        for position in frame.positions_mut() {
+            *position = [1.0, 2.0, 3.0];
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("X");
+        for _ in 0..4 {
+            topology.add_atom(&atom);
+        }
+        frame.set_topology(&topology).unwrap();
+        assert!(file.write(&frame).is_ok());
+    }
+
+    #[test]
+    fn write() {
+        let filename = "test-tmp.xyz";
+        write_file(filename);
+
+        let expected_content = "4
+Properties=species:S:1:pos:R:3
+X 1 2 3
+X 1 2 3
+X 1 2 3
+X 1 2 3".lines().collect::<Vec<_>>();
+
+        let mut file = fs::File::open(filename).unwrap();
+        let mut content = String::new();
+        let _ = file.read_to_string(&mut content).unwrap();
+
+        assert_eq!(expected_content, content.lines().collect::<Vec<_>>());
+        fs::remove_file(filename).unwrap();
+    }
+
+    #[test]
+    fn memory() {
+        // formats in decreasing order of their memory buffer length to check null termination
+        for format in &["CSSR", "GRO", "XYZ"] {
+            let mut frame_write = Frame::new();
+            frame_write.add_atom(&Atom::new("H"), [1.5, 3.0, -10.0], None);
+            frame_write.add_atom(&Atom::new("O"), [2.3, -1.4, 50.0], None);
+            frame_write.add_atom(&Atom::new("H"), [-1.5, 10.0, 0.0], None);
+            let cell = UnitCell::new([10.0, 11.0, 12.5]);
+
+            let mut trajectory_write = Trajectory::memory_writer(*format).unwrap();
+            trajectory_write.set_cell(&cell);
+            trajectory_write.write(&frame_write).unwrap();
+
+            let buffer = trajectory_write.memory_buffer().unwrap();
+            let mut trajectory_read = Trajectory::memory_reader(buffer, *format).unwrap();
+            let mut frame_read = Frame::new();
+            trajectory_read.read(&mut frame_read).unwrap();
+
+            assert_eq!(trajectory_read.nsteps(), 1);
+            assert_eq!(frame_read.cell().shape(), CellShape::Orthorhombic);
+            assert_eq!(frame_read.size(), 3);
+            assert_eq!(frame_read.atom(1).name(), "O");
+            crate::assert_vector3d_eq(&frame_read.positions()[2], &[-1.5, 10.0, 0.0], 1e-4);
+        }
+    }
+}
+
+
+ + \ No newline at end of file diff --git a/0.10.2/storage.js b/0.10.2/storage.js new file mode 100644 index 000000000..6b16cbd83 --- /dev/null +++ b/0.10.2/storage.js @@ -0,0 +1 @@ +var resourcesSuffix="";var darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");window.mainTheme=document.getElementById("mainThemeStyle");var settingsDataset=(function(){var settingsElement=document.getElementById("default-settings");if(settingsElement===null){return null}var dataset=settingsElement.dataset;if(dataset===undefined){return null}return dataset})();function getSettingValue(settingName){var current=getCurrentValue('rustdoc-'+settingName);if(current!==null){return current}if(settingsDataset!==null){var def=settingsDataset[settingName.replace(/-/g,'_')];if(def!==undefined){return def}}return null}var localStoredTheme=getSettingValue("theme");var savedHref=[];function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(!elem||!elem.classList){return}elem.classList.add(className)}function removeClass(elem,className){if(!elem||!elem.classList){return}elem.classList.remove(className)}function onEach(arr,func,reversed){if(arr&&arr.length>0&&func){var length=arr.length;var i;if(reversed){for(i=length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(i=0;i=0){updateLocalStorage("rustdoc-preferred-dark-theme",localStoredTheme)}updateSystemTheme()}else{switchTheme(window.currentTheme,window.mainTheme,getSettingValue("theme")||"light",false)} \ No newline at end of file diff --git a/0.10.2/toggle-minus.svg b/0.10.2/toggle-minus.svg new file mode 100644 index 000000000..73154788a --- /dev/null +++ b/0.10.2/toggle-minus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/toggle-plus.svg b/0.10.2/toggle-plus.svg new file mode 100644 index 000000000..08b17033e --- /dev/null +++ b/0.10.2/toggle-plus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.2/wheel.svg b/0.10.2/wheel.svg new file mode 100644 index 000000000..01da3b24c --- /dev/null +++ b/0.10.2/wheel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.3/.lock b/0.10.3/.lock new file mode 100755 index 000000000..e69de29bb diff --git a/0.10.3/COPYRIGHT.txt b/0.10.3/COPYRIGHT.txt new file mode 100644 index 000000000..34e48134c --- /dev/null +++ b/0.10.3/COPYRIGHT.txt @@ -0,0 +1,46 @@ +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. diff --git a/0.10.3/FiraSans-LICENSE.txt b/0.10.3/FiraSans-LICENSE.txt new file mode 100644 index 000000000..ff9afab06 --- /dev/null +++ b/0.10.3/FiraSans-LICENSE.txt @@ -0,0 +1,94 @@ +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.3/FiraSans-Medium.woff2 b/0.10.3/FiraSans-Medium.woff2 new file mode 100644 index 000000000..7a1e5fc54 Binary files /dev/null and b/0.10.3/FiraSans-Medium.woff2 differ diff --git a/0.10.3/FiraSans-Regular.woff2 b/0.10.3/FiraSans-Regular.woff2 new file mode 100644 index 000000000..e766e06cc Binary files /dev/null and b/0.10.3/FiraSans-Regular.woff2 differ diff --git a/0.10.3/LICENSE-APACHE.txt b/0.10.3/LICENSE-APACHE.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/0.10.3/LICENSE-APACHE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/0.10.3/LICENSE-MIT.txt b/0.10.3/LICENSE-MIT.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/0.10.3/LICENSE-MIT.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/0.10.3/NanumBarunGothic-LICENSE.txt b/0.10.3/NanumBarunGothic-LICENSE.txt new file mode 100644 index 000000000..0bf46682b --- /dev/null +++ b/0.10.3/NanumBarunGothic-LICENSE.txt @@ -0,0 +1,99 @@ +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.3/NanumBarunGothic.ttf.woff2 b/0.10.3/NanumBarunGothic.ttf.woff2 new file mode 100644 index 000000000..1866ad4bc Binary files /dev/null and b/0.10.3/NanumBarunGothic.ttf.woff2 differ diff --git a/0.10.3/SourceCodePro-It.ttf.woff2 b/0.10.3/SourceCodePro-It.ttf.woff2 new file mode 100644 index 000000000..462c34efc Binary files /dev/null and b/0.10.3/SourceCodePro-It.ttf.woff2 differ diff --git a/0.10.3/SourceCodePro-LICENSE.txt b/0.10.3/SourceCodePro-LICENSE.txt new file mode 100644 index 000000000..07542572e --- /dev/null +++ b/0.10.3/SourceCodePro-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.3/SourceCodePro-Regular.ttf.woff2 b/0.10.3/SourceCodePro-Regular.ttf.woff2 new file mode 100644 index 000000000..10b558e0b Binary files /dev/null and b/0.10.3/SourceCodePro-Regular.ttf.woff2 differ diff --git a/0.10.3/SourceCodePro-Semibold.ttf.woff2 b/0.10.3/SourceCodePro-Semibold.ttf.woff2 new file mode 100644 index 000000000..5ec64eef0 Binary files /dev/null and b/0.10.3/SourceCodePro-Semibold.ttf.woff2 differ diff --git a/0.10.3/SourceSerif4-Bold.ttf.woff2 b/0.10.3/SourceSerif4-Bold.ttf.woff2 new file mode 100644 index 000000000..db57d2145 Binary files /dev/null and b/0.10.3/SourceSerif4-Bold.ttf.woff2 differ diff --git a/0.10.3/SourceSerif4-It.ttf.woff2 b/0.10.3/SourceSerif4-It.ttf.woff2 new file mode 100644 index 000000000..1cbc021a3 Binary files /dev/null and b/0.10.3/SourceSerif4-It.ttf.woff2 differ diff --git a/0.10.3/SourceSerif4-LICENSE.md b/0.10.3/SourceSerif4-LICENSE.md new file mode 100644 index 000000000..68ea18924 --- /dev/null +++ b/0.10.3/SourceSerif4-LICENSE.md @@ -0,0 +1,93 @@ +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.3/SourceSerif4-Regular.ttf.woff2 b/0.10.3/SourceSerif4-Regular.ttf.woff2 new file mode 100644 index 000000000..2db73fe2b Binary files /dev/null and b/0.10.3/SourceSerif4-Regular.ttf.woff2 differ diff --git a/0.10.3/ayu.css b/0.10.3/ayu.css new file mode 100644 index 000000000..a9c9be0d3 --- /dev/null +++ b/0.10.3/ayu.css @@ -0,0 +1 @@ + body,#settings-menu #settings,#settings-menu #settings::before{background-color:#0f1419;color:#c5c5c5;}.setting-line .radio-line input{border-color:#c5c5c5;}.setting-line .radio-line input:checked{box-shadow:inset 0 0 0 3px #0f1419;background-color:#ffb454;}.setting-line .radio-line input:focus{box-shadow:0 0 1px 1px #ffb454;}.setting-line .radio-line input:checked:focus{box-shadow:inset 0 0 0 3px 0f1419,0 0 2px 2px #ffb454;}.setting-line .radio-line input:hover{border-color:#ffb454 !important;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:checked+.slider{background-color:#ffb454;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}h1,h2,h3,h4{color:white;}h1.fqn{border-bottom-color:#5c6773;}h1.fqn a{color:#fff;}h2,h3,h4{border-bottom-color:#5c6773;}h4{border:none;}.in-band{background-color:#0f1419;}.invisible{background:rgba(0,0,0,0);}.docblock code{color:#ffb454;}.code-header{color:#e6e1cf;}.docblock pre>code,pre>code{color:#e6e1cf;}span code{color:#e6e1cf;}.docblock a>code{color:#39AFD7 !important;}.docblock code,.docblock-short code{background-color:#191f26;}pre,.rustdoc.source .example-wrap{color:#e6e1cf;background-color:#191f26;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:#14191f;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);}*{scrollbar-color:#5c6773 #24292f;}.sidebar{scrollbar-color:#5c6773 #24292f;}::-webkit-scrollbar-track{background-color:transparent;}::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar::-webkit-scrollbar-track{background-color:transparent;}.sidebar::-webkit-scrollbar-thumb{background-color:#5c6773;}.sidebar .current,.sidebar a:hover{background-color:transparent;color:#ffb44c;}.source .sidebar{background-color:#14191f;}.sidebar-elems .location{color:#ff7733;}.line-numbers span{color:#5c6773;}.line-numbers .line-highlighted{color:#708090;background-color:rgba(255,236,164,0.06);padding-right:4px;border-right:1px solid #ffb44c;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:#5c6773;}.docblock table td,.docblock table th{border-color:#5c6773;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#c5c5c5;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#000 !important;background-color:#c6afb3;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.content .item-info::before{color:#ccc;}.content span.foreigntype,.content a.foreigntype{color:#ffa0a5;}.content span.union,.content a.union{color:#ffa0a5;}.content span.constant,.content a.constant,.content span.static,.content a.static{color:#39AFD7;}.content span.primitive,.content a.primitive{color:#ffa0a5;}.content span.traitalias,.content a.traitalias{color:#39AFD7;}.content span.keyword,.content a.keyword{color:#39AFD7;}.content span.externcrate,.content span.mod,.content a.mod{color:#39AFD7;}.content span.struct,.content a.struct{color:#ffa0a5;}.content span.enum,.content a.enum{color:#ffa0a5;}.content span.trait,.content a.trait{color:#39AFD7;}.content span.type,.content a.type{color:#39AFD7;}.content span.type,.content a.type,.block a.current.type{color:#39AFD7;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#39AFD7;}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod,.content .fnname{color:#fdd687;}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:#a37acc;}.sidebar a{color:#53b1db;}.sidebar a.current.type{color:#53b1db;}.sidebar a.current.associatedtype{color:#53b1db;}pre.rust .comment{color:#788797;}pre.rust .doccomment{color:#a1ac88;}nav.main .current{border-top-color:#5c6773;border-bottom-color:#5c6773;}nav.main .separator{border:1px solid #5c6773;}a{color:#39AFD7;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a{color:#c5c5c5;}.sidebar h2 a,.sidebar h3 a{color:white;}.search-results a{color:#0096cf;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search,.search-input{background-color:#141920;border-color:#424c57 !important;}.search-input{color:#ffffff;}.module-item .stab,.import-item .stab{color:#000;}.stab.empty-impl{}.stab.unstable,.stab.deprecated,.stab.portability,.stab.empty-impl{color:#c5c5c5;background:#314559 !important;border-style:none !important;border-radius:4px;padding:3px 6px 3px 6px;}.stab.portability>code{color:#e6e1cf;background:none;}#help>div{background:#14191f;box-shadow:0px 6px 20px 0px black;border:none;border-radius:4px;}#help span.bottom,#help span.top{border-color:#5c6773;}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}.line-numbers :target{background-color:transparent;}pre.rust .number,pre.rust .string{color:#b8cc52;}pre.rust .kw,pre.rust .kw-2,pre.rust .prelude-ty,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .op,pre.rust .lifetime{color:#ff7733;}pre.rust .macro,pre.rust .macro-nonterminal{color:#a37acc;}pre.rust .question-mark{color:#ff9011;}pre.rust .self{color:#36a3d9;font-style:italic;}pre.rust .attribute{color:#e6e1cf;}pre.rust .attribute .ident,pre.rust .attribute .op{color:#e6e1cf;}.example-wrap>pre.line-number{color:#5c67736e;border:none;}a.test-arrow{font-size:100%;color:#788797;border-radius:4px;background-color:rgba(57,175,215,0.09);}a.test-arrow:hover{background-color:rgba(57,175,215,0.368);color:#c5c5c5;}.toggle-label,.code-attribute{color:#999;}:target{background:rgba(255,236,164,0.06);border-right:3px solid rgba(255,180,76,0.85);}pre.compile_fail{border-left:2px solid rgba(255,0,0,.4);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.4);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#39AFD7;}.tooltip::after{background-color:#314559;color:#c5c5c5;border:1px solid #5c6773;}.tooltip::before{border-color:transparent #314559 transparent transparent;}.notable-traits-tooltiptext{background-color:#314559;border-color:#5c6773;}.notable-traits-tooltiptext .notable{border-bottom-color:#5c6773;}#titles>button.selected{background-color:#141920 !important;border-bottom:1px solid #ffb44c !important;border-top:none;}#titles>button:not(.selected){background-color:transparent !important;border:none;}#titles>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#titles>button>div.count{color:#888;}.search-input:focus{}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{}.content span.struct,.content a.struct,.block a.current.struct{}#titles>button:hover,#titles>button.selected{}.content span.typedef,.content a.typedef,.block a.current.typedef{}.content span.union,.content a.union,.block a.current.union{}pre.rust .lifetime{}.stab.unstable{}h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod){}.content span.enum,.content a.enum,.block a.current.enum{}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{}.content span.keyword,.content a.keyword,.block a.current.keyword{}pre.rust .comment{}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{}pre.rust .kw{}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{}pre.rust .doccomment{}.stab.deprecated{}.content a.attr,.content a.derive,.content a.macro{}.stab.portability{}.content span.primitive,.content a.primitive,.block a.current.primitive{}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{}pre.rust .kw-2,pre.rust .prelude-ty{}.content span.trait,.content a.trait,.block a.current.trait{}.search-results a:focus span{}a.result-trait:focus{}a.result-traitalias:focus{}a.result-mod:focus,a.result-externcrate:focus{}a.result-mod:focus{}a.result-externcrate:focus{}a.result-enum:focus{}a.result-struct:focus{}a.result-union:focus{}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{}a.result-type:focus{}a.result-associatedtype:focus{}a.result-foreigntype:focus{}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{}a.result-constant:focus,a.result-static:focus{}a.result-primitive:focus{}a.result-keyword:focus{}.sidebar a.current.enum{}.sidebar a.current.struct{}.sidebar a.current.foreigntype{}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{}.sidebar a.current.union{}.sidebar a.current.constant .sidebar a.current.static{}.sidebar a.current.primitive{}.sidebar a.current.externcrate .sidebar a.current.mod{}.sidebar a.current.trait{}.sidebar a.current.traitalias{}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{}.sidebar a.current.keyword{}@media (max-width:700px){.sidebar-menu{background-color:#14191f;border-bottom-color:#5c6773;border-right-color:#5c6773;}.sidebar-elems{background-color:#14191f;border-right-color:#5c6773;}#sidebar-filler{background-color:#14191f;border-bottom-color:#5c6773;}}kbd{color:#c5c5c5;background-color:#314559;border-color:#5c6773;border-bottom-color:#5c6773;box-shadow:inset 0 -1px 0 #5c6773;}#settings-menu>a,#help-button{border-color:#5c6773;background-color:#0f1419;color:#fff;}#settings-menu>a img{filter:invert(100);}#settings-menu #settings,#settings-menu #settings::before{border-color:#5c6773;}#copy-path{color:#fff;}#copy-path>img{filter:invert(70%);}#copy-path:hover>img{filter:invert(100%);}#settings-menu>a:hover,#settings-menu>a:focus,#help-button:hover,#help-button:focus{border-color:#e0e0e0;}#theme-choices{border-color:#5c6773;background-color:#0f1419;}#theme-choices>button:not(:first-child){border-top-color:#5c6773;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:rgba(110,110,110,0.33);}.search-results .result-name span.alias{color:#c5c5c5;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#14191f;}#sidebar-toggle:hover{background-color:rgba(70,70,70,0.33);}#source-sidebar{background-color:#14191f;}#source-sidebar>.title{color:#fff;border-bottom-color:#5c6773;}div.files>a:hover,div.name:hover{background-color:#14191f;color:#ffb44c;}div.files>.selected{background-color:#14191f;color:#ffb44c;}.scraped-example-list .scrape-help{border-color:#aaa;color:#eee;}.scraped-example-list .scrape-help:hover{border-color:white;color:white;}.more-examples-toggle summary,.more-examples-toggle .hide-more{color:#999;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(15,20,25,1),rgba(15,20,25,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(15,20,25,1),rgba(15,20,25,0));}.toggle-line-inner{background:#999;}.toggle-line:hover .toggle-line-inner{background:#c5c5c5;} \ No newline at end of file diff --git a/0.10.3/chemfiles/all.html b/0.10.3/chemfiles/all.html new file mode 100644 index 000000000..a81448416 --- /dev/null +++ b/0.10.3/chemfiles/all.html @@ -0,0 +1,8 @@ +List of all items in this crate +
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/atom/struct.Atom.html b/0.10.3/chemfiles/atom/struct.Atom.html new file mode 100644 index 000000000..591fac7c9 --- /dev/null +++ b/0.10.3/chemfiles/atom/struct.Atom.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Atom.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/atom/struct.AtomMut.html b/0.10.3/chemfiles/atom/struct.AtomMut.html new file mode 100644 index 000000000..2843d6f36 --- /dev/null +++ b/0.10.3/chemfiles/atom/struct.AtomMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomMut.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/atom/struct.AtomRef.html b/0.10.3/chemfiles/atom/struct.AtomRef.html new file mode 100644 index 000000000..fc21ff8b9 --- /dev/null +++ b/0.10.3/chemfiles/atom/struct.AtomRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomRef.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/cell/enum.CellShape.html b/0.10.3/chemfiles/cell/enum.CellShape.html new file mode 100644 index 000000000..9d3d95dbc --- /dev/null +++ b/0.10.3/chemfiles/cell/enum.CellShape.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.CellShape.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/cell/struct.UnitCell.html b/0.10.3/chemfiles/cell/struct.UnitCell.html new file mode 100644 index 000000000..c199c7635 --- /dev/null +++ b/0.10.3/chemfiles/cell/struct.UnitCell.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCell.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/cell/struct.UnitCellMut.html b/0.10.3/chemfiles/cell/struct.UnitCellMut.html new file mode 100644 index 000000000..a07e76605 --- /dev/null +++ b/0.10.3/chemfiles/cell/struct.UnitCellMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellMut.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/cell/struct.UnitCellRef.html b/0.10.3/chemfiles/cell/struct.UnitCellRef.html new file mode 100644 index 000000000..7455c76ac --- /dev/null +++ b/0.10.3/chemfiles/cell/struct.UnitCellRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellRef.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/enum.BondOrder.html b/0.10.3/chemfiles/enum.BondOrder.html new file mode 100644 index 000000000..afa60b69a --- /dev/null +++ b/0.10.3/chemfiles/enum.BondOrder.html @@ -0,0 +1,61 @@ +BondOrder in chemfiles - Rust +
#[repr(C)]
+#[non_exhaustive]
+pub enum BondOrder {
+    Unknown,
+    Single,
+    Double,
+    Triple,
+    Quadruple,
+    Quintuplet,
+    Amide,
+    Aromatic,
+}
Expand description

Possible bond order associated with bonds

+

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Unknown

Unknown or unspecified bond order

+

Single

Single bond

+

Double

Double bond

+

Triple

Triple bond

+

Quadruple

Quadruple bond (present in some metals)

+

Quintuplet

Quintuplet bond (present in some metals)

+

Amide

Amide bond (required by some file formats)

+

Aromatic

Aromatic bond (required by some file formats)

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Converts to this type from the input type.

+

This method returns an Ordering between self and other. Read more

+

Compares and returns the maximum of two values. Read more

+

Compares and returns the minimum of two values. Read more

+

Restrict a value to a certain interval. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

This method tests less than (for self and other) and is used by the < operator. Read more

+

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more

+

This method tests greater than (for self and other) and is used by the > operator. Read more

+

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/enum.CellShape.html b/0.10.3/chemfiles/enum.CellShape.html new file mode 100644 index 000000000..4555d4aa0 --- /dev/null +++ b/0.10.3/chemfiles/enum.CellShape.html @@ -0,0 +1,39 @@ +CellShape in chemfiles - Rust +
pub enum CellShape {
+    Orthorhombic,
+    Triclinic,
+    Infinite,
+}
Expand description

Available unit cell shapes.

+

Variants

Orthorhombic

Orthorhombic cell, with the three angles equals to 90°.

+

Triclinic

Triclinic cell, with any values for the angles.

+

Infinite

Infinite cell, to use when there is no cell.

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/enum.Property.html b/0.10.3/chemfiles/enum.Property.html new file mode 100644 index 000000000..b5be2473c --- /dev/null +++ b/0.10.3/chemfiles/enum.Property.html @@ -0,0 +1,52 @@ +Property in chemfiles - Rust +
pub enum Property {
+    Bool(bool),
+    Double(f64),
+    String(String),
+    Vector3D([f64; 3]),
+}
Expand description

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

Variants

Bool(bool)

Boolean property

+

Double(f64)

Floating point property

+

String(String)

String property

+

Vector3D([f64; 3])

3-dimensional vector property

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

This method returns an ordering between self and other values if one exists. Read more

+

This method tests less than (for self and other) and is used by the < operator. Read more

+

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more

+

This method tests greater than (for self and other) and is used by the > operator. Read more

+

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/enum.Status.html b/0.10.3/chemfiles/enum.Status.html new file mode 100644 index 000000000..aed6f187d --- /dev/null +++ b/0.10.3/chemfiles/enum.Status.html @@ -0,0 +1,55 @@ +Status in chemfiles - Rust +
#[repr(C)]
+#[non_exhaustive]
+pub enum Status {
+    Success,
+    MemoryError,
+    FileError,
+    FormatError,
+    SelectionError,
+    ConfigurationError,
+    OutOfBounds,
+    PropertyError,
+    ChemfilesError,
+    StdCppError,
+    UTF8PathError,
+}
Expand description

Possible causes of error in chemfiles

+

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Success

No error

+

MemoryError

Error in memory allocations

+

FileError

Error while reading or writing a file

+

FormatError

Error in file formatting, i.e. the file is invalid

+

SelectionError

Error in selection string syntax

+

ConfigurationError

Error in configuration files syntax

+

OutOfBounds

Error for out of bounds indexing

+

PropertyError

Error related to properties

+

ChemfilesError

Exception in the C++ chemfiles library

+

StdCppError

Exception in the C++ standard library

+

UTF8PathError

The given path is not valid UTF8

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/errors/enum.Status.html b/0.10.3/chemfiles/errors/enum.Status.html new file mode 100644 index 000000000..6aa83fd28 --- /dev/null +++ b/0.10.3/chemfiles/errors/enum.Status.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Status.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/errors/fn.set_warning_callback.html b/0.10.3/chemfiles/errors/fn.set_warning_callback.html new file mode 100644 index 000000000..97bc2a1ba --- /dev/null +++ b/0.10.3/chemfiles/errors/fn.set_warning_callback.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.set_warning_callback.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/errors/struct.Error.html b/0.10.3/chemfiles/errors/struct.Error.html new file mode 100644 index 000000000..34339c749 --- /dev/null +++ b/0.10.3/chemfiles/errors/struct.Error.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Error.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/fn.add_configuration.html b/0.10.3/chemfiles/fn.add_configuration.html new file mode 100644 index 000000000..069ed3473 --- /dev/null +++ b/0.10.3/chemfiles/fn.add_configuration.html @@ -0,0 +1,20 @@ +add_configuration in chemfiles - Rust +
pub fn add_configuration<S>(path: S) -> Result<(), Error> where
    S: AsRef<str>, 
Expand description

Read configuration data from the file at path.

+

By default, chemfiles reads configuration from any file named +.chemfiles.toml in the current directory or any parent directory. This +function can be used to add data from another configuration file. Data from +the new configuration file will overwrite any existing data.

+

Errors

+

This function will fail if there is no file at path, or if the file is +incorrectly formatted.

+

Example

+
chemfiles::add_configuration("local-config.toml").unwrap();
+// from now on, the data from "local-config.toml" will be used
+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/fn.formats_list.html b/0.10.3/chemfiles/fn.formats_list.html new file mode 100644 index 000000000..b6ac6c7a2 --- /dev/null +++ b/0.10.3/chemfiles/fn.formats_list.html @@ -0,0 +1,20 @@ +formats_list in chemfiles - Rust +
pub fn formats_list() -> Vec<FormatMetadata>
Expand description

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Example

+
let formats = chemfiles::formats_list();
+println!("chemfiles supports {} formats:", formats.len());
+for format in &formats {
+    println!(
+        "   {:<15} {}",
+        format.name,
+        format.extension.as_deref().unwrap_or("")
+    );
+}
+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/fn.guess_format.html b/0.10.3/chemfiles/fn.guess_format.html new file mode 100644 index 000000000..b08619d37 --- /dev/null +++ b/0.10.3/chemfiles/fn.guess_format.html @@ -0,0 +1,26 @@ +guess_format in chemfiles - Rust +
pub fn guess_format(path: &str) -> String
Expand description

Get the format that chemfiles would use to read a file at the given +path.

+

The format is mostly guessed from the path extension, chemfiles only tries +to read the file to distinguish between CIF and mmCIF files. Opening the +file using the returned format string might still fail. For example, it will +fail if the file is not actually formatted according to the guessed format; +or the format/compression combination is not supported (e.g. XTC / GZ will +not work since the XTC reader does not support compressed files).

+

The returned format is represented in a way compatible with the various +Trajectory constructors, i.e. "<format name> [/ <compression>]", where +compression is optional.

+

Examples

+
let format = chemfiles::guess_format("trajectory.xyz.xz");
+assert_eq!(format, "XYZ / XZ");
+
+let format = chemfiles::guess_format("trajectory.nc");
+assert_eq!(format, "Amber NetCDF");
+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/fn.set_warning_callback.html b/0.10.3/chemfiles/fn.set_warning_callback.html new file mode 100644 index 000000000..007e630ae --- /dev/null +++ b/0.10.3/chemfiles/fn.set_warning_callback.html @@ -0,0 +1,11 @@ +set_warning_callback in chemfiles - Rust +
pub fn set_warning_callback<F>(callback: F) where
    F: WarningCallback + 'static, 
Expand description

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/fn.version.html b/0.10.3/chemfiles/fn.version.html new file mode 100644 index 000000000..941ae834d --- /dev/null +++ b/0.10.3/chemfiles/fn.version.html @@ -0,0 +1,13 @@ +version in chemfiles - Rust +
+

Function chemfiles::version

source · []
pub fn version() -> String
Expand description

Get the version of the chemfiles library.

+

Example

+
let version = chemfiles::version();
+assert!(version.starts_with("0.10"));
+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/frame/struct.Frame.html b/0.10.3/chemfiles/frame/struct.Frame.html new file mode 100644 index 000000000..32b972752 --- /dev/null +++ b/0.10.3/chemfiles/frame/struct.Frame.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Frame.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/index.html b/0.10.3/chemfiles/index.html new file mode 100644 index 000000000..d3622c468 --- /dev/null +++ b/0.10.3/chemfiles/index.html @@ -0,0 +1,69 @@ +chemfiles - Rust +
Expand description

Chemfiles is a multi-language library written in modern C++ for reading and +writing from and to molecular trajectory files. These files are created by +your favorite theoretical chemistry program, and contains information about +atomic or residues names and positions. Some format also have additional +information, such as velocities, forces, energy, …

+

This crate expose the C API of chemfiles to Rust, and make all the +functionalities accessible. For more information on the C++ library, +please see its documentation. Specifically, the following pages +are worth reading:

+ +

Structs

+

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+

An analog to a mutable reference to an atom (&mut Atom)

+

An analog to a reference to an atom (&Atom)

+

Error type for Chemfiles.

+

FormatMetadata contains metadata associated with one format.

+

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

An iterator over the properties in an atom/frame/residue

+

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

An analog to a reference to a residue (&Residue)

+

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

An analog to a reference to a topology (&Topology)

+

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

An UnitCell represent the box containing the atoms, and its periodicity.

+

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

An analog to a reference to an unit cell (&UnitCell)

+

Enums

+

Possible bond order associated with bonds

+

Available unit cell shapes.

+

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

Possible causes of error in chemfiles

+

Functions

+

Read configuration data from the file at path.

+

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Get the format that chemfiles would use to read a file at the given +path.

+

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+

Get the version of the chemfiles library.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/misc/fn.formats_list.html b/0.10.3/chemfiles/misc/fn.formats_list.html new file mode 100644 index 000000000..481646355 --- /dev/null +++ b/0.10.3/chemfiles/misc/fn.formats_list.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.formats_list.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/misc/fn.guess_format.html b/0.10.3/chemfiles/misc/fn.guess_format.html new file mode 100644 index 000000000..681a66ce5 --- /dev/null +++ b/0.10.3/chemfiles/misc/fn.guess_format.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.guess_format.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/misc/struct.FormatMetadata.html b/0.10.3/chemfiles/misc/struct.FormatMetadata.html new file mode 100644 index 000000000..10fda814b --- /dev/null +++ b/0.10.3/chemfiles/misc/struct.FormatMetadata.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.FormatMetadata.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/property/enum.Property.html b/0.10.3/chemfiles/property/enum.Property.html new file mode 100644 index 000000000..87bfc97da --- /dev/null +++ b/0.10.3/chemfiles/property/enum.Property.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Property.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/property/struct.PropertiesIter.html b/0.10.3/chemfiles/property/struct.PropertiesIter.html new file mode 100644 index 000000000..2faef8a54 --- /dev/null +++ b/0.10.3/chemfiles/property/struct.PropertiesIter.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.PropertiesIter.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/residue/struct.Residue.html b/0.10.3/chemfiles/residue/struct.Residue.html new file mode 100644 index 000000000..e8f25ad8a --- /dev/null +++ b/0.10.3/chemfiles/residue/struct.Residue.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Residue.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/residue/struct.ResidueRef.html b/0.10.3/chemfiles/residue/struct.ResidueRef.html new file mode 100644 index 000000000..9d26d5daa --- /dev/null +++ b/0.10.3/chemfiles/residue/struct.ResidueRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.ResidueRef.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/selection/struct.Match.html b/0.10.3/chemfiles/selection/struct.Match.html new file mode 100644 index 000000000..3c7b0b709 --- /dev/null +++ b/0.10.3/chemfiles/selection/struct.Match.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Match.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/selection/struct.Selection.html b/0.10.3/chemfiles/selection/struct.Selection.html new file mode 100644 index 000000000..8ed2b5d77 --- /dev/null +++ b/0.10.3/chemfiles/selection/struct.Selection.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Selection.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/sidebar-items.js b/0.10.3/chemfiles/sidebar-items.js new file mode 100644 index 000000000..341178b5a --- /dev/null +++ b/0.10.3/chemfiles/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":[["BondOrder","Possible bond order associated with bonds"],["CellShape","Available unit cell shapes."],["Property","A `Property` is a piece of data that can be associated with an `Atom` or a `Frame`."],["Status","Possible causes of error in chemfiles"]],"fn":[["add_configuration","Read configuration data from the file at `path`."],["formats_list","Get the list of formats known by chemfiles, as well as all associated metadata."],["guess_format","Get the format that chemfiles would use to read a file at the given `path`."],["set_warning_callback","Use `callback` for every chemfiles warning. The callback will be passed the warning message. This will drop any previous warning callback."],["version","Get the version of the chemfiles library."]],"struct":[["Atom","An `Atom` is a particle in the current `Frame`. It stores the following atomic properties:"],["AtomMut","An analog to a mutable reference to an atom (`&mut Atom`)"],["AtomRef","An analog to a reference to an atom (`&Atom`)"],["Error","Error type for Chemfiles."],["FormatMetadata","`FormatMetadata` contains metadata associated with one format."],["Frame","A `Frame` contains data from one simulation step: the current unit cell, the topology, the positions, and the velocities of the particles in the system. If some information is missing (topology or velocity or unit cell), the corresponding data is filled with a default value."],["Match","A `Match` is a set of atomic indexes matching a given selection. It can mostly be used like a `&[usize]`."],["PropertiesIter","An iterator over the properties in an atom/frame/residue"],["Residue","A `Residue` is a group of atoms belonging to the same logical unit. They can be small molecules, amino-acids in a protein, monomers in polymers, etc."],["ResidueRef","An analog to a reference to a residue (`&Residue`)"],["Selection","A `Selection` allow to select atoms in a `Frame`, from a selection language. The selection language is built by combining basic operations. Each basic operation follows the `[()] ` structure, where `` is a comparison operator in `== != < <= > >=`."],["Topology","A `Topology` contains the definition of all the atoms in the system, and the liaisons between the atoms (bonds, angles, dihedrals, …). It will also contain all the residues information if it is available."],["TopologyRef","An analog to a reference to a topology (`&Topology`)"],["Trajectory","The `Trajectory` type is the main entry point when using chemfiles. A `Trajectory` behave a bit like a file, allowing to read and/or write `Frame`."],["UnitCell","An `UnitCell` represent the box containing the atoms, and its periodicity."],["UnitCellMut","An analog to a mutable reference to an unit cell (`&mut UnitCell`)"],["UnitCellRef","An analog to a reference to an unit cell (`&UnitCell`)"]]}; \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.Atom.html b/0.10.3/chemfiles/struct.Atom.html new file mode 100644 index 000000000..4c61f0a9b --- /dev/null +++ b/0.10.3/chemfiles/struct.Atom.html @@ -0,0 +1,132 @@ +Atom in chemfiles - Rust +
+

Struct chemfiles::Atom

source · []
pub struct Atom { /* private fields */ }
Expand description

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
    +
  • atom name;
  • +
  • atom type;
  • +
  • atom mass;
  • +
  • atom charge.
  • +
+

The atom name is usually an unique identifier (H1, C_a) while the +atom type will be shared between all particles of the same type: H, +Ow, CH3.

+

Implementations

Create an atom with the given name, and set the atom type to name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Set the atom mass to mass, in atomic mass units.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Set the atom charge to charge, in number of the electron charge e.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Set the atom name to name.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

Set the atom type to atomic_type.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.AtomMut.html b/0.10.3/chemfiles/struct.AtomMut.html new file mode 100644 index 000000000..eca503eb1 --- /dev/null +++ b/0.10.3/chemfiles/struct.AtomMut.html @@ -0,0 +1,115 @@ +AtomMut in chemfiles - Rust +
pub struct AtomMut<'a> { /* private fields */ }
Expand description

An analog to a mutable reference to an atom (&mut Atom)

+

Methods from Deref<Target = Atom>

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Set the atom mass to mass, in atomic mass units.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Set the atom charge to charge, in number of the electron charge e.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Set the atom name to name.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+

Set the atom type to atomic_type.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Mutably dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.AtomRef.html b/0.10.3/chemfiles/struct.AtomRef.html new file mode 100644 index 000000000..b0d7ebf1c --- /dev/null +++ b/0.10.3/chemfiles/struct.AtomRef.html @@ -0,0 +1,80 @@ +AtomRef in chemfiles - Rust +
pub struct AtomRef<'a> { /* private fields */ }
Expand description

An analog to a reference to an atom (&Atom)

+

Methods from Deref<Target = Atom>

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.Error.html b/0.10.3/chemfiles/struct.Error.html new file mode 100644 index 000000000..4f2178a8d --- /dev/null +++ b/0.10.3/chemfiles/struct.Error.html @@ -0,0 +1,45 @@ +Error in chemfiles - Rust +
pub struct Error {
+    pub status: Status,
+    pub message: String,
+}
Expand description

Error type for Chemfiles.

+

Fields

status: Status

The error status code

+
message: String

A message describing the error cause

+

Implementations

Get the last error message from the C++ library.

+

Clear any error from the C++ library

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

Formats the value using the given formatter. Read more

+
👎 Deprecated since 1.42.0:

use the Display impl or to_string()

+

The lower-level source of this error, if any. Read more

+
🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

+
👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

+

Converts to this type from the input type.

+

Converts to this type from the input type.

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

Converts the given value to a String. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.FormatMetadata.html b/0.10.3/chemfiles/struct.FormatMetadata.html new file mode 100644 index 000000000..fcefc6b5c --- /dev/null +++ b/0.10.3/chemfiles/struct.FormatMetadata.html @@ -0,0 +1,57 @@ +FormatMetadata in chemfiles - Rust +
pub struct FormatMetadata {
Show 13 fields + pub name: &'static str, + pub extension: Option<&'static str>, + pub description: &'static str, + pub reference: &'static str, + pub read: bool, + pub write: bool, + pub memory: bool, + pub positions: bool, + pub velocities: bool, + pub unit_cell: bool, + pub atoms: bool, + pub bonds: bool, + pub residues: bool, +
}
Expand description

FormatMetadata contains metadata associated with one format.

+

Fields

name: &'static str

Name of the format.

+
extension: Option<&'static str>

Extension associated with the format.

+
description: &'static str

Extended, user-facing description of the format.

+
reference: &'static str

URL pointing to the format definition/reference.

+
read: bool

Is reading files in this format implemented?

+
write: bool

Is writing files in this format implemented?

+
memory: bool

Does this format support in-memory IO?

+
positions: bool

Does this format support storing atomic positions?

+
velocities: bool

Does this format support storing atomic velocities?

+
unit_cell: bool

Does this format support storing unit cell information?

+
atoms: bool

Does this format support storing atom names or types?

+
bonds: bool

Does this format support storing bonds between atoms?

+
residues: bool

Does this format support storing residues?

+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.Frame.html b/0.10.3/chemfiles/struct.Frame.html new file mode 100644 index 000000000..8f189f2e3 --- /dev/null +++ b/0.10.3/chemfiles/struct.Frame.html @@ -0,0 +1,374 @@ +Frame in chemfiles - Rust +
pub struct Frame { /* private fields */ }
Expand description

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

Implementations

Create an empty frame. It will be resized by the library as needed.

+
Example
+
let frame = Frame::new();
+
+assert_eq!(frame.size(), 0);
+

Get a reference to the atom at the given index in this frame.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+let atom = frame.atom(0);
+assert_eq!(atom.name(), "Zn");
+

Get a mutable reference to the atom at the given index in this frame.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+assert_eq!(frame.atom(0).name(), "Zn");
+
+frame.atom_mut(0).set_name("Fe");
+assert_eq!(frame.atom(0).name(), "Fe");
+

Get the current number of atoms in this frame.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.size(), 0);
+
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

Resize the positions and the velocities in this frame, to make space for +natoms atoms. Previous data is conserved, as well as the presence of +absence of velocities.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+

Add an Atom and the corresponding position and optionally velocity +data to this frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+
+frame.add_velocities();
+frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+

Remove the atom at index i in this frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+assert_eq!(frame.size(), 3);
+
+frame.remove(1);
+assert_eq!(frame.size(), 2);
+assert_eq!(frame.atom(1).name(), "Sn");
+

Add a bond between the atoms at indexes i and j in the frame.

+

The bond order is set to BondOrder::Unknown.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+assert_eq!(frame.topology().bonds_count(), 3);
+
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+

Add a bond between the atoms at indexes i and j in the frame +with the given bond order.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(2);
+
+frame.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+

Remove any existing bond between the atoms at indexes i and j in +the frame.

+

This function does nothing if there is no bond between i and j.

+
Example
+
let mut frame = Frame::new();
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+
+frame.remove_bond(2, 4);
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+

Add a copy of residue to this frame.

+
Errors
+

This function fails is the residue id is already in this frame’s +topology, or if the residue contain atoms that are already in another +residue.

+
Example
+
let mut frame = Frame::new();
+
+let residue = Residue::new("foo");
+frame.add_residue(&residue).unwrap();
+
+let topology = frame.topology();
+assert_eq!(topology.residues_count(), 1);
+assert_eq!(topology.residue(0).unwrap().name(), "foo");
+

Get the distance between the atoms at indexes i and j in this frame, +accounting for periodic boundary conditions. The result is expressed in +Angstroms.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+
+assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+

Get the angle formed by the atoms at indexes i, j and k in this +frame, accounting for periodic boundary conditions. The result is +expressed in radians.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+

Get the dihedral angle formed by the atoms at indexes i, j, k and +m in this frame, accounting for periodic boundary conditions. The +result is expressed in radians.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+
+assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+

Get the out of plane distance formed by the atoms at indexes i, j, +k and m in this frame, accounting for periodic boundary conditions. +The result is expressed in angstroms.

+

This is the distance between the atom j and the ikm plane. The j atom +is the center of the improper dihedral angle formed by i, j, k and m.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+

Get a view into the positions of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+
+let positions = frame.positions();
+assert_eq!(positions.len(), 67);
+assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+

Get a mutable view into the positions of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+{
+    let positions = frame.positions_mut();
+    assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    positions[0] = [1.0, 2.0, 3.0];
+}
+
+let positions = frame.positions();
+assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+

Get a view into the velocities of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+
+let velocities = frame.velocities().expect("missing velocities");
+assert_eq!(velocities.len(), 67);
+assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+

Get a mutable view into the velocities of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+{
+    let velocities = frame.velocities_mut().expect("missing velocities");
+    assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    velocities[0] = [1.0, 2.0, 3.0];
+}
+
+let velocities = frame.velocities().expect("missing velocities");
+assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+

Check if this frame contains velocity data.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

Add velocity data to this frame. If the frame already have velocities, +this does nothing.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+

Get a reference to the UnitCell from this frame.

+
Example
+
let frame = Frame::new();
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Infinite);
+

Get a mutable reference to the UnitCell from this frame.

+
Example
+
let mut frame = Frame::new();
+
+assert_eq!(frame.cell().shape(), CellShape::Infinite);
+
+frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+

Set the UnitCell of this frame to cell.

+
Example
+
let mut frame = Frame::new();
+
+frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+

Get a reference to the Topology of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(42);
+
+let topology = frame.topology();
+assert_eq!(topology.size(), 42);
+

Set the Topology of this frame to topology.

+
Errors
+

This function fails if the topology contains a different number of atoms +than this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(2);
+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Cl"));
+topology.add_atom(&Atom::new("Cl"));
+topology.add_bond(0, 1);
+
+frame.set_topology(&topology).unwrap();
+assert_eq!(frame.atom(0).name(), "Cl");
+

Get this frame step, i.e. the frame number in the trajectory

+
Example
+
let frame = Frame::new();
+assert_eq!(frame.step(), 0);
+

Set this frame step to step.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
+frame.set_step(10);
+assert_eq!(frame.step(), 10);
+

Guess the bonds, angles and dihedrals in this frame.

+

The bonds are guessed using a distance-based algorithm, and then angles +and dihedrals are guessed from the bonds.

+
Errors
+

This function can fail if the covalent radius is unknown for some atoms +in the frame.

+
Example
+
let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+assert_eq!(frame.topology().bonds_count(), 0);
+
+frame.guess_bonds().unwrap();
+assert_eq!(frame.topology().bonds_count(), 1);
+

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology of the frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+
+frame.add_bond(0, 1);
+frame.add_bond(1, 2);
+
+assert_eq!(frame.topology().bonds().len(), 2);
+assert_eq!(frame.topology().angles().len(), 1);
+
+frame.clear_bonds();
+assert!(frame.topology().bonds().is_empty());
+assert!(frame.topology().angles().is_empty());
+

Add a new property with the given name to this frame.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut frame = Frame::new();
+frame.set("a string", "hello");
+frame.set("a double", 4.3);
+
+assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+
+assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(frame.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+frame.set("bar", Property::Bool(false));
+
+for (name, property) in frame.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Gets an iterator over atoms

+
Example
+
let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+
+let mut atoms: Vec<AtomRef> = Vec::new();
+
+for atom in frame.iter_atoms() {
+    atoms.push(atom);
+}
+
+assert_eq!(atoms.len(), 2);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.Match.html b/0.10.3/chemfiles/struct.Match.html new file mode 100644 index 000000000..ae1de50f1 --- /dev/null +++ b/0.10.3/chemfiles/struct.Match.html @@ -0,0 +1,59 @@ +Match in chemfiles - Rust +
pub struct Match { /* private fields */ }
Expand description

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

Implementations

Get the length of the Match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+

Create a new match containing the atoms in the atoms slice.

+
Panics
+

If the slice contains more than 4 elements, which is the maximal size +of a match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+assert_eq!(atomic_match[0], 3);
+assert_eq!(atomic_match[1], 4);
+assert_eq!(atomic_match[2], 5);
+

Iterate over the atomic indexes in the match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+let mut iter = atomic_match.iter();
+
+assert_eq!(iter.next(), Some(&3));
+assert_eq!(iter.next(), Some(&4));
+assert_eq!(iter.next(), Some(&5));
+assert_eq!(iter.next(), None);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Formats the value using the given formatter. Read more

+

The returned type after indexing.

+

Performs the indexing (container[index]) operation. Read more

+

The type of the elements being iterated over.

+

Which kind of iterator are we turning this into?

+

Creates an iterator from a value. Read more

+

This method tests for self and other values to be equal, and is used +by ==. Read more

+

This method tests for !=.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.PropertiesIter.html b/0.10.3/chemfiles/struct.PropertiesIter.html new file mode 100644 index 000000000..fc97289e0 --- /dev/null +++ b/0.10.3/chemfiles/struct.PropertiesIter.html @@ -0,0 +1,136 @@ +PropertiesIter in chemfiles - Rust +
pub struct PropertiesIter<'a> { /* private fields */ }
Expand description

An iterator over the properties in an atom/frame/residue

+

Trait Implementations

The type of the elements being iterated over.

+

Advances the iterator and returns the next value. Read more

+

Returns the bounds on the remaining length of the iterator. Read more

+

Consumes the iterator, counting the number of iterations and returning it. Read more

+

Consumes the iterator, returning the last element. Read more

+
🔬 This is a nightly-only experimental API. (iter_advance_by)

Advances the iterator by n elements. Read more

+

Returns the nth element of the iterator. Read more

+

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more

+

Takes two iterators and creates a new iterator over both in sequence. Read more

+

‘Zips up’ two iterators into a single iterator of pairs. Read more

+
🔬 This is a nightly-only experimental API. (iter_intersperse)

Creates a new iterator which places a copy of separator between adjacent +items of the original iterator. Read more

+
🔬 This is a nightly-only experimental API. (iter_intersperse)

Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more

+

Takes a closure and creates an iterator which calls that closure on each +element. Read more

+

Calls a closure on each element of an iterator. Read more

+

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more

+

Creates an iterator that both filters and maps. Read more

+

Creates an iterator which gives the current iteration count as well as +the next value. Read more

+

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more

+

Creates an iterator that skips elements based on a predicate. Read more

+

Creates an iterator that yields elements based on a predicate. Read more

+

Creates an iterator that both yields elements based on a predicate and maps. Read more

+

Creates an iterator that skips the first n elements. Read more

+

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more

+

An iterator adapter similar to fold that holds internal state and +produces a new iterator. Read more

+

Creates an iterator that works like map, but flattens nested structure. Read more

+

Creates an iterator that flattens nested structure. Read more

+

Creates an iterator which ends after the first None. Read more

+

Does something with each element of an iterator, passing the value on. Read more

+

Borrows an iterator, rather than consuming it. Read more

+

Transforms an iterator into a collection. Read more

+
🔬 This is a nightly-only experimental API. (iterator_try_collect)

Fallibly transforms an iterator into a collection, short circuiting if +a failure is encountered. Read more

+
🔬 This is a nightly-only experimental API. (iter_collect_into)

Collects all the items from an iterator into a collection. Read more

+

Consumes an iterator, creating two collections from it. Read more

+
🔬 This is a nightly-only experimental API. (iter_partition_in_place)

Reorders the elements of this iterator in-place according to the given predicate, +such that all those that return true precede all those that return false. +Returns the number of true elements found. Read more

+
🔬 This is a nightly-only experimental API. (iter_is_partitioned)

Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more

+

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more

+

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more

+

Folds every element into an accumulator by applying an operation, +returning the final result. Read more

+

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more

+
🔬 This is a nightly-only experimental API. (iterator_try_reduce)

Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more

+

Tests if every element of the iterator matches a predicate. Read more

+

Tests if any element of the iterator matches a predicate. Read more

+

Searches for an element of an iterator that satisfies a predicate. Read more

+

Applies function to the elements of iterator and returns +the first non-none result. Read more

+
🔬 This is a nightly-only experimental API. (try_find)

Applies function to the elements of iterator and returns +the first true result or the first error. Read more

+

Searches for an element in an iterator, returning its index. Read more

+

Searches for an element in an iterator from the right, returning its +index. Read more

+

Returns the maximum element of an iterator. Read more

+

Returns the minimum element of an iterator. Read more

+

Returns the element that gives the maximum value from the +specified function. Read more

+

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more

+

Returns the element that gives the minimum value from the +specified function. Read more

+

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more

+

Reverses an iterator’s direction. Read more

+

Converts an iterator of pairs into a pair of containers. Read more

+

Creates an iterator which copies all of its elements. Read more

+

Creates an iterator which clones all of its elements. Read more

+

Repeats an iterator endlessly. Read more

+

Sums the elements of an iterator. Read more

+

Iterates over the entire iterator, multiplying all the elements Read more

+

Lexicographically compares the elements of this Iterator with those +of another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more

+

Lexicographically compares the elements of this Iterator with those +of another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more

+

Determines if the elements of this Iterator are equal to those of +another. Read more

+
🔬 This is a nightly-only experimental API. (iter_order_by)

Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more

+

Determines if the elements of this Iterator are unequal to those of +another. Read more

+

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more

+

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted using the given comparator function. Read more

+
🔬 This is a nightly-only experimental API. (is_sorted)

Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The type of the elements being iterated over.

+

Which kind of iterator are we turning this into?

+

Creates an iterator from a value. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.Residue.html b/0.10.3/chemfiles/struct.Residue.html new file mode 100644 index 000000000..dcbfba684 --- /dev/null +++ b/0.10.3/chemfiles/struct.Residue.html @@ -0,0 +1,114 @@ +Residue in chemfiles - Rust +
pub struct Residue { /* private fields */ }
Expand description

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

Implementations

Create a new residue with the given name

+
Example
+
let residue = Residue::new("ALA");
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), None);
+

Create a new residue with the given name and id as identifier.

+
Example
+
let residue = Residue::with_id("ALA", 67);
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), Some(67));
+

Get the number of atoms in this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

Get the identifier of this residue in the initial topology file.

+
Example
+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

Get the name of this residue.

+
Example
+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

Add the atom at index atom in this residue.

+

This will fail if the atom is already in the residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+assert_eq!(residue.contains(56), true);
+
+// Adding the same atom twice is fine
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+

Check if the atom at index i is in this residue

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

Get the list of atoms of this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

Add a new property with the given name to this residue.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("a string", "hello");
+residue.set("a double", 3.2);
+
+assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.ResidueRef.html b/0.10.3/chemfiles/struct.ResidueRef.html new file mode 100644 index 000000000..f164624c4 --- /dev/null +++ b/0.10.3/chemfiles/struct.ResidueRef.html @@ -0,0 +1,74 @@ +ResidueRef in chemfiles - Rust +
pub struct ResidueRef<'a> { /* private fields */ }
Expand description

An analog to a reference to a residue (&Residue)

+

Methods from Deref<Target = Residue>

Get the number of atoms in this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+

Get the identifier of this residue in the initial topology file.

+
Example
+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+

Get the name of this residue.

+
Example
+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+

Check if the atom at index i is in this residue

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+

Get the list of atoms of this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.Selection.html b/0.10.3/chemfiles/struct.Selection.html new file mode 100644 index 000000000..ccd17ee81 --- /dev/null +++ b/0.10.3/chemfiles/struct.Selection.html @@ -0,0 +1,83 @@ +Selection in chemfiles - Rust +
pub struct Selection { /* private fields */ }
Expand description

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

Implementations

Create a new selection from the given selection string.

+
Errors
+

This function fails if the selection string is invalid.

+
Example
+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+

Get the size of the selection, i.e. the number of atoms we are selecting +together.

+

This value is 1 for the ‘atom’ context, 2 for the ‘pair’ and ‘bond’ +context, 3 for the ‘three’ and ‘angles’ context and 4 for the ‘four’ +and ‘dihedral’ context.

+
Example
+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+assert_eq!(selection.size(), 2);
+

Get the selection string used to create this selection.

+
Example
+
let selection = Selection::new("name H").unwrap();
+assert_eq!(selection.string(), "name H");
+

Evaluate a selection for a given frame, and return the corresponding +matches.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+let matches = selection.evaluate(&frame);
+
+assert_eq!(matches.len(), 2);
+
+assert_eq!(matches[0].len(), 2);
+assert_eq!(matches[0][0], 0);
+assert_eq!(matches[0][1], 1);
+
+assert_eq!(matches[1].len(), 2);
+assert_eq!(matches[1][0], 2);
+assert_eq!(matches[1][1], 1);
+

Evaluates a selection of size 1 on a given frame. This function +returns the list of atomic indexes in the frame matching this selection.

+
Panics
+

If the selection size is not 1

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("name H").unwrap();
+let matches = selection.list(&frame);
+
+assert_eq!(matches.len(), 2);
+assert_eq!(matches[0], 0);
+assert_eq!(matches[1], 2);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.Topology.html b/0.10.3/chemfiles/struct.Topology.html new file mode 100644 index 000000000..71d5c1783 --- /dev/null +++ b/0.10.3/chemfiles/struct.Topology.html @@ -0,0 +1,291 @@ +Topology in chemfiles - Rust +
pub struct Topology { /* private fields */ }
Expand description

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

Implementations

Create a new empty topology.

+
Example
+
let topology = Topology::new();
+assert_eq!(topology.size(), 0);
+

Get a reference of the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

Get a mutable reference to the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+assert_eq!(topology.atom(4).name(), "");
+
+topology.atom_mut(4).set_name("Fe");
+assert_eq!(topology.atom(4).name(), "Fe");
+

Get the current number of atoms in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Resize this topology to hold natoms atoms, inserting dummy atoms if +the new size if bigger than the old one.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Add an Atom at the end of this topology

+
Example
+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Mg"));
+
+let atom = topology.atom(0);
+assert_eq!(atom.name(), "Mg");
+

Remove an Atom from this topology by index. This modify all the +other atoms indexes.

+
Panics
+

If the index is out of bounds

+
Example
+
let mut topology = Topology::new();
+topology.resize(9);
+assert_eq!(topology.size(), 9);
+
+topology.remove(7);
+assert_eq!(topology.size(), 8);
+

Get the number of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

Get the number of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

Get the number of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

Get the number of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

Get the list of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

Get the list of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

Get the list of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

Get the list of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+assert_eq!(topology.angles().len(), 1);
+
+topology.clear_bonds();
+assert!(topology.bonds().is_empty());
+assert!(topology.angles().is_empty());
+

Add a bond between the atoms at indexes i and j in the topology.

+

The bond order is set to BondOrder::Unknown.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+

Add a bond between the atoms at indexes i and j in the topology +with the given bond order.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for the bond between the atoms at indexes i and +j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for all the bonds in the topology

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

Remove any existing bond between the atoms at indexes i and j in +this topology.

+

This function does nothing if there is no bond between i and j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+topology.remove_bond(0, 1);
+assert_eq!(topology.bonds_count(), 1);
+
+// Removing a bond that does not exists is fine
+topology.remove_bond(0, 2);
+assert_eq!(topology.bonds_count(), 1);
+

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Get a copy of the residue containing the atom at index index in this +topology, if any.

+
Example
+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

Get the number of residues in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

Add a residue to this topology.

+
Errors
+

This function fails is the residue id is not already in the topology, +or if the residue contains atoms that are already in another residue.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+
Example
+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.TopologyRef.html b/0.10.3/chemfiles/struct.TopologyRef.html new file mode 100644 index 000000000..3cfc11a45 --- /dev/null +++ b/0.10.3/chemfiles/struct.TopologyRef.html @@ -0,0 +1,181 @@ +TopologyRef in chemfiles - Rust +
pub struct TopologyRef<'a> { /* private fields */ }
Expand description

An analog to a reference to a topology (&Topology)

+

Methods from Deref<Target = Topology>

Get a reference of the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+

Get the current number of atoms in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+

Get the number of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+

Get the number of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+

Get the number of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+

Get the number of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+

Get the list of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+

Get the list of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+

Get the list of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+

Get the list of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+

Get the bond order for the bond between the atoms at indexes i and +j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+

Get the bond order for all the bonds in the topology

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+

Get a copy of the residue containing the atom at index index in this +topology, if any.

+
Example
+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+

Get the number of residues in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+
Example
+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.Trajectory.html b/0.10.3/chemfiles/struct.Trajectory.html new file mode 100644 index 000000000..0065a8ccf --- /dev/null +++ b/0.10.3/chemfiles/struct.Trajectory.html @@ -0,0 +1,167 @@ +Trajectory in chemfiles - Rust +
pub struct Trajectory { /* private fields */ }
Expand description

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

Implementations

Open the file at the given path in the given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+
Errors
+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+
Example
+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+

Open the file at the given path using a specific file format and the +given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Specifying a format is needed when the file format does not match the +extension, or when there is not standard extension for this format. If +format is an empty string, the format will be guessed from the +extension.

+
Errors
+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+
Example
+
let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+

Read a memory buffer as though it was a formatted file.

+

The memory buffer used to store the file is given using the data +argument. The format parameter is required and should follow the same +rules as in the main Trajectory constructor.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format, or if the format do not support in-memory readers.

+
Example
+
let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+let mut frame = Frame::new();
+trajectory.read(&mut frame).unwrap();
+assert_eq!(frame.size(), 6);
+

Write to a memory buffer as though it was a formatted file.

+

The format parameter should follow the same rules as in the main +Trajectory constructor, except that compression specification +is not supported.

+

The memory_buffer function can be used to retrieve the data written +to memory of the Trajectory.

+
Errors
+

This function fails if the format do not support in-memory writers.

+
Example
+
let trajectory_memory = Trajectory::memory_writer("SMI");
+
+// Binary formats typically do not support this feature
+assert!(Trajectory::memory_writer("XTC").is_err());
+

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+

Write a frame to this trajectory.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+
Example
+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+

Get the number of steps (the number of frames) in a trajectory.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+

Obtain the memory buffer written to by the trajectory.

+
Errors
+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+
Example
+
let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+

Get file path for this trajectory.

+
Example
+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.UnitCell.html b/0.10.3/chemfiles/struct.UnitCell.html new file mode 100644 index 000000000..0a1d9c480 --- /dev/null +++ b/0.10.3/chemfiles/struct.UnitCell.html @@ -0,0 +1,155 @@ +UnitCell in chemfiles - Rust +
pub struct UnitCell { /* private fields */ }
Expand description

An UnitCell represent the box containing the atoms, and its periodicity.

+

An unit cell is fully represented by three lengths (a, b, c); and three +angles (alpha, beta, gamma). The angles are stored in degrees, and the +lengths in Angstroms.

+

A cell also has a matricial representation, by projecting the three base +vector into an orthonormal base. We choose to represent such matrix as an +upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |

Implementations

Create an Orthorhombic UnitCell from the three lengths, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Create an Infinite UnitCell.

+
Example
+
let cell = UnitCell::infinite();
+
+assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Infinite);
+

Create an Triclinic UnitCell from the three lengths (in Angstroms) +and three angles (in degree). alpha is the angle between the vectors +b and c; beta is the between the vectors a and c and gamma +is the angle between the vectors a and b.

+
Example
+
let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+assert_eq!(cell.angles()[0], 98.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Create an UnitCell from a cell matrix. If matrix contains only +zeros, then an Infinite cell is created. If only the diagonal of the +matrix is non-zero, then the cell is Orthorhombic. Else a +Triclinic cell is created. The matrix entries should be in Angstroms.

+
Panics
+

If the matrix has a negative determinant, or more generally is not +representing a unit cell.

+
Example
+
let cell = UnitCell::from_matrix([
+    [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+]);
+
+assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Set the three lengths of the cell, in Angstroms.

+
Errors
+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+
Example
+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Set the three angles of the cell, in degrees.

+
Errors
+

This function fails if the unit cell is not Triclinic.

+
Example
+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Set the shape of the unit cell to shape.

+
Errors
+

This can fail if the cell length or angles are incompatible with the +new shape.

+
Example
+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

Returns a copy of the value. Read more

+

Performs copy-assignment from source. Read more

+

Executes the destructor for this type. Read more

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The resulting type after obtaining ownership.

+

Creates owned data from borrowed data, usually by cloning. Read more

+

Uses borrowed data to replace owned data, usually by cloning. Read more

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.UnitCellMut.html b/0.10.3/chemfiles/struct.UnitCellMut.html new file mode 100644 index 000000000..cf8befb18 --- /dev/null +++ b/0.10.3/chemfiles/struct.UnitCellMut.html @@ -0,0 +1,102 @@ +UnitCellMut in chemfiles - Rust +
pub struct UnitCellMut<'a> { /* private fields */ }
Expand description

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

Methods from Deref<Target = UnitCell>

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Set the three lengths of the cell, in Angstroms.

+
Errors
+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+
Example
+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Set the three angles of the cell, in degrees.

+
Errors
+

This function fails if the unit cell is not Triclinic.

+
Example
+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Set the shape of the unit cell to shape.

+
Errors
+

This can fail if the cell length or angles are incompatible with the +new shape.

+
Example
+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Mutably dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/struct.UnitCellRef.html b/0.10.3/chemfiles/struct.UnitCellRef.html new file mode 100644 index 000000000..35ca6ff2f --- /dev/null +++ b/0.10.3/chemfiles/struct.UnitCellRef.html @@ -0,0 +1,68 @@ +UnitCellRef in chemfiles - Rust +
pub struct UnitCellRef<'a> { /* private fields */ }
Expand description

An analog to a reference to an unit cell (&UnitCell)

+

Methods from Deref<Target = UnitCell>

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations

The resulting type after dereferencing.

+

Dereferences the value.

+

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

+

Immutably borrows from an owned value. Read more

+

Mutably borrows from an owned value. Read more

+

Returns the argument unchanged.

+

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+

The type returned in the event of a conversion error.

+

Performs the conversion.

+
+ \ No newline at end of file diff --git a/0.10.3/chemfiles/topology/enum.BondOrder.html b/0.10.3/chemfiles/topology/enum.BondOrder.html new file mode 100644 index 000000000..14589bc12 --- /dev/null +++ b/0.10.3/chemfiles/topology/enum.BondOrder.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.BondOrder.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/topology/struct.Topology.html b/0.10.3/chemfiles/topology/struct.Topology.html new file mode 100644 index 000000000..1215dacfd --- /dev/null +++ b/0.10.3/chemfiles/topology/struct.Topology.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Topology.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/topology/struct.TopologyRef.html b/0.10.3/chemfiles/topology/struct.TopologyRef.html new file mode 100644 index 000000000..7cdec6164 --- /dev/null +++ b/0.10.3/chemfiles/topology/struct.TopologyRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.TopologyRef.html...

+ + + \ No newline at end of file diff --git a/0.10.3/chemfiles/trajectory/struct.Trajectory.html b/0.10.3/chemfiles/trajectory/struct.Trajectory.html new file mode 100644 index 000000000..bab83ffc9 --- /dev/null +++ b/0.10.3/chemfiles/trajectory/struct.Trajectory.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Trajectory.html...

+ + + \ No newline at end of file diff --git a/0.10.3/clipboard.svg b/0.10.3/clipboard.svg new file mode 100644 index 000000000..8adbd9963 --- /dev/null +++ b/0.10.3/clipboard.svg @@ -0,0 +1 @@ + diff --git a/0.10.3/crates.js b/0.10.3/crates.js new file mode 100644 index 000000000..833ec8f70 --- /dev/null +++ b/0.10.3/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["chemfiles"]; \ No newline at end of file diff --git a/0.10.3/dark.css b/0.10.3/dark.css new file mode 100644 index 000000000..d8bd2002b --- /dev/null +++ b/0.10.3/dark.css @@ -0,0 +1 @@ +body,#settings-menu #settings,#settings-menu #settings::before{background-color:#353535;color:#ddd;}.setting-line .radio-line input{border-color:#ddd;}.setting-line .radio-line input:checked{box-shadow:inset 0 0 0 3px #353535;background-color:#2196f3;}.setting-line .radio-line input:focus{box-shadow:0 0 1px 1px #2196f3;}.setting-line .radio-line input:checked:focus{box-shadow:inset 0 0 0 3px #353535,0 0 2px 2px #2196f3;}.setting-line .radio-line input:hover{border-color:#2196f3 !important;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:checked+.slider{background-color:#2196F3;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}h1,h2,h3,h4{color:#ddd;}h1.fqn{border-bottom-color:#d2d2d2;}h2,h3,h4{border-bottom-color:#d2d2d2;}.in-band{background-color:#353535;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#2A2A2A;}pre,.rustdoc.source .example-wrap{background-color:#2A2A2A;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:#505050;}.rust-logo{filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff)}*{scrollbar-color:rgb(64,65,67) #717171;}.sidebar{scrollbar-color:rgba(32,34,37,.6) #5a5a5a;}::-webkit-scrollbar-track{background-color:#717171;}::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar::-webkit-scrollbar-track{background-color:#717171;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(32,34,37,.6);}.sidebar .current,.sidebar a:hover{background:#444;}.source .sidebar{background-color:#565656;}.line-numbers span{color:#3B91E2;}.line-numbers .line-highlighted{background-color:#0a042f !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:#DDD;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#ddd;}.search-results a:hover{background-color:#777;}.search-results a:focus{color:#eee !important;background-color:#616161;}.search-results a:focus span{color:#eee !important;}a.result-trait:focus{background-color:#013191;}a.result-traitalias:focus{background-color:#013191;}a.result-mod:focus,a.result-externcrate:focus{background-color:#884719;}a.result-enum:focus{background-color:#194e9f;}a.result-struct:focus{background-color:#194e9f;}a.result-union:focus{background-color:#194e9f;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#4950ed;}a.result-type:focus{background-color:#194e9f;}a.result-associatedtype:focus{background-color:#884719;}a.result-foreigntype:focus{background-color:#194e9f;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#217d1c;}a.result-constant:focus,a.result-static:focus{background-color:#884719;}a.result-primitive:focus{background-color:#194e9f;}a.result-keyword:focus{background-color:#884719;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#2dbfb8;}.content span.struct,.content a.struct,.block a.current.struct{color:#2dbfb8;}.content span.type,.content a.type,.block a.current.type{color:#2dbfb8;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#D2991D;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#2dbfb8;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#09bd00;}.content span.union,.content a.union,.block a.current.union{color:#2dbfb8;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#D2991D;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#2dbfb8;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#D2991D;}.content span.trait,.content a.trait,.block a.current.trait{color:#b78cf2;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#b78cf2;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#2BAB63;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#D2991D;}.sidebar a{color:#fdbf35;}.sidebar a.current.enum{color:#12ece2;}.sidebar a.current.struct{color:#12ece2;}.sidebar a.current.type{color:#12ece2;}.sidebar a.current.associatedtype{color:#fdbf35;}.sidebar a.current.foreigntype{color:#12ece2;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#0be900;}.sidebar a.current.union{color:#12ece2;}.sidebar a.current.constant .sidebar a.current.static{color:#fdbf35;}.sidebar a.current.primitive{color:#12ece2;}.sidebar a.current.externcrate .sidebar a.current.mod{color:#fdbf35;}.sidebar a.current.trait{color:#cca7ff;}.sidebar a.current.traitalias{color:#cca7ff;}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{color:#32d479;}.sidebar a.current.keyword{color:#fdbf35;}pre.rust .comment{color:#8d8d8b;}pre.rust .doccomment{color:#8ca375;}nav.main .current{border-top-color:#eee;border-bottom-color:#eee;}nav.main .separator{border-color:#eee;}a{color:#D2991D;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a{color:#ddd;}.search-results a{color:#ddd;}a.test-arrow{color:#dedede;}body.source .example-wrap pre.rust a{background:#333;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}details.rustdoc-toggle>summary::before,details.undocumented>summary::before{filter:invert(100%);}#crate-search,.search-input{color:#111;background-color:#f0f0f0;border-color:#f0f0f0 !important;}.search-input{border-color:#e0e0e0;}.search-input:focus{border-color:#008dfd;}.module-item .stab,.import-item .stab{color:#ddd;}.stab.empty-impl{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;color:#2f2f2f;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;color:#2f2f2f;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;color:#2f2f2f;}.stab.portability>code{background:none;}#help>div{background:#4d4d4d;border-color:#bfbfbf;}#help span.bottom,#help span.top{border-color:#bfbfbf;}#help dt{border-color:#bfbfbf;background:rgba(0,0,0,0);}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:#ddd;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#ab8ac1;}pre.rust .kw-2,pre.rust .prelude-ty{color:#769acb;}pre.rust .number,pre.rust .string{color:#83a300;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#ee6868;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#d97f26;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#4a4949;}a.test-arrow{background-color:rgba(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target{background-color:#494a3d;border-right:3px solid #bb7410;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.8);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.8);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.8);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.8);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#0089ff;}.tooltip::after{background-color:#000;color:#fff;border-color:#000;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#111;border-color:#777;}.notable-traits-tooltiptext .notable{border-bottom-color:#d2d2d2;}#titles>button:not(.selected){background-color:#252525;border-top-color:#252525;}#titles>button:hover,#titles>button.selected{border-top-color:#0089ff;background-color:#353535;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#505050;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#505050;border-right-color:#000;}#sidebar-filler{background-color:#505050;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow:inset 0 -1px 0 #c6cbd1;}#settings-menu>a,#help-button{border-color:#e0e0e0;background:#f0f0f0;color:#000;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button:hover,#help-button:focus{border-color:#ffb900;}#settings-menu #settings,#settings-menu #settings::before{border-color:#d2d2d2;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(65%);}#theme-choices{border-color:#e0e0e0;background-color:#353535;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#4e4e4e;}.search-results .result-name span.alias{color:#fff;}.search-results .result-name span.grey{color:#ccc;}#sidebar-toggle{background-color:#565656;}#sidebar-toggle:hover{background-color:#676767;}#source-sidebar{background-color:#565656;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#444;}div.files>.selected{background-color:#333;}.scraped-example-list .scrape-help{border-color:#aaa;color:#eee;}.scraped-example-list .scrape-help:hover{border-color:white;color:white;}.more-examples-toggle summary,.more-examples-toggle .hide-more{color:#999;}.scraped-example .example-wrap .rust span.highlight{background:rgb(91,59,1);}.scraped-example .example-wrap .rust span.highlight.focus{background:rgb(124,75,15);}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(53,53,53,1),rgba(53,53,53,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(53,53,53,1),rgba(53,53,53,0));}.toggle-line-inner{background:#999;}.toggle-line:hover .toggle-line-inner{background:#c5c5c5;} \ No newline at end of file diff --git a/0.10.3/down-arrow.svg b/0.10.3/down-arrow.svg new file mode 100644 index 000000000..35437e77a --- /dev/null +++ b/0.10.3/down-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.3/favicon-16x16.png b/0.10.3/favicon-16x16.png new file mode 100644 index 000000000..ea4b45cae Binary files /dev/null and b/0.10.3/favicon-16x16.png differ diff --git a/0.10.3/favicon-32x32.png b/0.10.3/favicon-32x32.png new file mode 100644 index 000000000..69b8613ce Binary files /dev/null and b/0.10.3/favicon-32x32.png differ diff --git a/0.10.3/favicon.svg b/0.10.3/favicon.svg new file mode 100644 index 000000000..8b34b5119 --- /dev/null +++ b/0.10.3/favicon.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/0.10.3/implementors/core/clone/trait.Clone.js b/0.10.3/implementors/core/clone/trait.Clone.js new file mode 100644 index 000000000..e75b18173 --- /dev/null +++ b/0.10.3/implementors/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Clone for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Clone for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Clone for Atom","synthetic":false,"types":["chemfiles::atom::Atom"]},{"text":"impl Clone for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Clone for UnitCell","synthetic":false,"types":["chemfiles::cell::UnitCell"]},{"text":"impl Clone for Residue","synthetic":false,"types":["chemfiles::residue::Residue"]},{"text":"impl Clone for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Clone for Topology","synthetic":false,"types":["chemfiles::topology::Topology"]},{"text":"impl Clone for Frame","synthetic":false,"types":["chemfiles::frame::Frame"]},{"text":"impl Clone for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Clone for Selection","synthetic":false,"types":["chemfiles::selection::Selection"]},{"text":"impl Clone for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl Clone for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/cmp/trait.Eq.js b/0.10.3/implementors/core/cmp/trait.Eq.js new file mode 100644 index 000000000..52aa2d419 --- /dev/null +++ b/0.10.3/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Eq for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Eq for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Eq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Eq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Eq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Eq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/cmp/trait.Ord.js b/0.10.3/implementors/core/cmp/trait.Ord.js new file mode 100644 index 000000000..4bdf98353 --- /dev/null +++ b/0.10.3/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Ord for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/cmp/trait.PartialEq.js b/0.10.3/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..9b4c7c34b --- /dev/null +++ b/0.10.3/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialEq<Error> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl PartialEq<Status> for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl PartialEq<CellShape> for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl PartialEq<BondOrder> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl PartialEq<Match> for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl PartialEq<Property> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl PartialEq<FormatMetadata> for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/cmp/trait.PartialOrd.js b/0.10.3/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..119bcde74 --- /dev/null +++ b/0.10.3/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl PartialOrd<BondOrder> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl PartialOrd<Property> for Property","synthetic":false,"types":["chemfiles::property::Property"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/convert/trait.From.js b/0.10.3/implementors/core/convert/trait.From.js new file mode 100644 index 000000000..90f239b11 --- /dev/null +++ b/0.10.3/implementors/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl From<chfl_status> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl From<Utf8Error> for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl From<chfl_cellshape> for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl From<CellShape> for chfl_cellshape","synthetic":false,"types":["chemfiles_sys::chfl_cellshape"]},{"text":"impl From<chfl_bond_order> for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl From<bool> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<f64> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<String> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl<'a> From<&'a str> for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl From<[f64; 3]> for Property","synthetic":false,"types":["chemfiles::property::Property"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/fmt/trait.Debug.js b/0.10.3/implementors/core/fmt/trait.Debug.js new file mode 100644 index 000000000..cd9a9dd4c --- /dev/null +++ b/0.10.3/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Debug for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl Debug for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl Debug for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl Debug for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Debug for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl Debug for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl Debug for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/fmt/trait.Display.js b/0.10.3/implementors/core/fmt/trait.Display.js new file mode 100644 index 000000000..7b6a05cce --- /dev/null +++ b/0.10.3/implementors/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Display for Error","synthetic":false,"types":["chemfiles::errors::Error"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/iter/traits/collect/trait.IntoIterator.js b/0.10.3/implementors/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 000000000..eecd9d68f --- /dev/null +++ b/0.10.3/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> IntoIterator for &'a Match","synthetic":false,"types":["chemfiles::selection::Match"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/iter/traits/iterator/trait.Iterator.js b/0.10.3/implementors/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 000000000..284ee309a --- /dev/null +++ b/0.10.3/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Iterator for PropertiesIter<'a>","synthetic":false,"types":["chemfiles::property::PropertiesIter"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/marker/trait.Copy.js b/0.10.3/implementors/core/marker/trait.Copy.js new file mode 100644 index 000000000..22cf88f0d --- /dev/null +++ b/0.10.3/implementors/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Copy for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/marker/trait.Freeze.js b/0.10.3/implementors/core/marker/trait.Freeze.js new file mode 100644 index 000000000..7a6ceb43d --- /dev/null +++ b/0.10.3/implementors/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Freeze for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Freeze for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl Freeze for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> Freeze for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Freeze for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Freeze for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl Freeze for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> Freeze for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Freeze for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl Freeze for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> Freeze for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Freeze for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Freeze for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> Freeze for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl Freeze for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl Freeze for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Freeze for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl Freeze for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Freeze for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> Freeze for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Freeze for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/marker/trait.Send.js b/0.10.3/implementors/core/marker/trait.Send.js new file mode 100644 index 000000000..bfc6adc0f --- /dev/null +++ b/0.10.3/implementors/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Send for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Send for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl !Send for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> !Send for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !Send for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Send for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl !Send for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> !Send for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !Send for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl !Send for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> !Send for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Send for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl !Send for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> !Send for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl !Send for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl !Send for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Send for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl !Send for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Send for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !Send for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Send for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/marker/trait.StructuralEq.js b/0.10.3/implementors/core/marker/trait.StructuralEq.js new file mode 100644 index 000000000..4639cdd07 --- /dev/null +++ b/0.10.3/implementors/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralEq for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl StructuralEq for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl StructuralEq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl StructuralEq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl StructuralEq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl StructuralEq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/marker/trait.StructuralPartialEq.js b/0.10.3/implementors/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 000000000..88336d06d --- /dev/null +++ b/0.10.3/implementors/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl StructuralPartialEq for Error","synthetic":false,"types":["chemfiles::errors::Error"]},{"text":"impl StructuralPartialEq for Status","synthetic":false,"types":["chemfiles::errors::Status"]},{"text":"impl StructuralPartialEq for CellShape","synthetic":false,"types":["chemfiles::cell::CellShape"]},{"text":"impl StructuralPartialEq for BondOrder","synthetic":false,"types":["chemfiles::topology::BondOrder"]},{"text":"impl StructuralPartialEq for Match","synthetic":false,"types":["chemfiles::selection::Match"]},{"text":"impl StructuralPartialEq for Property","synthetic":false,"types":["chemfiles::property::Property"]},{"text":"impl StructuralPartialEq for FormatMetadata","synthetic":false,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/marker/trait.Sync.js b/0.10.3/implementors/core/marker/trait.Sync.js new file mode 100644 index 000000000..f899722b8 --- /dev/null +++ b/0.10.3/implementors/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Sync for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Sync for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl !Sync for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> !Sync for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !Sync for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Sync for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl !Sync for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> !Sync for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !Sync for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl !Sync for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> !Sync for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Sync for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl !Sync for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> !Sync for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl !Sync for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl !Sync for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Sync for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl !Sync for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Sync for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !Sync for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Sync for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/marker/trait.Unpin.js b/0.10.3/implementors/core/marker/trait.Unpin.js new file mode 100644 index 000000000..c32cfa86c --- /dev/null +++ b/0.10.3/implementors/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Unpin for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl Unpin for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl Unpin for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> Unpin for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Unpin for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl Unpin for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl Unpin for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> Unpin for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Unpin for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl Unpin for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> Unpin for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl Unpin for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl Unpin for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> Unpin for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl Unpin for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl Unpin for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Unpin for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl Unpin for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl Unpin for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> Unpin for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl Unpin for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/ops/deref/trait.Deref.js b/0.10.3/implementors/core/ops/deref/trait.Deref.js new file mode 100644 index 000000000..082d04f81 --- /dev/null +++ b/0.10.3/implementors/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> Deref for AtomRef<'a>","synthetic":false,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> Deref for AtomMut<'a>","synthetic":false,"types":["chemfiles::atom::AtomMut"]},{"text":"impl<'a> Deref for UnitCellRef<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> Deref for UnitCellMut<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl<'a> Deref for ResidueRef<'a>","synthetic":false,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl<'a> Deref for TopologyRef<'a>","synthetic":false,"types":["chemfiles::topology::TopologyRef"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/ops/deref/trait.DerefMut.js b/0.10.3/implementors/core/ops/deref/trait.DerefMut.js new file mode 100644 index 000000000..a777986d9 --- /dev/null +++ b/0.10.3/implementors/core/ops/deref/trait.DerefMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl<'a> DerefMut for AtomMut<'a>","synthetic":false,"types":["chemfiles::atom::AtomMut"]},{"text":"impl<'a> DerefMut for UnitCellMut<'a>","synthetic":false,"types":["chemfiles::cell::UnitCellMut"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/ops/drop/trait.Drop.js b/0.10.3/implementors/core/ops/drop/trait.Drop.js new file mode 100644 index 000000000..08c308277 --- /dev/null +++ b/0.10.3/implementors/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Drop for Atom","synthetic":false,"types":["chemfiles::atom::Atom"]},{"text":"impl Drop for UnitCell","synthetic":false,"types":["chemfiles::cell::UnitCell"]},{"text":"impl Drop for Residue","synthetic":false,"types":["chemfiles::residue::Residue"]},{"text":"impl Drop for Topology","synthetic":false,"types":["chemfiles::topology::Topology"]},{"text":"impl Drop for Frame","synthetic":false,"types":["chemfiles::frame::Frame"]},{"text":"impl Drop for Trajectory","synthetic":false,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl Drop for Selection","synthetic":false,"types":["chemfiles::selection::Selection"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/ops/index/trait.Index.js b/0.10.3/implementors/core/ops/index/trait.Index.js new file mode 100644 index 000000000..ff396c5ca --- /dev/null +++ b/0.10.3/implementors/core/ops/index/trait.Index.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Index<usize> for Match","synthetic":false,"types":["chemfiles::selection::Match"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/0.10.3/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 000000000..de625538a --- /dev/null +++ b/0.10.3/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl RefUnwindSafe for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl RefUnwindSafe for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl RefUnwindSafe for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> RefUnwindSafe for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> RefUnwindSafe for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl RefUnwindSafe for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl RefUnwindSafe for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> RefUnwindSafe for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> RefUnwindSafe for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl RefUnwindSafe for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> RefUnwindSafe for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl RefUnwindSafe for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl RefUnwindSafe for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> RefUnwindSafe for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl RefUnwindSafe for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl RefUnwindSafe for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl RefUnwindSafe for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl RefUnwindSafe for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl RefUnwindSafe for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !RefUnwindSafe for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl RefUnwindSafe for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/0.10.3/implementors/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 000000000..cd890686d --- /dev/null +++ b/0.10.3/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl UnwindSafe for Error","synthetic":true,"types":["chemfiles::errors::Error"]},{"text":"impl UnwindSafe for Status","synthetic":true,"types":["chemfiles::errors::Status"]},{"text":"impl UnwindSafe for Atom","synthetic":true,"types":["chemfiles::atom::Atom"]},{"text":"impl<'a> UnwindSafe for AtomRef<'a>","synthetic":true,"types":["chemfiles::atom::AtomRef"]},{"text":"impl<'a> !UnwindSafe for AtomMut<'a>","synthetic":true,"types":["chemfiles::atom::AtomMut"]},{"text":"impl UnwindSafe for CellShape","synthetic":true,"types":["chemfiles::cell::CellShape"]},{"text":"impl UnwindSafe for UnitCell","synthetic":true,"types":["chemfiles::cell::UnitCell"]},{"text":"impl<'a> UnwindSafe for UnitCellRef<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellRef"]},{"text":"impl<'a> !UnwindSafe for UnitCellMut<'a>","synthetic":true,"types":["chemfiles::cell::UnitCellMut"]},{"text":"impl UnwindSafe for Residue","synthetic":true,"types":["chemfiles::residue::Residue"]},{"text":"impl<'a> UnwindSafe for ResidueRef<'a>","synthetic":true,"types":["chemfiles::residue::ResidueRef"]},{"text":"impl UnwindSafe for BondOrder","synthetic":true,"types":["chemfiles::topology::BondOrder"]},{"text":"impl UnwindSafe for Topology","synthetic":true,"types":["chemfiles::topology::Topology"]},{"text":"impl<'a> UnwindSafe for TopologyRef<'a>","synthetic":true,"types":["chemfiles::topology::TopologyRef"]},{"text":"impl UnwindSafe for Frame","synthetic":true,"types":["chemfiles::frame::Frame"]},{"text":"impl UnwindSafe for Trajectory","synthetic":true,"types":["chemfiles::trajectory::Trajectory"]},{"text":"impl UnwindSafe for Match","synthetic":true,"types":["chemfiles::selection::Match"]},{"text":"impl UnwindSafe for Selection","synthetic":true,"types":["chemfiles::selection::Selection"]},{"text":"impl UnwindSafe for Property","synthetic":true,"types":["chemfiles::property::Property"]},{"text":"impl<'a> !UnwindSafe for PropertiesIter<'a>","synthetic":true,"types":["chemfiles::property::PropertiesIter"]},{"text":"impl UnwindSafe for FormatMetadata","synthetic":true,"types":["chemfiles::misc::FormatMetadata"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/implementors/std/error/trait.Error.js b/0.10.3/implementors/std/error/trait.Error.js new file mode 100644 index 000000000..9bed8c620 --- /dev/null +++ b/0.10.3/implementors/std/error/trait.Error.js @@ -0,0 +1,3 @@ +(function() {var implementors = {}; +implementors["chemfiles"] = [{"text":"impl Error for Error","synthetic":false,"types":["chemfiles::errors::Error"]}]; +if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.3/index.html b/0.10.3/index.html new file mode 100644 index 000000000..8b8b920bb --- /dev/null +++ b/0.10.3/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/0.10.3/light.css b/0.10.3/light.css new file mode 100644 index 000000000..ceb83fcc2 --- /dev/null +++ b/0.10.3/light.css @@ -0,0 +1 @@ + body,#settings-menu #settings,#settings-menu #settings::before{background-color:white;color:black;}.setting-line .radio-line input{border-color:black;}.setting-line .radio-line input:checked{box-shadow:inset 0 0 0 3px white;background-color:#2196f3;}.setting-line .radio-line input:focus{box-shadow:0 0 1px 1px #2196f3;}.setting-line .radio-line input:checked:focus{box-shadow:inset 0 0 0 3px white,0 0 2px 2px #2196f3;}.setting-line .radio-line input:hover{border-color:#2196f3 !important;}.slider{background-color:#ccc;}.slider:before{background-color:white;}input:checked+.slider{background-color:#2196F3;}input:focus+.slider{box-shadow:0 0 0 2px #0a84ff,0 0 0 6px rgba(10,132,255,0.3);}h1,h2,h3,h4{color:black;}h1.fqn{border-bottom-color:#DDDDDD;}h2,h3,h4{border-bottom-color:#DDDDDD;}.in-band{background-color:white;}.invisible{background:rgba(0,0,0,0);}.docblock code,.docblock-short code{background-color:#F5F5F5;}pre,.rustdoc.source .example-wrap{background-color:#F5F5F5;}.sidebar,.mobile-topbar,.sidebar-menu-toggle{background-color:#F5F5F5;}*{scrollbar-color:rgba(36,37,39,0.6) #e6e6e6;}.sidebar{scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;}.rust-logo{}::-webkit-scrollbar-track{background-color:#ecebeb;}::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar::-webkit-scrollbar-track{background-color:#dcdcdc;}.sidebar::-webkit-scrollbar-thumb{background-color:rgba(36,37,39,0.6);}.sidebar .current,.sidebar a:hover{background-color:#fff;}.source .sidebar{background-color:#f1f1f1;}.line-numbers span{color:#c67e2d;}.line-numbers .line-highlighted{background-color:#FDFFD3 !important;}.docblock h1,.docblock h2,.docblock h3,.docblock h4,.docblock h5,.docblock h6{border-bottom-color:#ddd;}.docblock table td,.docblock table th{border-color:#ddd;}.content .method .where,.content .fn .where,.content .where.fmt-newline{color:#4E4C4C;}.search-results a:hover{background-color:#ddd;}.search-results a:focus{color:#000 !important;background-color:#ccc;}.search-results a:focus span{color:#000 !important;}a.result-trait:focus{background-color:#c7b6ff;}a.result-traitalias:focus{background-color:#c7b6ff;}a.result-mod:focus,a.result-externcrate:focus{background-color:#afc6e4;}a.result-enum:focus{background-color:#e7b1a0;}a.result-struct:focus{background-color:#e7b1a0;}a.result-union:focus{background-color:#e7b1a0;}a.result-fn:focus,a.result-method:focus,a.result-tymethod:focus{background-color:#c6afb3;}a.result-type:focus{background-color:#e7b1a0;}a.result-associatedtype:focus{background-color:#afc6e4;}a.result-foreigntype:focus{background-color:#e7b1a0;}a.result-attr:focus,a.result-derive:focus,a.result-macro:focus{background-color:#8ce488;}a.result-constant:focus,a.result-static:focus{background-color:#afc6e4;}a.result-primitive:focus{background-color:#e7b1a0;}a.result-keyword:focus{background-color:#afc6e4;}.content .item-info::before{color:#ccc;}.content span.enum,.content a.enum,.block a.current.enum{color:#AD378A;}.content span.struct,.content a.struct,.block a.current.struct{color:#AD378A;}.content span.type,.content a.type,.block a.current.type{color:#AD378A;}.content span.foreigntype,.content a.foreigntype,.block a.current.foreigntype{color:#3873AD;}.content span.associatedtype,.content a.associatedtype,.block a.current.associatedtype{color:#3873AD;}.content span.attr,.content a.attr,.block a.current.attr,.content span.derive,.content a.derive,.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro{color:#068000;}.content span.union,.content a.union,.block a.current.union{color:#AD378A;}.content span.constant,.content a.constant,.block a.current.constant,.content span.static,.content a.static,.block a.current.static{color:#3873AD;}.content span.primitive,.content a.primitive,.block a.current.primitive{color:#AD378A;}.content span.externcrate,.content span.mod,.content a.mod,.block a.current.mod{color:#3873AD;}.content span.trait,.content a.trait,.block a.current.trait{color:#6E4FC9;}.content span.traitalias,.content a.traitalias,.block a.current.traitalias{color:#5137AD;}.content span.fn,.content a.fn,.block a.current.fn,.content span.method,.content a.method,.block a.current.method,.content span.tymethod,.content a.tymethod,.block a.current.tymethod,.content .fnname{color:#AD7C37;}.content span.keyword,.content a.keyword,.block a.current.keyword{color:#3873AD;}.sidebar a{color:#356da4;}.sidebar a.current.enum{color:#a63283;}.sidebar a.current.struct{color:#a63283;}.sidebar a.current.type{color:#a63283;}.sidebar a.current.associatedtype{color:#356da4;}.sidebar a.current.foreigntype{color:#356da4;}.sidebar a.current.attr,.sidebar a.current.derive,.sidebar a.current.macro{color:#067901;}.sidebar a.current.union{color:#a63283;}.sidebar a.current.constant .sidebar a.current.static{color:#356da4;}.sidebar a.current.primitive{color:#a63283;}.sidebar a.current.externcrate .sidebar a.current.mod{color:#356da4;}.sidebar a.current.trait{color:#6849c3;}.sidebar a.current.traitalias{color:#4b349e;}.sidebar a.current.fn,.sidebar a.current.method,.sidebar a.current.tymethod{color:#a67736;}.sidebar a.current.keyword{color:#356da4;}nav.main .current{border-top-color:#000;border-bottom-color:#000;}nav.main .separator{border:1px solid #000;}a{color:#3873AD;}a#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,.in-band a{color:#000;}.search-results a{color:initial;}a.test-arrow{color:#f5f5f5;}body.source .example-wrap pre.rust a{background:#eee;}details.rustdoc-toggle>summary.hideme>span,details.rustdoc-toggle>summary::before,details.undocumented>summary::before{color:#999;}#crate-search,.search-input{background-color:white;border-color:#e0e0e0 !important;}.search-input:focus{border-color:#66afe9;}.module-item .stab,.import-item .stab{color:#000;}.stab.empty-impl{background:#FFF5D6;border-color:#FFC600;}.stab.unstable{background:#FFF5D6;border-color:#FFC600;}.stab.deprecated{background:#ffc4c4;border-color:#db7b7b;}.stab.portability{background:#F3DFFF;border-color:#b07bdb;}.stab.portability>code{background:none;}#help>div{background:#e9e9e9;border-color:#bfbfbf;}#help span.bottom,#help span.top{border-color:#bfbfbf;}.rightside,.out-of-band{color:grey;}.result-name .primitive>i,.result-name .keyword>i{color:black;}.line-numbers :target{background-color:transparent;}pre.rust .kw{color:#8959A8;}pre.rust .kw-2,pre.rust .prelude-ty{color:#4271AE;}pre.rust .number,pre.rust .string{color:#718C00;}pre.rust .self,pre.rust .bool-val,pre.rust .prelude-val,pre.rust .attribute,pre.rust .attribute .ident{color:#C82829;}pre.rust .comment{color:#8E908C;}pre.rust .doccomment{color:#4D4D4C;}pre.rust .macro,pre.rust .macro-nonterminal{color:#3E999F;}pre.rust .lifetime{color:#B76514;}pre.rust .question-mark{color:#ff9011;}.example-wrap>pre.line-number{border-color:#c7c7c7;}a.test-arrow{background-color:rgb(78,139,202,0.2);}a.test-arrow:hover{background-color:#4e8bca;}.toggle-label,.code-attribute{color:#999;}:target{background:#FDFFD3;border-right:3px solid #AD7C37;}pre.compile_fail{border-left:2px solid rgba(255,0,0,.5);}pre.compile_fail:hover,.information:hover+pre.compile_fail{border-left:2px solid #f00;}pre.should_panic{border-left:2px solid rgba(255,0,0,.5);}pre.should_panic:hover,.information:hover+pre.should_panic{border-left:2px solid #f00;}pre.ignore{border-left:2px solid rgba(255,142,0,.6);}pre.ignore:hover,.information:hover+pre.ignore{border-left:2px solid #ff9200;}.tooltip.compile_fail{color:rgba(255,0,0,.5);}.information>.compile_fail:hover{color:#f00;}.tooltip.should_panic{color:rgba(255,0,0,.5);}.information>.should_panic:hover{color:#f00;}.tooltip.ignore{color:rgba(255,142,0,.6);}.information>.ignore:hover{color:#ff9200;}.search-failed a{color:#3873AD;}.tooltip::after{background-color:#000;color:#fff;}.tooltip::before{border-color:transparent black transparent transparent;}.notable-traits-tooltiptext{background-color:#eee;border-color:#999;}.notable-traits-tooltiptext .notable{border-bottom-color:#DDDDDD;}#titles>button:not(.selected){background-color:#e6e6e6;border-top-color:#e6e6e6;}#titles>button:hover,#titles>button.selected{background-color:#ffffff;border-top-color:#0089ff;}#titles>button>div.count{color:#888;}@media (max-width:700px){.sidebar-menu{background-color:#F5F5F5;border-bottom-color:#e0e0e0;border-right-color:#e0e0e0;}.sidebar-elems{background-color:#F5F5F5;border-right-color:#000;}#sidebar-filler{background-color:#F5F5F5;border-bottom-color:#e0e0e0;}}kbd{color:#000;background-color:#fafbfc;border-color:#d1d5da;border-bottom-color:#c6cbd1;box-shadow:inset 0 -1px 0 #c6cbd1;}#settings-menu>a,#help-button{border-color:#e0e0e0;background-color:#fff;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button:hover,#help-button:focus{border-color:#717171;}#settings-menu #settings,#settings-menu #settings::before{border-color:#DDDDDD;}#copy-path{color:#999;}#copy-path>img{filter:invert(50%);}#copy-path:hover>img{filter:invert(35%);}#theme-choices{border-color:#ccc;background-color:#fff;}#theme-choices>button:not(:first-child){border-top-color:#e0e0e0;}#theme-choices>button:hover,#theme-choices>button:focus{background-color:#eee;}.search-results .result-name span.alias{color:#000;}.search-results .result-name span.grey{color:#999;}#sidebar-toggle{background-color:#F5F5F5;}#sidebar-toggle:hover{background-color:#E0E0E0;}#source-sidebar{background-color:#F5F5F5;}#source-sidebar>.title{border-bottom-color:#ccc;}div.files>a:hover,div.name:hover{background-color:#E0E0E0;}div.files>.selected{background-color:#fff;}.scraped-example-list .scrape-help{border-color:#555;color:#333;}.scraped-example-list .scrape-help:hover{border-color:black;color:black;}.more-examples-toggle summary,.more-examples-toggle .hide-more{color:#999;}.scraped-example .example-wrap .rust span.highlight{background:#fcffd6;}.scraped-example .example-wrap .rust span.highlight.focus{background:#f6fdb0;}.scraped-example:not(.expanded) .code-wrapper:before{background:linear-gradient(to bottom,rgba(255,255,255,1),rgba(255,255,255,0));}.scraped-example:not(.expanded) .code-wrapper:after{background:linear-gradient(to top,rgba(255,255,255,1),rgba(255,255,255,0));}.toggle-line-inner{background:#ccc;}.toggle-line:hover .toggle-line-inner{background:#999;} \ No newline at end of file diff --git a/0.10.3/main.js b/0.10.3/main.js new file mode 100644 index 000000000..a756f4974 --- /dev/null +++ b/0.10.3/main.js @@ -0,0 +1,8 @@ +"use strict";if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.indexOf(searchString,position)===position}}if(!String.prototype.endsWith){String.prototype.endsWith=function(suffix,length){const l=length||this.length;return this.indexOf(suffix,l-suffix.length)!==-1}}if(!DOMTokenList.prototype.add){DOMTokenList.prototype.add=function(className){if(className&&!hasClass(this,className)){if(this.className&&this.className.length>0){this.className+=" "+className}else{this.className=className}}}}if(!DOMTokenList.prototype.remove){DOMTokenList.prototype.remove=function(className){if(className&&this.className){this.className=(" "+this.className+" ").replace(" "+className+" "," ").trim()}}}function getVar(name){const el=document.getElementById("rustdoc-vars");if(el){return el.attributes["data-"+name].value}else{return null}}function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}(function(){window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate")}());function setMobileTopbar(){const mobileLocationTitle=document.querySelector(".mobile-topbar h2.location");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileLocationTitle&&locationTitle){mobileLocationTitle.innerHTML=locationTitle.innerHTML}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}window.hideSettings=()=>{};function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function loadCss(cssFileName){const link=document.createElement("link");link.href=resourcePath(cssFileName,".css");link.type="text/css";link.rel="stylesheet";document.getElementsByTagName("head")[0].appendChild(link)}(function(){function loadScript(url){const script=document.createElement("script");script.src=url;document.head.append(script)}getSettingsButton().onclick=event=>{addClass(getSettingsButton(),"rotate");event.preventDefault();loadCss("settings");loadScript(resourcePath("settings",".js"))};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},hideResults:()=>{switchDisplayedElement(null);document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(resourcePath("search",".js"));loadScript(resourcePath("search-index",".js"))}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search);loadSearch()}},};function getPageId(){if(window.location.hash){const tmp=window.location.hash.replace(/^#/,"");if(tmp.length>0){return tmp}}return null}const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}expandSection(savedHash.slice(1))}}function onHashChange(ev){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown");handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function getHelpElement(build){if(build){buildHelperPopup()}return document.getElementById("help")}function displayHelp(display,ev,help){if(display){help=help?help:getHelpElement(true);if(hasClass(help,"hidden")){ev.preventDefault();removeClass(help,"hidden");addClass(document.body,"blur")}}else{help=help?help:getHelpElement(false);if(help&&!hasClass(help,"hidden")){ev.preventDefault();addClass(help,"hidden");removeClass(document.body,"blur")}}}function handleEscape(ev){searchState.clearInputTimeout();const help=getHelpElement(false);if(help&&!hasClass(help,"hidden")){displayHelp(false,ev,help)}else{switchDisplayedElement(null);if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}ev.preventDefault()}searchState.defocus();window.hideSettings()}const disableShortcuts=getSettingValue("disable-shortcuts")==="true";function handleShortcut(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":displayHelp(false,ev);ev.preventDefault();searchState.focus();break;case"+":case"-":ev.preventDefault();toggleAllDocs();break;case"?":displayHelp(true,ev);break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const div=document.createElement("div");div.className="block "+shortty;const h3=document.createElement("h3");h3.innerHTML=`${longty}`;div.appendChild(h3);const ul=document.createElement("ul");for(const item of filtered){const name=item[0];const desc=item[1];let klass=shortty;let path;if(shortty==="mod"){path=name+"/index.html"}else{path=shortty+"."+name+".html"}const current_page=document.location.href.split("/").pop();if(path===current_page){klass+=" current"}const link=document.createElement("a");link.href=path;link.title=desc;link.className=klass;link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}div.appendChild(ul);sidebar.appendChild(div)}if(sidebar){const isModule=hasClass(document.body,"mod");if(!isModule){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("union","unions","Unions");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Definitions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("traitalias","trait-aliases","Trait Aliases")}}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector("h1.fqn > .in-band > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const ignoreExternCrates=document.querySelector("script[data-ignore-extern-crates]").getAttribute("data-ignore-extern-crates");for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.indexOf(lib)!==-1){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct.synthetic?synthetic_implementors:implementors;if(struct.synthetic){for(const struct_type of struct.types){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct.text;addClass(code,"code-header");addClass(code,"in-band");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&href.indexOf("http")!==0){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const div=document.createElement("div");div.className="block crate";div.innerHTML="

Crates

";const ul=document.createElement("ul");div.appendChild(ul);for(const crate of window.ALL_CRATES){let klass="crate";if(window.rootPath!=="./"&&crate===window.currentCrate){klass+=" current"}const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";link.className=klass;link.textContent=crate;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(div)}function labelForToggleButton(sectionIsCollapsed){if(sectionIsCollapsed){return"+"}return"\u2212"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}let sectionIsCollapsed=false;if(hasClass(innerToggle,"will-expand")){removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(!hasClass(e,"type-contents-toggle")){e.open=true}});innerToggle.title="collapse all docs"}else{addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});sectionIsCollapsed=true;innerToggle.title="expand all docs"}innerToggle.children[0].innerText=labelForToggleButton(sectionIsCollapsed)}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("rustdoc-toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}});const pageId=getPageId();if(pageId!==null){expandSection(pageId)}}());(function(){let lineNumbersFunc=()=>{};if(getSettingValue("line-numbers")==="true"){lineNumbersFunc=x=>{const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{if(hasClass(e,"compile_fail")){e.addEventListener("mouseover",function(){this.parentElement.previousElementSibling.childNodes[0].style.color="#f00"});e.addEventListener("mouseout",function(){this.parentElement.previousElementSibling.childNodes[0].style.color=""})}else if(hasClass(e,"ignore")){e.addEventListener("mouseover",function(){this.parentElement.previousElementSibling.childNodes[0].style.color="#ff9200"});e.addEventListener("mouseout",function(){this.parentElement.previousElementSibling.childNodes[0].style.color=""})}lineNumbersFunc(e)})}());function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}function handleClick(id,f){const elem=document.getElementById(id);if(elem){elem.addEventListener("click",f)}}handleClick("help-button",ev=>{displayHelp(true,ev)});handleClick(MAIN_ID,()=>{hideSidebar()});onEachLazy(document.getElementsByTagName("a"),el=>{if(el.hash){el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})}});onEachLazy(document.querySelectorAll(".rustdoc-toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});onEachLazy(document.getElementsByClassName("notable-traits"),e=>{e.onclick=function(){this.getElementsByClassName("notable-traits-tooltiptext")[0].classList.toggle("force-tooltip")}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){addClass(sidebar,"shown")}else{removeClass(sidebar,"shown")}})}let buildHelperPopup=()=>{const popup=document.createElement("aside");addClass(popup,"hidden");popup.id="help";popup.addEventListener("click",ev=>{if(ev.target===popup){displayHelp(false,ev)}});const book_info=document.createElement("span");book_info.className="top";book_info.innerHTML="You can find more information in \ + the rustdoc book.";const container=document.createElement("div");const shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=["Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + * -> vec)","Search multiple things at once by splitting your query with comma (e.g., \ + str,u8 or String,struct:Vec,test)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;container.appendChild(book_info);container.appendChild(div_shortcuts);container.appendChild(div_infos);const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);container.appendChild(rustdoc_version);popup.appendChild(container);insertAfter(popup,document.querySelector("main"));buildHelperPopup=()=>{}};setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){let reset_button_timeout=null;window.copy_path=but=>{const parent=but.parentElement;const path=[];onEach(parent.childNodes,child=>{if(child.tagName==="A"){path.push(child.textContent)}});const el=document.createElement("textarea");el.value=path.join("::");el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);but.children[0].style.display="none";let tmp;if(but.childNodes.length<2){tmp=document.createTextNode("✓");but.appendChild(tmp)}else{onEachLazy(but.childNodes,e=>{if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent="✓"}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent="";reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/0.10.3/normalize.css b/0.10.3/normalize.css new file mode 100644 index 000000000..469959f13 --- /dev/null +++ b/0.10.3/normalize.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/0.10.3/noscript.css b/0.10.3/noscript.css new file mode 100644 index 000000000..d850bb381 --- /dev/null +++ b/0.10.3/noscript.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path{display:none;}.sub{display:none;} \ No newline at end of file diff --git a/0.10.3/rust-logo.svg b/0.10.3/rust-logo.svg new file mode 100644 index 000000000..62424d8ff --- /dev/null +++ b/0.10.3/rust-logo.svg @@ -0,0 +1,61 @@ + + + diff --git a/0.10.3/rustdoc.css b/0.10.3/rustdoc.css new file mode 100644 index 000000000..26904c7b8 --- /dev/null +++ b/0.10.3/rustdoc.css @@ -0,0 +1 @@ + @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;-webkit-font-feature-settings:"kern","liga";-moz-font-feature-settings:"kern","liga";font-feature-settings:"kern","liga";}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:20px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}h1.fqn{margin:0;padding:0;}.main-heading{display:flex;flex-wrap:wrap;justify-content:space-between;padding-bottom:6px;margin-bottom:15px;}.main-heading a:hover{text-decoration:underline;}#toggle-all-docs{text-decoration:none;}h2,.top-doc h3,.top-doc h4{border-bottom:1px solid;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;border-bottom-style:none;margin:0;padding:0;margin-top:0.6em;margin-bottom:0.4em;}.impl,.impl-items .method,.methods .method,.impl-items .type,.methods .type,.impl-items .associatedconstant,.methods .associatedconstant,.impl-items .associatedtype,.methods .associatedtype{flex-basis:100%;font-weight:600;position:relative;}div.impl-items>div{padding-left:0;}h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,a.source,.search-input,.search-results .result-name,.content table td:first-child>a,.item-left>a,.out-of-band,span.since,#source-sidebar,#sidebar-toggle,details.rustdoc-toggle>summary::before,div.impl-items>div:not(.docblock):not(.item-info),.content ul.crate a.crate,a.srclink,#main-content>ul.docblock>li>a{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p{margin:0 0 .75em 0;}summary{outline:none;}td,th{padding:0;}table{border-collapse:collapse;}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;}button{padding:1px 6px;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.source main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}.source .width-limiter{max-width:unset;}details:not(.rustdoc-toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;}.docblock.item-decl{margin-left:0;}.item-decl pre{overflow-x:auto;}.source .content pre{padding:20px;}img{max-width:100%;}li{position:relative;}.source .content{max-width:none;overflow:visible;margin-left:0px;}nav.sub{position:relative;font-size:1rem;}.sub-container{display:flex;flex-direction:row;flex-wrap:nowrap;}.sub-logo-container{display:none;margin-right:20px;}.source .sub-logo-container{display:block;}.source .sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.sidebar{font-size:0.875rem;width:250px;min-width:200px;overflow-y:scroll;position:sticky;height:100vh;top:0;left:0;}.sidebar-elems,.sidebar>.location{padding-left:24px;}.sidebar .location{overflow-wrap:anywhere;}.rustdoc.source .sidebar{width:50px;min-width:0px;max-width:300px;flex-grow:0;flex-shrink:0;flex-basis:auto;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;}.rustdoc.source .sidebar .sidebar-logo{display:none;}.source .sidebar>*:not(#sidebar-toggle){opacity:0;visibility:hidden;}.source-sidebar-expanded .source .sidebar{overflow-y:auto;}.source-sidebar-expanded .source .sidebar>*:not(#sidebar-toggle){opacity:1;visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;}.sidebar{scrollbar-width:thin;}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;}.hidden{display:none !important;}.sidebar .logo-container{display:flex;margin-top:10px;margin-bottom:10px;justify-content:center;}.version{overflow-wrap:break-word;}.logo-container>img{height:100px;width:100px;}.location:empty{border:none;}.location a:first-of-type{font-weight:500;}.block{padding:0;}.block ul,.block li{padding:0;margin:0;list-style:none;}.block a,h2.location a{display:block;padding:0.25rem;margin-left:-0.25rem;text-overflow:ellipsis;overflow:hidden;}.sidebar h2{border-bottom:none;font-weight:500;padding:0;margin:0;margin-top:0.7rem;margin-bottom:0.7rem;}.sidebar h3{font-size:1.125rem;font-weight:500;padding:0;margin:0;}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;}.mobile-topbar{display:none;}.source .content pre.rust{white-space:pre;overflow:auto;padding-left:0;}.rustdoc .example-wrap{display:inline-flex;margin-bottom:10px;}.example-wrap{position:relative;width:100%;}.example-wrap>pre.line-number{overflow:initial;border:1px solid;padding:13px 8px;text-align:right;border-top-left-radius:5px;border-bottom-left-radius:5px;}.example-wrap>pre.rust a:hover{text-decoration:underline;}.line-numbers{text-align:right;}.rustdoc:not(.source) .example-wrap>pre:not(.line-number){width:100%;overflow-x:auto;}.rustdoc:not(.source) .example-wrap>pre.line-numbers{width:auto;overflow-x:visible;}.rustdoc .example-wrap>pre{margin:0;}#search{position:relative;}.search-loading{text-align:center;}#results>table{width:100%;table-layout:fixed;}.content>.example-wrap pre.line-numbers{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.line-numbers span{cursor:pointer;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock-short p{display:inline;}.docblock-short p{overflow:hidden;text-overflow:ellipsis;margin:0;}.docblock>:not(pre)>code,.docblock-short>:not(pre)>code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.information):not(.more-examples-toggle){max-width:100%;overflow-x:auto;}.content .out-of-band{flex-grow:0;font-size:1.125rem;font-weight:normal;float:right;}.method>.code-header,.trait-impl>.code-header{max-width:calc(100% - 41px);display:block;}.invisible{width:100%;display:inline-block;}.content .in-band{flex-grow:1;margin:0px;padding:0px;overflow-wrap:break-word;overflow-wrap:anywhere;}.in-band>code,.in-band>.code-header{display:inline-block;}#main-content{position:relative;}#main-content>.since{top:inherit;font-family:"Fira Sans",Arial,sans-serif;}.content table:not(.table-display){border-spacing:0 5px;}.content td{vertical-align:top;}.content td:first-child{padding-right:20px;}.content td p:first-child{margin-top:0;}.content td h1,.content td h2{margin-left:0;font-size:1.125rem;}.content tr:first-child td{border-top:0;}.docblock table{margin:.5em 0;width:calc(100% - 2px);overflow-x:auto;display:block;}.docblock table td{padding:.5em;border:1px dashed;}.docblock table th{padding:.5em;text-align:left;border:1px solid;}.fields+table{margin-bottom:1em;}.content .item-list{list-style-type:none;padding:0;}.content .multi-column{-moz-column-count:5;-moz-column-gap:2.5em;-webkit-column-count:5;-webkit-column-gap:2.5em;column-count:5;column-gap:2.5em;}.content .multi-column li{width:100%;display:inline-block;}.content>.methods>.method{font-size:1rem;position:relative;}.content .method .where,.content .fn .where,.content .where.fmt-newline{display:block;font-size:0.875rem;}.content .methods>div:not(.notable-traits):not(.method){margin-left:40px;margin-bottom:15px;}.content .docblock>.impl-items{margin-left:20px;margin-top:-34px;}.content .docblock>.impl-items .table-display{margin:0;}.content .docblock>.impl-items table td{padding:0;}.content .docblock>.impl-items .table-display,.impl-items table td{border:none;}.item-info{display:block;}.content .item-info code{font-size:0.875rem;}.content .item-info{position:relative;margin-left:24px;}.sub-variant>div>.item-info{margin-top:initial;}.content .impl-items .docblock,.content .impl-items .item-info{margin-bottom:.6em;}.content .impl-items>.item-info{margin-left:40px;}.methods>.item-info,.content .impl-items>.item-info{margin-top:-8px;}.impl-items{flex-basis:100%;}#main-content>.item-info{margin-top:0;margin-left:0;}nav.sub{flex-grow:1;margin-bottom:25px;}.source nav.sub{margin-left:32px;}nav.main{padding:20px 0;text-align:center;}nav.main .current{border-top:1px solid;border-bottom:1px solid;}nav.main .separator{border:1px solid;display:inline-block;height:23px;margin:0 20px;}nav.sum{text-align:right;}nav.sub form{display:inline;}a{text-decoration:none;background:transparent;}.small-section-header{display:flex;justify-content:space-between;position:relative;}.small-section-header:hover>.anchor{display:initial;}.in-band:hover>.anchor,.impl:hover>.anchor,.method.trait-impl:hover>.anchor,.type.trait-impl:hover>.anchor,.associatedconstant.trait-impl:hover>.anchor,.associatedtype.trait-impl:hover>.anchor{display:inline-block;position:absolute;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.anchor::before{content:'§';}.docblock a:not(.srclink):not(.test-arrow):not(.scrape-help):hover,.docblock-short a:not(.srclink):not(.test-arrow):not(.scrape-help):hover,.item-info a{text-decoration:underline;}.block a.current.crate{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;}.item-row{display:table-row;}.item-left,.item-right{display:table-cell;}.item-left{padding-right:1.25rem;}.search-container{position:relative;display:flex;height:34px;}.search-container>*{height:100%;}.search-results-title{display:inline;}#search-settings{font-size:1.5rem;font-weight:500;margin-bottom:20px;}#crate-search{min-width:115px;margin-top:5px;margin-left:0.25em;padding-left:0.3125em;padding-right:23px;border:1px solid;border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;text-overflow:"";background-repeat:no-repeat;background-color:transparent;background-size:20px;background-position:calc(100% - 1px) 56%;background-image:url("down-arrow.svg");}.search-container{margin-top:4px;}.search-input{-webkit-appearance:none;-moz-box-sizing:border-box !important;box-sizing:border-box !important;outline:none;border:1px solid;border-radius:2px;padding:8px;font-size:1rem;transition:border-color 300ms ease;width:100%;}.search-results{display:none;padding-bottom:2em;}.search-results.active{display:block;clear:both;}.search-results .desc>span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;display:block;}.search-results>a{display:block;width:100%;margin-left:2px;margin-right:2px;border-bottom:1px solid #aaa3;}.search-results>a>div{display:flex;flex-flow:row wrap;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:50%;}.search-results .result-name{padding-right:1em;}.search-results .result-name>span{display:inline-block;margin:0;font-weight:normal;}body.blur>:not(#help){filter:blur(8px);-webkit-filter:blur(8px);opacity:.7;}#help{width:100%;height:100vh;position:fixed;top:0;left:0;display:flex;justify-content:center;align-items:center;}#help>div{flex:0 0 auto;box-shadow:0 0 6px rgba(0,0,0,.2);width:550px;height:auto;border:1px solid;}#help dt{float:left;clear:left;display:block;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{text-align:center;display:block;margin:10px 0;border-bottom:1px solid;padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid;}#help dd{margin:5px 35px;}#help .infos{padding-left:0;}#help h1,#help h2{margin-top:0;}#help>div div{width:50%;float:left;padding:0 20px 20px 17px;;}.item-info .stab{display:inline-block;}.stab{padding:3px;margin-bottom:5px;font-size:0.875rem;font-weight:normal;}.stab p{display:inline;}.stab .emoji{font-size:1.25rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.module-item .stab,.import-item .stab{border-radius:3px;display:inline-block;font-size:0.875rem;line-height:1.2;margin-bottom:0;margin-left:0.3125em;padding:2px;vertical-align:text-bottom;}.module-item.unstable,.import-item.unstable{opacity:0.65;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;padding-right:2px;position:initial;}.impl-items .srclink,.impl .srclink,.methods .srclink{font-weight:normal;font-size:1rem;}.rightside{float:right;}.variants_table{width:100%;}.variants_table tbody tr td:first-child{width:1%;}td.summary-column{width:100%;}.summary{padding-right:0px;}pre.rust .question-mark{font-weight:bold;}a.test-arrow{display:inline-block;visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;}.example-wrap:hover .test-arrow{visibility:visible;}a.test-arrow:hover{text-decoration:none;}.code-attribute{font-weight:300;}.item-spacer{width:100%;height:12px;}.out-of-band>span.since{position:initial;font-size:1.25rem;}h3.variant{font-weight:600;font-size:1.125rem;margin-bottom:10px;border-bottom:none;}.sub-variant h4{font-size:1rem;font-weight:400;border-bottom:none;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}.toggle-label{display:inline-block;margin-left:4px;margin-top:3px;}:target>code,:target>.code-header{opacity:1;}:target{padding-right:3px;}.information{position:absolute;left:-25px;margin-top:7px;z-index:1;}.tooltip{position:relative;display:inline-block;cursor:pointer;}.tooltip::after{display:none;text-align:center;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;font-size:1rem;}.tooltip.ignore::after{content:"This example is not tested";}.tooltip.compile_fail::after{content:"This example deliberately fails to compile";}.tooltip.should_panic::after{content:"This example panics";}.tooltip.edition::after{content:"This code runs with edition " attr(data-edition);}.tooltip::before{content:" ";position:absolute;top:50%;left:16px;margin-top:-5px;border-width:5px;border-style:solid;display:none;}.tooltip:hover::before,.tooltip:hover::after{display:inline;}.tooltip.compile_fail,.tooltip.should_panic,.tooltip.ignore{font-weight:bold;font-size:1.25rem;}.notable-traits-tooltip{display:inline-block;cursor:pointer;}.notable-traits:hover .notable-traits-tooltiptext,.notable-traits .notable-traits-tooltiptext.force-tooltip{display:inline-block;}.notable-traits .notable-traits-tooltiptext{display:none;padding:5px 3px 3px 3px;border-radius:6px;margin-left:5px;z-index:10;font-size:1rem;cursor:default;position:absolute;border:1px solid;}.notable-traits-tooltip::after{content:"\00a0\00a0\00a0";}.notable-traits .notable,.notable-traits .docblock{margin:0;}.notable-traits .notable{margin:0;margin-bottom:13px;font-size:1.1875rem;font-weight:600;display:block;}.notable-traits .docblock code.content{margin:0;padding:0;font-size:1.25rem;}pre.rust.rust-example-rendered{position:relative;}pre.rust{tab-size:4;-moz-tab-size:4;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#titles{height:35px;}#titles>button{float:left;width:33.3%;text-align:center;font-size:1.125rem;cursor:pointer;border:0;border-top:2px solid;}#titles>button:first-child:last-child{margin-right:1px;width:calc(100% - 1px);}#titles>button:not(:last-child){margin-right:1px;width:calc(33.3% - 1px);}#titles>button>div.count{display:inline-block;font-size:1rem;}.notable-traits{cursor:pointer;z-index:2;margin-left:5px;}#sidebar-toggle{position:sticky;top:0;left:0;cursor:pointer;font-weight:bold;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:center;align-items:center;z-index:10;}#source-sidebar{width:100%;z-index:1;overflow:auto;}#source-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid;margin-bottom:6px;}#settings-menu,#help-button{margin-left:4px;outline:none;}#copy-path{height:34px;}#settings-menu>a,#help-button,#copy-path{padding:5px;width:33px;border:1px solid;border-radius:2px;cursor:pointer;}#settings-menu{padding:0;}#settings-menu>a{padding:5px;width:100%;height:100%;display:block;}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}#help-button{font-family:"Fira Sans",Arial,sans-serif;text-align:center;font-size:20px;padding-top:2px;}#copy-path{background:initial;margin-left:10px;padding:0;padding-left:2px;border:0;}#theme-choices{display:none;position:absolute;left:0;top:28px;border:1px solid;border-radius:3px;z-index:1;cursor:pointer;}#theme-choices>button{border:none;width:100%;padding:4px 8px;text-align:center;background:rgba(0,0,0,0);overflow-wrap:normal;}#theme-choices>button:not(:first-child){border-top:1px solid;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px;border-radius:3px;cursor:default;}.hidden-by-impl-hider,.hidden-by-usual-hider{display:none !important;}#implementations-list>h3>span.in-band{width:100%;}.table-display{width:100%;border:0;border-collapse:collapse;border-spacing:0;font-size:1rem;}.table-display tr td:first-child{padding-right:0;}.table-display tr td:last-child{float:right;}.table-display .out-of-band{position:relative;font-size:1.125rem;display:block;}.table-display td:hover .anchor{display:block;top:2px;left:-5px;}#main-content>ul{padding-left:10px;}#main-content>ul>li{list-style:none;}.non-exhaustive{margin-bottom:1em;}div.children{padding-left:27px;display:none;}div.name{cursor:pointer;position:relative;margin-left:16px;}div.files>a{display:block;padding:0 3px;}div.files>a:hover,div.name:hover{background-color:#a14b4b;}div.name.expand+.children{display:block;}div.name::before{content:"\25B6";padding-left:4px;font-size:0.625rem;position:absolute;left:-16px;top:4px;}div.name.expand::before{transform:rotate(90deg);left:-15px;top:2px;}details.rustdoc-toggle>summary.hideme{cursor:pointer;}details.rustdoc-toggle>summary{list-style:none;}details.rustdoc-toggle>summary::-webkit-details-marker,details.rustdoc-toggle>summary::marker{display:none;}details.rustdoc-toggle>summary.hideme>span{margin-left:9px;}details.rustdoc-toggle>summary::before{content:"";cursor:pointer;width:16px;height:16px;background-repeat:no-repeat;background-position:top left;display:inline-block;vertical-align:middle;opacity:.5;}details.rustdoc-toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.rustdoc-toggle>summary.hideme::after{content:"";}details.rustdoc-toggle>summary:focus::before,details.rustdoc-toggle>summary:hover::before{opacity:1;}details.rustdoc-toggle.top-doc>summary,details.rustdoc-toggle.top-doc>summary::before,details.rustdoc-toggle.non-exhaustive>summary,details.rustdoc-toggle.non-exhaustive>summary::before{font-family:'Fira Sans';font-size:1rem;}details.non-exhaustive{margin-bottom:8px;}details.rustdoc-toggle>summary.hideme::before{position:relative;}details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.rustdoc-toggle[open] >summary.hideme{position:absolute;}details.rustdoc-toggle{position:relative;}details.rustdoc-toggle[open] >summary.hideme>span{display:none;}details.undocumented[open] >summary::before,details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{background-image:url("toggle-minus.svg");}details.undocumented>summary::before,details.rustdoc-toggle>summary::before{background-image:url("toggle-plus.svg");}details.rustdoc-toggle[open] >summary::before,details.rustdoc-toggle[open] >summary.hideme::before{width:16px;height:16px;background-repeat:no-repeat;background-position:top left;display:inline-block;content:"";}details.rustdoc-toggle[open] >summary::after,details.rustdoc-toggle[open] >summary.hideme::after{content:"Collapse";}@media (min-width:701px){.docblock>.information:first-child>.tooltip{margin-top:16px;}.source-sidebar-expanded .source .sidebar+main .width-limiter .sub-logo-container.rust-logo{display:none;}.source-sidebar-expanded .source .sidebar{width:300px;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{padding-top:0px;display:block;}main{padding-left:15px;padding-top:0px;}.rustdoc,.main-heading{flex-direction:column;}.content .out-of-band{text-align:left;margin-left:initial;padding:initial;}.content .out-of-band .since::before{content:"Since ";}#copy-path{display:none;}.sidebar .sidebar-logo,.sidebar .location{display:none;}.sidebar-elems{margin-top:1em;}.sidebar{position:fixed;top:45px;left:-1000px;margin-left:0;background-color:rgba(0,0,0,0);margin:0;padding:0;z-index:11;height:calc(100vh - 45px);}.source main,.source .sidebar{top:0;padding:0;}.sidebar.shown,.source-sidebar-expanded .source .sidebar,.sidebar:focus-within{left:0;}.rustdoc.source>.sidebar{position:fixed;margin:0;z-index:11;width:0;}.mobile-topbar .location a{padding:0;margin:0;}.mobile-topbar .location{border:none;padding:0;margin:auto 0.5em auto auto;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:24px;}.mobile-topbar .logo-container{max-height:45px;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin-left:20px;margin-top:5px;margin-bottom:5px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.source .mobile-topbar{display:none;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;}.source nav:not(.sidebar).sub{margin-left:32px;}.content{margin-left:0px;}.source .content{margin-top:10px;}#search{margin-left:0;padding:0;}.anchor{display:none !important;}.notable-traits{position:absolute;left:-22px;top:24px;}#titles>button>div.count{float:left;width:100%;}#titles{height:50px;}#sidebar-filler{position:fixed;left:45px;width:calc(100% - 45px);top:0;height:45px;z-index:-1;border-bottom:1px solid;}#main-content>details.rustdoc-toggle>summary::before,#main-content>div>details.rustdoc-toggle>summary::before{left:-11px;}#sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;text-align:center;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;cursor:pointer;font-weight:bold;border:1px solid;border-left:0;}.source-sidebar-expanded #sidebar-toggle{left:unset;top:unset;width:unset;border-top-right-radius:unset;border-bottom-right-radius:unset;}#source-sidebar{z-index:11;}#main-content>.line-numbers{margin-top:0;}.notable-traits .notable-traits-tooltiptext{left:0;top:100%;}#help-button{display:none;}.item-table{display:block;}.item-row{display:flex;flex-flow:column wrap;}.item-left,.item-right{width:100%;}.search-results>a{border-bottom:1px solid #aaa9;padding:5px 0px;}.search-results .result-name,.search-results div.desc,.search-results .result-description{width:100%;}.search-results div.desc,.search-results .result-description,.item-right{padding-left:2em;}.source-sidebar-expanded .source .sidebar{max-width:100vw;width:100vw;}details.rustdoc-toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.rustdoc-toggle>summary:not(.hideme)::before,#main-content>details.rustdoc-toggle:not(.top-doc)>summary::before,#main-content>div>details.rustdoc-toggle>summary::before{left:-11px;}}@media print{nav.sub,.content .out-of-band{display:none;}}@media (max-width:464px){#titles,#titles>button{height:73px;}#main-content>table:not(.table-display) td{word-break:break-word;width:50%;}#crate-search{border-radius:4px;}.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}.sub-container{flex-direction:column;}.sub-logo-container{align-self:center;}.source .sub-logo-container>img{height:35px;width:35px;}#sidebar-toggle{top:10px;}.source-sidebar-expanded #sidebar-toggle{top:unset;}}.method-toggle summary,.implementors-toggle summary,.impl{margin-bottom:0.75em;}.method-toggle[open]{margin-bottom:2em;}.implementors-toggle[open]{margin-bottom:2em;}#trait-implementations-list .method-toggle,#synthetic-implementations-list .method-toggle,#blanket-implementations-list .method-toggle{margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;background:transparent;border-width:1px;border-style:solid;border-radius:50px;}.scraped-example-title{font-family:'Fira Sans';}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:240px;}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;max-height:240px;padding-bottom:0;}.scraped-example:not(.expanded) .code-wrapper pre.line-numbers{overflow-x:hidden;}.scraped-example .code-wrapper .prev{position:absolute;top:0.25em;right:2.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper .next{position:absolute;top:0.25em;right:1.25em;z-index:100;cursor:pointer;}.scraped-example .code-wrapper .expand{position:absolute;top:0.25em;right:0.25em;z-index:100;cursor:pointer;}.scraped-example:not(.expanded) .code-wrapper:before{content:" ";width:100%;height:5px;position:absolute;z-index:100;top:0;}.scraped-example:not(.expanded) .code-wrapper:after{content:" ";width:100%;height:5px;position:absolute;z-index:100;bottom:0;}.scraped-example .code-wrapper .line-numbers{margin:0;padding:14px 0;}.scraped-example .code-wrapper .line-numbers span{padding:0 14px;}.scraped-example .code-wrapper .example-wrap{flex:1;overflow-x:auto;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .code-wrapper .example-wrap pre.rust{overflow-x:inherit;width:inherit;overflow-y:hidden;}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;margin-bottom:5px;cursor:pointer;}.more-examples-toggle summary,.more-examples-toggle .hide-more{font-family:'Fira Sans';}.more-scraped-examples{margin-left:5px;display:flex;flex-direction:row;}.more-scraped-examples-inner{width:calc(100% - 20px);}.toggle-line{align-self:stretch;margin-right:10px;margin-top:5px;padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;}.more-scraped-examples .scraped-example{margin-bottom:20px;}.more-scraped-examples .scraped-example:last-child{margin-bottom:0;}.example-links a{margin-top:20px;font-family:'Fira Sans';}.example-links ul{margin-bottom:0;} \ No newline at end of file diff --git a/0.10.3/search-index.js b/0.10.3/search-index.js new file mode 100644 index 000000000..715cd8132 --- /dev/null +++ b/0.10.3/search-index.js @@ -0,0 +1,5 @@ +var searchIndex = JSON.parse('{\ +"chemfiles":{"doc":"Chemfiles is a multi-language library written in modern …","t":[13,13,3,3,3,4,13,4,13,13,13,13,3,13,13,3,3,13,3,13,13,13,3,4,13,13,13,3,3,3,13,13,4,13,13,13,3,3,3,13,13,13,3,3,3,13,13,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,12,11,12,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,5,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,12,11,5,11,11,11,11,12,12,12,12,12],"n":["Amide","Aromatic","Atom","AtomMut","AtomRef","BondOrder","Bool","CellShape","ChemfilesError","ConfigurationError","Double","Double","Error","FileError","FormatError","FormatMetadata","Frame","Infinite","Match","MemoryError","Orthorhombic","OutOfBounds","PropertiesIter","Property","PropertyError","Quadruple","Quintuplet","Residue","ResidueRef","Selection","SelectionError","Single","Status","StdCppError","String","Success","Topology","TopologyRef","Trajectory","Triclinic","Triple","UTF8PathError","UnitCell","UnitCellMut","UnitCellRef","Unknown","Vector3D","add_atom","add_atom","add_atom","add_bond","add_bond","add_bond_with_order","add_bond_with_order","add_configuration","add_residue","add_residue","add_velocities","angle","angles","angles","angles_count","are_linked","atom","atom","atom_mut","atom_mut","atomic_number","atomic_type","atoms","atoms","bond_order","bond_orders","bonds","bonds","bonds_count","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","cell","cell_mut","charge","cleanup","clear_bonds","clear_bonds","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","contains","count","covalent_radius","deref","deref","deref","deref","deref","deref","deref_mut","deref_mut","description","description","dihedral","dihedrals","dihedrals_count","distance","drop","drop","drop","drop","drop","drop","drop","eq","eq","eq","eq","eq","eq","eq","evaluate","extension","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","formats_list","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_matrix","full_name","get","get","get","guess_bonds","guess_format","has_velocities","id","impropers","impropers_count","index","infinite","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into_iter","into_iter","iter","iter_atoms","last_error","len","lengths","list","mass","matrix","memory","memory_buffer","memory_reader","memory_writer","message","name","name","name","ne","ne","ne","ne","new","new","new","new","new","new","new","next","nsteps","open","open_with_format","out_of_plane","partial_cmp","partial_cmp","path","positions","positions","positions_mut","properties","properties","properties","read","read","read_step","reference","remove","remove","remove_bond","remove_bond","residue","residue_for_atom","residues","residues_count","resize","resize","set","set","set","set_angles","set_atomic_type","set_cell","set_cell","set_charge","set_lengths","set_mass","set_name","set_shape","set_step","set_topology","set_topology","set_topology_file","set_topology_with_format","set_warning_callback","shape","size","size","size","size","size_hint","status","step","string","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","topology","triclinic","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","unit_cell","vdw_radius","velocities","velocities","velocities_mut","version","volume","with_id","wrap","write","write","0","0","0","0"],"q":["chemfiles","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","chemfiles::Property","","",""],"d":["Amide bond (required by some file formats)","Aromatic bond (required by some file formats)","An Atom is a particle in the current Frame. It stores the …","An analog to a mutable reference to an atom (&mut Atom)","An analog to a reference to an atom (&Atom)","Possible bond order associated with bonds","Boolean property","Available unit cell shapes.","Exception in the C++ chemfiles library","Error in configuration files syntax","Double bond","Floating point property","Error type for Chemfiles.","Error while reading or writing a file","Error in file formatting, i.e. the file is invalid","FormatMetadata contains metadata associated with one …","A Frame contains data from one simulation step: the …","Infinite cell, to use when there is no cell.","A Match is a set of atomic indexes matching a given …","Error in memory allocations","Orthorhombic cell, with the three angles equals to 90°.","Error for out of bounds indexing","An iterator over the properties in an atom/frame/residue","A Property is a piece of data that can be associated with …","Error related to properties","Quadruple bond (present in some metals)","Quintuplet bond (present in some metals)","A Residue is a group of atoms belonging to the same …","An analog to a reference to a residue (&Residue)","A Selection allow to select atoms in a Frame, from a …","Error in selection string syntax","Single bond","Possible causes of error in chemfiles","Exception in the C++ standard library","String property","No error","A Topology contains the definition of all the atoms in the …","An analog to a reference to a topology (&Topology)","The Trajectory type is the main entry point when using …","Triclinic cell, with any values for the angles.","Triple bond","The given path is not valid UTF8","An UnitCell represent the box containing the atoms, and …","An analog to a mutable reference to an unit cell (…","An analog to a reference to an unit cell (&UnitCell)","Unknown or unspecified bond order","3-dimensional vector property","Add the atom at index atom in this residue.","Add an Atom at the end of this topology","Add an Atom and the corresponding position and optionally …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Read configuration data from the file at path.","Add a residue to this topology.","Add a copy of residue to this frame.","Add velocity data to this frame. If the frame already have …","Get the angle formed by the atoms at indexes i, j and k in …","Get the three angles of the cell, in degrees.","Get the list of angles in the topology.","Get the number of angles in the topology.","Check if the two residues first and second from the …","Get a reference of the atom at the given index in this …","Get a reference to the atom at the given index in this …","Get a mutable reference to the atom at the given index in …","Get a mutable reference to the atom at the given index in …","Try to get the atomic number of the atom from the atomic …","Get the atom type.","Get the list of atoms of this residue.","Does this format support storing atom names or types?","Get the bond order for the bond between the atoms at …","Get the bond order for all the bonds in the topology","Get the list of bonds in the topology.","Does this format support storing bonds between atoms?","Get the number of bonds in the topology.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get a reference to the UnitCell from this frame.","Get a mutable reference to the UnitCell from this frame.","Get the atom charge, in number of the electron charge e.","Clear any error from the C++ library","Remove all existing bonds, angles, dihedral angles and …","Remove all existing bonds, angles, dihedral angles and …","","","","","","","","","","","","","","","","","","","","","","","","","","","","Check if the atom at index i is in this residue","","Try to get the covalent radius of the atom from the atomic …","","","","","","","","","","Extended, user-facing description of the format.","Get the dihedral angle formed by the atoms at indexes i, j…","Get the list of dihedral angles in the topology.","Get the number of dihedral angles in the topology.","Get the distance between the atoms at indexes i and j in …","","","","","","","","","","","","","","","Evaluate a selection for a given frame, and return the …","Extension associated with the format.","","","","","","","","","Get the list of formats known by chemfiles, as well as all …","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","Returns the argument unchanged.","Create an UnitCell from a cell matrix. If matrix contains …","Try to get the full name of the atom from the atomic type. …","Get a property with the given name in this atom, if it …","Get a property with the given name in this frame, if it …","Get a property with the given name in this frame, if it …","Guess the bonds, angles and dihedrals in this frame.","Get the format that chemfiles would use to read a file at …","Check if this frame contains velocity data.","Get the identifier of this residue in the initial topology …","Get the list of improper dihedral angles in the topology.","Get the number of improper dihedral angles in the topology.","","Create an Infinite UnitCell.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","Iterate over the atomic indexes in the match.","Gets an iterator over atoms","Get the last error message from the C++ library.","Get the length of the Match.","Get the three lengths of the cell, in Angstroms.","Evaluates a selection of size 1 on a given frame. This …","Get the atom mass, in atomic mass units.","Get the unit cell matricial representation.","Does this format support in-memory IO?","Obtain the memory buffer written to by the trajectory.","Read a memory buffer as though it was a formatted file.","Write to a memory buffer as though it was a formatted file.","A message describing the error cause","Get the atom name.","Get the name of this residue.","Name of the format.","","","","","Create an atom with the given name, and set the atom type …","Create an Orthorhombic UnitCell from the three lengths, in …","Create a new residue with the given name","Create a new empty topology.","Create an empty frame. It will be resized by the library …","Create a new selection from the given selection string.","Create a new match containing the atoms in the atoms slice.","","Get the number of steps (the number of frames) in a …","Open the file at the given path in the given mode.","Open the file at the given path using a specific file …","Get the out of plane distance formed by the atoms at …","","","Get file path for this trajectory.","Get a view into the positions of this frame.","Does this format support storing atomic positions?","Get a mutable view into the positions of this frame.","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Read the next step of this trajectory into a frame.","Is reading files in this format implemented?","Read a specific step of this trajectory into a frame.","URL pointing to the format definition/reference.","Remove an Atom from this topology by index. This modify …","Remove the atom at index i in this frame.","Remove any existing bond between the atoms at indexes i …","Remove any existing bond between the atoms at indexes i …","Get a reference to the residue at index index from this …","Get a copy of the residue containing the atom at index …","Does this format support storing residues?","Get the number of residues in this topology.","Resize this topology to hold natoms atoms, inserting dummy …","Resize the positions and the velocities in this frame, to …","Add a new property with the given name to this atom.","Add a new property with the given name to this residue.","Add a new property with the given name to this frame.","Set the three angles of the cell, in degrees.","Set the atom type to atomic_type.","Set the UnitCell of this frame to cell.","Set the unit cell associated with a trajectory. This cell …","Set the atom charge to charge, in number of the electron …","Set the three lengths of the cell, in Angstroms.","Set the atom mass to mass, in atomic mass units.","Set the atom name to name.","Set the shape of the unit cell to shape.","Set this frame step to step.","Set the Topology of this frame to topology.","Set the topology associated with this trajectory. This …","Set the topology associated with this trajectory by …","Set the topology associated with this trajectory by …","Use callback for every chemfiles warning. The callback …","Get the shape of the unit cell.","Get the number of atoms in this residue.","Get the current number of atoms in this topology.","Get the current number of atoms in this frame.","Get the size of the selection, i.e. the number of atoms we …","","The error status code","Get this frame step, i.e. the frame number in the …","Get the selection string used to create this selection.","","","","","","","","","","","","","","","Get a reference to the Topology of this frame.","Create an Triclinic UnitCell from the three lengths (in …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Does this format support storing unit cell information?","Try to get the Van der Waals radius of the atom from the …","Get a view into the velocities of this frame.","Does this format support storing atomic velocities?","Get a mutable view into the velocities of this frame.","Get the version of the chemfiles library.","Get the volume of the unit cell.","Create a new residue with the given name and id as …","Wrap a vector in this unit cell.","Write a frame to this trajectory.","Is writing files in this format implemented?","","","",""],"i":[1,1,0,0,0,0,2,0,3,3,1,2,0,3,3,0,0,4,0,3,4,3,0,0,3,1,1,0,0,0,3,1,0,3,2,3,0,0,0,4,1,3,0,0,0,1,2,5,6,7,6,7,6,7,0,6,7,7,7,8,6,6,6,6,7,6,7,9,9,5,10,6,6,6,10,6,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,7,7,9,20,6,7,9,8,5,6,7,18,20,3,4,1,21,2,10,9,8,5,6,7,18,20,3,4,1,21,2,10,1,5,19,9,11,12,13,14,15,16,12,14,20,10,7,6,6,7,9,8,5,6,7,17,18,20,3,4,1,21,2,10,18,10,20,20,3,4,1,21,2,10,0,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,20,20,3,4,4,1,1,21,2,2,2,2,2,2,10,8,9,9,5,7,7,0,7,5,6,6,21,8,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,19,21,21,7,20,21,8,18,9,8,10,17,17,17,20,9,5,10,20,21,2,10,9,8,5,6,7,18,21,19,17,17,17,7,1,2,17,7,10,7,9,5,7,17,10,17,10,6,7,6,7,6,6,10,6,6,7,9,5,7,8,9,7,17,9,8,9,9,8,7,7,17,17,17,0,8,5,6,7,18,19,20,7,18,9,8,5,6,7,18,20,3,4,1,21,2,10,20,7,8,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,9,11,12,8,13,14,5,15,6,16,7,17,18,19,20,3,4,1,21,2,10,10,9,7,10,7,0,8,5,8,17,10,22,23,24,25],"f":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[[["residue",3],["usize",0]]],[[["topology",3],["atom",3]]],[[["frame",3],["atom",3],["into",8,[["option",4]]]]],[[["topology",3],["usize",0],["usize",0]]],[[["frame",3],["usize",0],["usize",0]]],[[["topology",3],["usize",0],["usize",0],["bondorder",4]]],[[["frame",3],["usize",0],["usize",0],["bondorder",4]]],[[],["result",4,[["error",3]]]],[[["topology",3],["residue",3]],["result",4,[["error",3]]]],[[["frame",3],["residue",3]],["result",4,[["error",3]]]],[[["frame",3]]],[[["frame",3],["usize",0],["usize",0],["usize",0]],["f64",0]],[[["unitcell",3]]],[[["topology",3]],["vec",3]],[[["topology",3]],["usize",0]],[[["topology",3],["residue",3],["residue",3]],["bool",0]],[[["topology",3],["usize",0]],["atomref",3]],[[["frame",3],["usize",0]],["atomref",3]],[[["topology",3],["usize",0]],["atommut",3]],[[["frame",3],["usize",0]],["atommut",3]],[[["atom",3]],["u64",0]],[[["atom",3]],["string",3]],[[["residue",3]],["vec",3,[["usize",0]]]],null,[[["topology",3],["usize",0],["usize",0]],["bondorder",4]],[[["topology",3]],["vec",3,[["bondorder",4]]]],[[["topology",3]],["vec",3]],null,[[["topology",3]],["usize",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["",0]],["",0]],[[["frame",3]],["unitcellref",3]],[[["frame",3]],["unitcellmut",3]],[[["atom",3]],["f64",0]],[[]],[[["topology",3]]],[[["frame",3]]],[[["atom",3]],["atom",3]],[[["unitcell",3]],["unitcell",3]],[[["residue",3]],["residue",3]],[[["topology",3]],["topology",3]],[[["frame",3]],["frame",3]],[[["selection",3]],["selection",3]],[[["error",3]],["error",3]],[[["status",4]],["status",4]],[[["cellshape",4]],["cellshape",4]],[[["bondorder",4]],["bondorder",4]],[[["match",3]],["match",3]],[[["property",4]],["property",4]],[[["formatmetadata",3]],["formatmetadata",3]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["",0],["",0]]],[[["bondorder",4],["bondorder",4]],["ordering",4]],[[["residue",3],["usize",0]],["bool",0]],[[["propertiesiter",3]],["usize",0]],[[["atom",3]],["f64",0]],[[["atomref",3]],["atom",3]],[[["atommut",3]],["atom",3]],[[["unitcellref",3]],["unitcell",3]],[[["unitcellmut",3]],["unitcell",3]],[[["residueref",3]],["residue",3]],[[["topologyref",3]],["topology",3]],[[["atommut",3]],["atom",3]],[[["unitcellmut",3]],["unitcell",3]],[[["error",3]],["str",0]],null,[[["frame",3],["usize",0],["usize",0],["usize",0],["usize",0]],["f64",0]],[[["topology",3]],["vec",3]],[[["topology",3]],["usize",0]],[[["frame",3],["usize",0],["usize",0]],["f64",0]],[[["atom",3]]],[[["unitcell",3]]],[[["residue",3]]],[[["topology",3]]],[[["frame",3]]],[[["trajectory",3]]],[[["selection",3]]],[[["error",3],["error",3]],["bool",0]],[[["status",4],["status",4]],["bool",0]],[[["cellshape",4],["cellshape",4]],["bool",0]],[[["bondorder",4],["bondorder",4]],["bool",0]],[[["match",3],["match",3]],["bool",0]],[[["property",4],["property",4]],["bool",0]],[[["formatmetadata",3],["formatmetadata",3]],["bool",0]],[[["selection",3],["frame",3]],["vec",3,[["match",3]]]],null,[[["error",3],["formatter",3]],["result",6]],[[["error",3],["formatter",3]],["result",4,[["error",3]]]],[[["status",4],["formatter",3]],["result",6]],[[["cellshape",4],["formatter",3]],["result",6]],[[["bondorder",4],["formatter",3]],["result",6]],[[["match",3],["formatter",3]],["result",6]],[[["property",4],["formatter",3]],["result",6]],[[["formatmetadata",3],["formatter",3]],["result",6]],[[],["vec",3,[["formatmetadata",3]]]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["utf8error",3]],["error",3]],[[]],[[["chfl_status",4]],["error",3]],[[]],[[]],[[["chfl_cellshape",4]],["cellshape",4]],[[["chfl_bond_order",4]],["bondorder",4]],[[]],[[]],[[]],[[["string",3]],["property",4]],[[["f64",0]],["property",4]],[[["str",0]],["property",4]],[[],["property",4]],[[["bool",0]],["property",4]],[[]],[[],["unitcell",3]],[[["atom",3]],["string",3]],[[["atom",3],["str",0]],["option",4,[["property",4]]]],[[["residue",3],["str",0]],["option",4,[["property",4]]]],[[["frame",3],["str",0]],["option",4,[["property",4]]]],[[["frame",3]],["result",4,[["error",3]]]],[[["str",0]],["string",3]],[[["frame",3]],["bool",0]],[[["residue",3]],["option",4,[["i64",0]]]],[[["topology",3]],["vec",3]],[[["topology",3]],["usize",0]],[[["match",3],["usize",0]]],[[],["unitcell",3]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[["match",3]],["iter",3,[["usize",0]]]],[[["match",3]],["iter",3,[["usize",0]]]],[[["frame",3]],["atomiter",3]],[[],["string",3]],[[["match",3]],["usize",0]],[[["unitcell",3]]],[[["selection",3],["frame",3]],["vec",3,[["usize",0]]]],[[["atom",3]],["f64",0]],[[["unitcell",3]]],null,[[["trajectory",3]],["result",4,[["str",0],["error",3]]]],[[],["result",4,[["trajectory",3],["error",3]]]],[[],["result",4,[["trajectory",3],["error",3]]]],null,[[["atom",3]],["string",3]],[[["residue",3]],["string",3]],null,[[["error",3],["error",3]],["bool",0]],[[["match",3],["match",3]],["bool",0]],[[["property",4],["property",4]],["bool",0]],[[["formatmetadata",3],["formatmetadata",3]],["bool",0]],[[["into",8,[["str",0]]]],["atom",3]],[[],["unitcell",3]],[[["into",8,[["str",0]]]],["residue",3]],[[],["topology",3]],[[],["frame",3]],[[["into",8,[["str",0]]]],["result",4,[["selection",3],["error",3]]]],[[],["match",3]],[[["propertiesiter",3]],["option",4]],[[["trajectory",3]],["usize",0]],[[["char",0]],["result",4,[["trajectory",3],["error",3]]]],[[["char",0]],["result",4,[["trajectory",3],["error",3]]]],[[["frame",3],["usize",0],["usize",0],["usize",0],["usize",0]],["f64",0]],[[["bondorder",4],["bondorder",4]],["option",4,[["ordering",4]]]],[[["property",4],["property",4]],["option",4,[["ordering",4]]]],[[["trajectory",3]],["string",3]],[[["frame",3]]],null,[[["frame",3]]],[[["atom",3]],["propertiesiter",3]],[[["residue",3]],["propertiesiter",3]],[[["frame",3]],["propertiesiter",3]],[[["trajectory",3],["frame",3]],["result",4,[["error",3]]]],null,[[["trajectory",3],["usize",0],["frame",3]],["result",4,[["error",3]]]],null,[[["topology",3],["usize",0]]],[[["frame",3],["usize",0]]],[[["topology",3],["usize",0],["usize",0]]],[[["frame",3],["usize",0],["usize",0]]],[[["topology",3],["u64",0]],["option",4,[["residueref",3]]]],[[["topology",3],["usize",0]],["option",4,[["residueref",3]]]],null,[[["topology",3]],["u64",0]],[[["topology",3],["usize",0]]],[[["frame",3],["usize",0]]],[[["atom",3],["str",0],["into",8,[["property",4]]]]],[[["residue",3],["str",0],["into",8,[["property",4]]]]],[[["frame",3],["str",0],["into",8,[["property",4]]]]],[[["unitcell",3]],["result",4,[["error",3]]]],[[["atom",3],["into",8,[["str",0]]]]],[[["frame",3],["unitcell",3]]],[[["trajectory",3],["unitcell",3]]],[[["atom",3],["f64",0]]],[[["unitcell",3]],["result",4,[["error",3]]]],[[["atom",3],["f64",0]]],[[["atom",3],["into",8,[["str",0]]]]],[[["unitcell",3],["cellshape",4]],["result",4,[["error",3]]]],[[["frame",3],["usize",0]]],[[["frame",3],["topology",3]],["result",4,[["error",3]]]],[[["trajectory",3],["topology",3]]],[[["trajectory",3]],["result",4,[["error",3]]]],[[["trajectory",3]],["result",4,[["error",3]]]],[[]],[[["unitcell",3]],["cellshape",4]],[[["residue",3]],["usize",0]],[[["topology",3]],["usize",0]],[[["frame",3]],["usize",0]],[[["selection",3]],["usize",0]],[[["propertiesiter",3]]],null,[[["frame",3]],["usize",0]],[[["selection",3]],["string",3]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]]],[[["",0]],["string",3]],[[["frame",3]],["topologyref",3]],[[],["unitcell",3]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[],["result",4]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],[[["",0]],["typeid",3]],null,[[["atom",3]],["f64",0]],[[["frame",3]],["option",4]],null,[[["frame",3]],["option",4]],[[],["string",3]],[[["unitcell",3]],["f64",0]],[[["into",8,[["str",0]]],["i64",0]],["residue",3]],[[["unitcell",3]]],[[["trajectory",3],["frame",3]],["result",4,[["error",3]]]],null,null,null,null,null],"p":[[4,"BondOrder"],[4,"Property"],[4,"Status"],[4,"CellShape"],[3,"Residue"],[3,"Topology"],[3,"Frame"],[3,"UnitCell"],[3,"Atom"],[3,"FormatMetadata"],[3,"AtomRef"],[3,"AtomMut"],[3,"UnitCellRef"],[3,"UnitCellMut"],[3,"ResidueRef"],[3,"TopologyRef"],[3,"Trajectory"],[3,"Selection"],[3,"PropertiesIter"],[3,"Error"],[3,"Match"],[13,"Bool"],[13,"Double"],[13,"String"],[13,"Vector3D"]]}\ +}'); +if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; +if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; diff --git a/0.10.3/search.js b/0.10.3/search.js new file mode 100644 index 000000000..8fd46df61 --- /dev/null +++ b/0.10.3/search.js @@ -0,0 +1 @@ +"use strict";(function(){const itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias",];const TY_PRIMITIVE=itemTypes.indexOf("primitive");const TY_KEYWORD=itemTypes.indexOf("keyword");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";function hasOwnPropertyRustdoc(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("titles").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb}else if(nb!==0){printTab(0)}}const levenshtein_row2=[];function levenshtein(s1,s2){if(s1===s2){return 0}const s1_len=s1.length,s2_len=s2.length;if(s1_len&&s2_len){let i1=0,i2=0,a,b,c,c2;const row=levenshtein_row2;while(i1-".indexOf(c)!==-1}function isStopCharacter(c){return isWhitespace(c)||isEndCharacter(c)}function isErrorCharacter(c){return"()".indexOf(c)!==-1}function itemTypeFromName(typename){for(let i=0,len=itemTypes.length;i0){throw new Error("Cannot use literal search when there is more than one element")}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw new Error("Unclosed `\"`")}else if(parserState.userQuery[end]!=="\""){throw new Error(`Unexpected \`${parserState.userQuery[end]}\` in a string element`)}else if(start===end){throw new Error("Cannot have empty string element")}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","||isWhitespaceCharacter(c)}function isWhitespaceCharacter(c){return c===" "||c==="\t"}function createQueryElement(query,parserState,name,generics,isInGenerics){if(name==="*"||(name.length===0&&generics.length===0)){return}if(query.literalSearch&&parserState.totalElems-parserState.genericsElems>0){throw new Error("You cannot have more than one element if you use quotes")}const pathSegments=name.split("::");if(pathSegments.length>1){for(let i=0,len=pathSegments.length;i=end){throw new Error("Found generics without a path")}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}if(start>=end&&generics.length===0){return}elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;while(parserState.pos"){extra="`<`"}else if(endChar===""){extra="`->`"}throw new Error("Unexpected `"+c+"` after "+extra)}if(!foundStopChar){if(endChar!==""){throw new Error(`Expected \`,\`, \` \` or \`${endChar}\`, found \`${c}\``)}throw new Error(`Expected \`,\` or \` \`, found \`${c}\``)}const posBefore=parserState.pos;getNextElem(query,parserState,elems,endChar===">");if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}parserState.pos+=1}function checkExtraTypeFilterCharacters(parserState){const query=parserState.userQuery;for(let pos=0;pos"){if(isReturnArrow(parserState)){break}throw new Error(`Unexpected \`${c}\` (did you mean \`->\`?)`)}throw new Error(`Unexpected \`${c}\``)}else if(c===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw new Error("Unexpected `:`")}if(query.elems.length===0){throw new Error("Expected type filter before `:`")}else if(query.elems.length!==1||parserState.totalElems!==1){throw new Error("Unexpected `:`")}else if(query.literalSearch){throw new Error("You cannot use quotes on type filter")}checkExtraTypeFilterCharacters(parserState);parserState.typeFilter=query.elems.pop().name;parserState.pos+=1;parserState.totalElems=0;query.literalSearch=false;foundStopChar=true;continue}if(!foundStopChar){if(parserState.typeFilter!==null){throw new Error(`Expected \`,\`, \` \` or \`->\`, found \`${c}\``)}throw new Error(`Expected \`,\`, \` \`, \`:\` or \`->\`, found \`${c}\``)}before=query.elems.length;getNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}while(parserState.pos`")}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),typeFilter:NO_TYPE_FILTER,elems:[],returned:[],foundElems:0,literalSearch:false,error:null,}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="All crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return null}function parseQuery(userQuery){userQuery=userQuery.trim();const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);if(parserState.typeFilter!==null){let typeFilter=parserState.typeFilter;if(typeFilter==="const"){typeFilter="constant"}query.typeFilter=itemTypeFromName(typeFilter)}}catch(err){query=newParsedQuery(userQuery);query.error=err.message;query.typeFilter=-1;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,searchWords,filterCrates,currentCrate){const results_others={},results_in_args={},results_returned={};function transformResults(results){const duplicates={};const out=[];for(const result of results){if(result.id>-1){const obj=searchIndex[result.id];obj.lev=result.lev;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates[obj.fullPath]){continue}duplicates[obj.fullPath]=true;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){const userQuery=parsedQuery.userQuery;const ar=[];for(const entry in results){if(hasOwnPropertyRustdoc(results,entry)){const result=results[entry];result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};ar.push(result)}}results=ar;if(results.length===0){return[]}results.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.lev);b=(bbb.lev);if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});let nameSplit=null;if(parsedQuery.elems.length===1){const hasPath=typeof parsedQuery.elems[0].path==="undefined";nameSplit=hasPath?null:parsedQuery.elems[0].path}for(const result of results){if(result.dontValidate){continue}const name=result.item.name.toLowerCase(),path=result.item.path.toLowerCase(),parent=result.item.parent;if(!isType&&!validateResult(name,path,nameSplit,parent)){result.id=-1}}return transformResults(results)}function checkGenerics(row,elem,defaultLev){if(row.length<=GENERICS_DATA||row[GENERICS_DATA].length===0){return elem.generics.length===0?defaultLev:MAX_LEV_DISTANCE+1}else if(row[GENERICS_DATA].length>0&&row[GENERICS_DATA][0][NAME]===""){if(row.length>GENERICS_DATA){return checkGenerics(row[GENERICS_DATA][0],elem,defaultLev)}return elem.generics.length===0?defaultLev:MAX_LEV_DISTANCE+1}let elem_name;if(elem.generics.length>0&&row[GENERICS_DATA].length>=elem.generics.length){const elems=Object.create(null);for(const entry of row[GENERICS_DATA]){elem_name=entry[NAME];if(elem_name===""){if(checkGenerics(entry,elem,MAX_LEV_DISTANCE+1)!==0){return MAX_LEV_DISTANCE+1}continue}if(elems[elem_name]===undefined){elems[elem_name]=0}elems[elem_name]+=1}for(const generic of elem.generics){let match=null;if(elems[generic.name]){match=generic.name}else{for(elem_name in elems){if(!hasOwnPropertyRustdoc(elems,elem_name)){continue}if(elem_name===generic){match=elem_name;break}}}if(match===null){return MAX_LEV_DISTANCE+1}elems[match]-=1;if(elems[match]===0){delete elems[match]}}return 0}return MAX_LEV_DISTANCE+1}function checkIfInGenerics(row,elem){let lev=MAX_LEV_DISTANCE+1;for(const entry of row[GENERICS_DATA]){lev=Math.min(checkType(entry,elem,true),lev);if(lev===0){break}}return lev}function checkType(row,elem,literalSearch){if(row[NAME].length===0){if(row.length>GENERICS_DATA){return checkIfInGenerics(row,elem)}return MAX_LEV_DISTANCE+1}let lev=levenshtein(row[NAME],elem.name);if(literalSearch){if(lev!==0){if(elem.generics.length===0){const checkGeneric=(row.length>GENERICS_DATA&&row[GENERICS_DATA].length>0);if(checkGeneric&&row[GENERICS_DATA].findIndex(tmp_elem=>tmp_elem[NAME]===elem.name)!==-1){return 0}}return MAX_LEV_DISTANCE+1}else if(elem.generics.length>0){return checkGenerics(row,elem,MAX_LEV_DISTANCE+1)}return 0}else if(row.length>GENERICS_DATA){if(elem.generics.length===0){if(lev===0){return 0}lev=checkIfInGenerics(row,elem);return lev+0.5}else if(lev>MAX_LEV_DISTANCE){return checkIfInGenerics(row,elem)}else{const tmp_lev=checkGenerics(row,elem,lev);if(tmp_lev>MAX_LEV_DISTANCE){return MAX_LEV_DISTANCE+1}return(tmp_lev+lev)/2}}else if(elem.generics.length>0){return MAX_LEV_DISTANCE+1}return lev}function findArg(row,elem,typeFilter){let lev=MAX_LEV_DISTANCE+1;if(row&&row.type&&row.type[INPUTS_DATA]&&row.type[INPUTS_DATA].length>0){for(const input of row.type[INPUTS_DATA]){if(!typePassesFilter(typeFilter,input[1])){continue}lev=Math.min(lev,checkType(input,elem,parsedQuery.literalSearch));if(lev===0){return 0}}}return parsedQuery.literalSearch?MAX_LEV_DISTANCE+1:lev}function checkReturned(row,elem,typeFilter){let lev=MAX_LEV_DISTANCE+1;if(row&&row.type&&row.type.length>OUTPUT_DATA){let ret=row.type[OUTPUT_DATA];if(typeof ret[0]==="string"){ret=[ret]}for(const ret_ty of ret){if(!typePassesFilter(typeFilter,ret_ty[1])){continue}lev=Math.min(lev,checkType(ret_ty,elem,parsedQuery.literalSearch));if(lev===0){return 0}}}return parsedQuery.literalSearch?MAX_LEV_DISTANCE+1:lev}function checkPath(contains,ty){if(contains.length===0){return 0}let ret_lev=MAX_LEV_DISTANCE+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;if(clength>length){return MAX_LEV_DISTANCE+1}for(let i=0;ilength){break}let lev_total=0;let aborted=false;for(let x=0;xMAX_LEV_DISTANCE){aborted=true;break}lev_total+=lev}if(!aborted){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES[filterCrates]&&ALIASES[filterCrates][lowerQuery]){const query_aliases=ALIASES[filterCrates][lowerQuery];for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{Object.keys(ALIASES).forEach(crate=>{if(ALIASES[crate][lowerQuery]){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=ALIASES[crate][lowerQuery];for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}})}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,lev){if(lev===0||(!parsedQuery.literalSearch&&lev<=MAX_LEV_DISTANCE)){if(results[fullId]!==undefined){const result=results[fullId];if(result.dontValidate||result.lev<=lev){return}}results[fullId]={id:id,index:index,dontValidate:parsedQuery.literalSearch,lev:lev,}}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let lev,lev_add=0,index=-1;const fullId=row.id;const in_args=findArg(row,elem,parsedQuery.typeFilter);const returned=checkReturned(row,elem,parsedQuery.typeFilter);addIntoResults(results_in_args,fullId,pos,index,in_args);addIntoResults(results_returned,fullId,pos,index,returned);if(!typePassesFilter(parsedQuery.typeFilter,row.ty)){return}const searchWord=searchWords[pos];if(parsedQuery.literalSearch){if(searchWord===elem.name){addIntoResults(results_others,fullId,pos,-1,0)}return}if(elem.name.length===0){if(row.type!==null){lev=checkGenerics(row.type,elem,MAX_LEV_DISTANCE+1);addIntoResults(results_others,fullId,pos,index,lev)}return}if(elem.fullPath.length>1){lev=checkPath(elem.pathWithoutLast,row);if(lev>MAX_LEV_DISTANCE||(parsedQuery.literalSearch&&lev!==0)){return}else if(lev>0){lev_add=lev/10}}if(searchWord.indexOf(elem.pathLast)>-1||row.normalizedName.indexOf(elem.pathLast)>-1){index=row.normalizedName.indexOf(elem.pathLast)}lev=levenshtein(searchWord,elem.pathLast);if(lev>0&&elem.pathLast.length>2&&searchWord.indexOf(elem.pathLast)>-1){if(elem.pathLast.length<6){lev=1}else{lev=0}}lev+=lev_add;if(lev>MAX_LEV_DISTANCE){return}else if(index!==-1&&elem.fullPath.length<2){lev-=1}if(lev<0){lev=0}addIntoResults(results_others,fullId,pos,index,lev)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let totalLev=0;let nbLev=0;function checkArgs(elems,callback){for(const elem of elems){const lev=callback(row,elem,NO_TYPE_FILTER);if(lev<=1){nbLev+=1;totalLev+=lev}else{return false}}return true}if(!checkArgs(parsedQuery.elems,findArg)){return}if(!checkArgs(parsedQuery.returned,checkReturned)){return}if(nbLev===0){return}const lev=Math.round(totalLev/nbLev);addIntoResults(results,row.id,pos,0,lev)}function innerRunQuery(){let elem,i,nSearchWords,in_returned,row;if(parsedQuery.foundElems===1){if(parsedQuery.elems.length===1){elem=parsedQuery.elems[0];for(i=0,nSearchWords=searchWords.length;i0){for(i=0,nSearchWords=searchWords.length;i-1||path.indexOf(key)>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(key)>-1)||levenshtein(name,key)<=MAX_LEV_DISTANCE)){return false}}return true}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#titles > button").item(searchState.currentTab);if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor="#"+type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function escape(content){const h1=document.createElement("h1");h1.textContent=content;return h1.innerHTML}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){let extraClass="";if(display===true){extraClass=" active"}const output=document.createElement("div");let length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];length+=1;let extra="";if(type==="primitive"){extra=" (primitive type)"}else if(type==="keyword"){extra=" (keyword)"}const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const wrapper=document.createElement("div");const resultName=document.createElement("div");resultName.className="result-name";if(item.is_alias){const alias=document.createElement("span");alias.className="alias";const bold=document.createElement("b");bold.innerText=item.alias;alias.appendChild(bold);alias.insertAdjacentHTML("beforeend"," - see ");resultName.appendChild(alias)}resultName.insertAdjacentHTML("beforeend",item.displayPath+""+name+extra+"");wrapper.appendChild(resultName);const description=document.createElement("div");description.className="desc";const spanDesc=document.createElement("span");spanDesc.insertAdjacentHTML("beforeend",item.desc);description.appendChild(spanDesc);wrapper.appendChild(description);link.appendChild(wrapper);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==searchState.loadingText))){const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";const crates_list=Object.keys(rawSearchIndex);if(crates_list.length>1){crates=" in "}let typeFilter="";if(results.query.typeFilter!==NO_TYPE_FILTER){typeFilter=" (type: "+escape(itemTypes[results.query.typeFilter])+")"}let output="
"+`

Results for ${escape(results.query.userQuery)}`+`${typeFilter}

${crates}
`;if(results.query.error!==null){output+=`

Query parser error: "${results.query.error}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("titles").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function search(e,forced){const params=searchState.getQueryStringParams();const query=parseQuery(searchState.input.value.trim());if(e){e.preventDefault()}if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}let filterCrates=getFilterCrates();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";if(browserSupportsHistoryApi()){const newURL=buildUrl(query.original,filterCrates);if(!history.state&&!params.search){history.pushState(null,"",newURL)}else{history.replaceState(null,"",newURL)}}showResults(execQuery(query,searchWords,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildIndex(rawSearchIndex){searchIndex=[];const searchWords=[];let i,word;let currentIndex=0;let id=0;for(const crate in rawSearchIndex){if(!hasOwnPropertyRustdoc(rawSearchIndex,crate)){continue}let crateSize=0;const crateCorpus=rawSearchIndex[crate];searchWords.push(crate);const crateRow={crate:crate,ty:1,name:crate,path:"",desc:crateCorpus.doc,parent:undefined,type:null,id:id,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),};id+=1;searchIndex.push(crateRow);currentIndex+=1;const itemTypes=crateCorpus.t;const itemNames=crateCorpus.n;const itemPaths=crateCorpus.q;const itemDescs=crateCorpus.d;const itemParentIdxs=crateCorpus.i;const itemFunctionSearchTypes=crateCorpus.f;const paths=crateCorpus.p;const aliases=crateCorpus.a;let len=paths.length;for(i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:itemFunctionSearchTypes[i],id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){ALIASES[crate]=Object.create(null);for(const alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}if(!hasOwnPropertyRustdoc(ALIASES[crate],alias_name)){ALIASES[crate][alias_name]=[]}for(const local_alias of aliases[alias_name]){ALIASES[crate][alias_name].push(local_alias+currentIndex)}}}currentIndex+=crateSize}return searchWords}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="All crates"){const params=searchState.getQueryStringParams();const query=searchState.input.value.trim();if(!history.state&&!params.search){history.pushState(null,"",buildUrl(query,null))}else{history.replaceState(null,"",buildUrl(query,null))}}currentResults=null;search(undefined,true)}const searchWords=buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}return searchWords}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch({})}})() \ No newline at end of file diff --git a/0.10.3/settings.css b/0.10.3/settings.css new file mode 100644 index 000000000..2be35b25c --- /dev/null +++ b/0.10.3/settings.css @@ -0,0 +1 @@ +.setting-line{margin:0.6em 0 0.6em 0.3em;position:relative;}.setting-line .choices{display:flex;flex-wrap:wrap;}.setting-line .radio-line input{margin-right:0.3em;height:1.2rem;width:1.2rem;border:1px solid;outline:none;-webkit-appearance:none;cursor:pointer;border-radius:50%;}.setting-line .radio-line input+span{padding-bottom:1px;}.radio-line .setting-name{width:100%;}.radio-line .choice{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:flex;align-items:center;cursor:pointer;}.radio-line .choice+.choice{margin-left:0.5em;}.toggle{position:relative;display:inline-block;width:100%;height:27px;margin-right:20px;display:flex;align-items:center;cursor:pointer;}.toggle input{opacity:0;position:absolute;}.slider{position:relative;width:45px;display:block;height:28px;margin-right:20px;cursor:pointer;background-color:#ccc;transition:.3s;}.slider:before{position:absolute;content:"";height:19px;width:19px;left:4px;bottom:4px;transition:.3s;}input:checked+.slider:before{transform:translateX(19px);}.setting-line>.sub-settings{padding-left:42px;width:100%;display:block;}div#settings{position:absolute;right:0;z-index:1;display:block;margin-top:7px;border-radius:3px;border:1px solid;}#settings .setting-line{margin:1.2em 0.6em;}div#settings::before{content:'';position:absolute;right:11px;border:solid;border-width:1px 1px 0 0;display:inline-block;padding:4px;transform:rotate(-45deg);top:-5px;} \ No newline at end of file diff --git a/0.10.3/settings.html b/0.10.3/settings.html new file mode 100644 index 000000000..09657840f --- /dev/null +++ b/0.10.3/settings.html @@ -0,0 +1,8 @@ +Rustdoc settings +

Rustdoc settings

Back
+ \ No newline at end of file diff --git a/0.10.3/settings.js b/0.10.3/settings.js new file mode 100644 index 000000000..35d65a9fa --- /dev/null +++ b/0.10.3/settings.js @@ -0,0 +1,11 @@ +"use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function changeSetting(settingName,value){updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":case"use-system-theme":updateSystemTheme();updateLightAndDark();break}}function handleKey(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey){return}switch(getVirtualKey(ev)){case"Enter":case"Return":case"Space":ev.target.checked=!ev.target.checked;ev.preventDefault();break}}function showLightAndDark(){addClass(document.getElementById("theme").parentElement,"hidden");removeClass(document.getElementById("preferred-light-theme").parentElement,"hidden");removeClass(document.getElementById("preferred-dark-theme").parentElement,"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme").parentElement,"hidden");addClass(document.getElementById("preferred-dark-theme").parentElement,"hidden");removeClass(document.getElementById("theme").parentElement,"hidden")}function updateLightAndDark(){if(getSettingValue("use-system-theme")!=="false"){showLightAndDark()}else{hideLightAndDark()}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.getElementsByClassName("slider"),elem=>{const toggle=elem.previousElementSibling;const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=function(){changeSetting(this.id,this.checked)};toggle.onkeyup=handleKey;toggle.onkeyrelease=handleKey});onEachLazy(settingsElement.getElementsByClassName("select-wrapper"),elem=>{const select=elem.getElementsByTagName("select")[0];const settingId=select.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){select.value=settingValue}select.onchange=function(){changeSetting(this.id,this.value)}});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;const settingValue=getSettingValue(settingId);if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",ev=>{changeSetting(ev.target.name,ev.target.value)})})}function buildSettingsPageSections(settings){let output="";for(const setting of settings){output+="
";const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`
\ + ${setting_name}\ +
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";output+=``});output+="
"}else{const checked=setting["default"]===true?" checked":"";output+=``}output+="
"}return output}function buildSettingsPage(){const themes=getVar("themes").split(",");const settings=[{"name":"Use system theme","js_name":"use-system-theme","default":true,},{"name":"Theme","js_name":"theme","default":"light","options":themes,},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":themes,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":themes,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";el.innerHTML=innerHTML;if(isSettingsPage){document.getElementById(MAIN_ID).appendChild(el)}else{el.setAttribute("tabindex","-1");getSettingsButton().appendChild(el)}return el}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display=""}function elemIsInParent(elem,parent){while(elem&&elem!==document.body){if(elem===parent){return true}elem=elem.parentElement}return false}function blurHandler(event){const settingsButton=getSettingsButton();if(!elemIsInParent(document.activeElement,settingsButton)&&!elemIsInParent(event.relatedTarget,settingsButton)){window.hideSettings()}}if(isSettingsPage){getSettingsButton().onclick=function(event){event.preventDefault()}}else{const settingsButton=getSettingsButton();const settingsMenu=document.getElementById("settings");window.hideSettings=function(){settingsMenu.style.display="none"};settingsButton.onclick=function(event){if(elemIsInParent(event.target,settingsMenu)){return}event.preventDefault();if(settingsMenu.style.display!=="none"){window.hideSettings()}else{displaySettings()}};settingsButton.onblur=blurHandler;settingsButton.querySelector("a").onblur=blurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=blurHandler});settingsMenu.onblur=blurHandler}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings()}removeClass(getSettingsButton(),"rotate")},0)})() \ No newline at end of file diff --git a/0.10.3/source-files.js b/0.10.3/source-files.js new file mode 100644 index 000000000..99e415e09 --- /dev/null +++ b/0.10.3/source-files.js @@ -0,0 +1,3 @@ +var sourcesIndex = {}; +sourcesIndex["chemfiles"] = {"name":"","files":["atom.rs","cell.rs","errors.rs","frame.rs","lib.rs","misc.rs","property.rs","residue.rs","selection.rs","strings.rs","topology.rs","trajectory.rs"]}; +createSourceSidebar(); diff --git a/0.10.3/source-script.js b/0.10.3/source-script.js new file mode 100644 index 000000000..c8856707a --- /dev/null +++ b/0.10.3/source-script.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=document.getElementById("rustdoc-vars").attributes["data-root-path"].value;function createDirEntry(elem,parent,fullPath,hasFoundFile){const name=document.createElement("div");name.className="name";fullPath+=elem["name"]+"/";name.onclick=ev=>{if(hasClass(ev.target,"expand")){removeClass(ev.target,"expand")}else{addClass(ev.target,"expand")}};name.innerText=elem["name"];const children=document.createElement("div");children.className="children";const folders=document.createElement("div");folders.className="folders";if(elem.dirs){for(const dir of elem.dirs){if(createDirEntry(dir,folders,fullPath,hasFoundFile)){addClass(name,"expand");hasFoundFile=true}}}children.appendChild(folders);const files=document.createElement("div");files.className="files";if(elem.files){for(const file_text of elem.files){const file=document.createElement("a");file.innerText=file_text;file.href=rootPath+"src/"+fullPath+file_text+".html";const w=window.location.href.split("#")[0];if(!hasFoundFile&&w===file.href){file.className="selected";addClass(name,"expand");hasFoundFile=true}files.appendChild(file)}}children.appendChild(files);parent.appendChild(name);parent.appendChild(children);return hasFoundFile}function toggleSidebar(){const child=this.children[0];if(child.innerText===">"){addClass(document.documentElement,"source-sidebar-expanded");child.innerText="<";updateLocalStorage("source-sidebar-show","true")}else{removeClass(document.documentElement,"source-sidebar-expanded");child.innerText=">";updateLocalStorage("source-sidebar-show","false")}}function createSidebarToggle(){const sidebarToggle=document.createElement("div");sidebarToggle.id="sidebar-toggle";sidebarToggle.onclick=toggleSidebar;const inner=document.createElement("div");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}sidebarToggle.appendChild(inner);return sidebarToggle}function createSourceSidebar(){const container=document.querySelector("nav.sidebar");const sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);const sidebar=document.createElement("div");sidebar.id="source-sidebar";let hasFoundFile=false;const title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(key=>{sourcesIndex[key].name=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",hasFoundFile)});container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}const lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSourceLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("span"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSourceHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSourceLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",()=>{const match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSourceLines(match)}});onEachLazy(document.getElementsByClassName("line-numbers"),el=>{el.addEventListener("click",handleSourceHighlight)});highlightSourceLines();window.createSourceSidebar=createSourceSidebar})() \ No newline at end of file diff --git a/0.10.3/src/chemfiles/atom.rs.html b/0.10.3/src/chemfiles/atom.rs.html new file mode 100644 index 000000000..bc6143bf4 --- /dev/null +++ b/0.10.3/src/chemfiles/atom.rs.html @@ -0,0 +1,1061 @@ +atom.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null};
+use strings;
+
+use property::{Property, RawProperty, PropertiesIter};
+
+/// An `Atom` is a particle in the current `Frame`. It stores the following
+/// atomic properties:
+///
+/// - atom name;
+/// - atom type;
+/// - atom mass;
+/// - atom charge.
+///
+/// The atom name is usually an unique identifier (`H1`, `C_a`) while the
+/// atom type will be shared between all particles of the same type: `H`,
+/// `Ow`, `CH3`.
+pub struct Atom {
+    handle: *mut CHFL_ATOM,
+}
+
+/// An analog to a reference to an atom (`&Atom`)
+pub struct AtomRef<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a Atom>
+}
+
+impl<'a> Deref for AtomRef<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an atom (`&mut Atom`)
+pub struct AtomMut<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a mut Atom>
+}
+
+impl<'a> Deref for AtomMut<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for AtomMut<'a> {
+    fn deref_mut(&mut self) -> &mut Atom {
+        &mut self.inner
+    }
+}
+
+impl Clone for Atom {
+    fn clone(&self) -> Atom {
+        unsafe {
+            let new_handle = chfl_atom_copy(self.as_ptr());
+            Atom::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Atom {
+    /// Create an owned `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_ATOM) -> Atom {
+        check_not_null(ptr);
+        Atom {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_ATOM) -> AtomRef<'a> {
+        AtomRef {
+            inner: Atom::from_ptr(ptr as *mut CHFL_ATOM),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a mutably borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_ATOM) -> AtomMut<'a> {
+        AtomMut {
+            inner: Atom::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_ATOM {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_ATOM {
+        self.handle
+    }
+
+    /// Create an atom with the given `name`, and set the atom type to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Atom {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_atom(buffer.as_ptr());
+            Atom::from_ptr(handle)
+        }
+    }
+
+    /// Get the atom mass, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.mass(), 4.002602);
+    /// ```
+    pub fn mass(&self) -> f64 {
+        let mut mass = 0.0;
+        unsafe {
+            check_success(chfl_atom_mass(self.as_ptr(), &mut mass));
+        }
+        return mass;
+    }
+
+    /// Set the atom mass to `mass`, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_mass(34.9);
+    /// assert_eq!(atom.mass(), 34.9);
+    /// ```
+    pub fn set_mass(&mut self, mass: f64) {
+        unsafe {
+            check_success(chfl_atom_set_mass(self.as_mut_ptr(), mass));
+        }
+    }
+
+    /// Get the atom charge, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.charge(), 0.0);
+    /// ```
+    pub fn charge(&self) -> f64 {
+        let mut charge = 0.0;
+        unsafe {
+            check_success(chfl_atom_charge(self.as_ptr(), &mut charge));
+        }
+        return charge;
+    }
+
+    /// Set the atom charge to `charge`, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_charge(-2.0);
+    /// assert_eq!(atom.charge(), -2.0);
+    /// ```
+    pub fn set_charge(&mut self, charge: f64) {
+        unsafe {
+            check_success(chfl_atom_set_charge(self.as_mut_ptr(), charge));
+        }
+    }
+
+    /// Get the atom name.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_atom_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_name).expect("getting name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Get the atom type.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.atomic_type(), "He");
+    /// ```
+    pub fn atomic_type(&self) -> String {
+        let get_type = |ptr, len| unsafe { chfl_atom_type(self.as_ptr(), ptr, len) };
+        let buffer = strings::call_autogrow_buffer(10, get_type).expect("getting type failed");
+        return strings::from_c(buffer.as_ptr());
+    }
+
+    /// Set the atom name to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_name("Zn3");
+    /// assert_eq!(atom.name(), "Zn3");
+    /// ```
+    pub fn set_name<'a>(&mut self, name: impl Into<&'a str>) {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            check_success(chfl_atom_set_name(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Set the atom type to `atomic_type`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_atomic_type("F");
+    /// assert_eq!(atom.atomic_type(), "F");
+    /// ```
+    pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>) {
+        let buffer = strings::to_c(atomic_type.into());
+        unsafe {
+            check_success(chfl_atom_set_type(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Try to get the full name of the atom from the atomic type. For example,
+    /// the full name of "He" is "Helium", and so on. If the name can not be
+    /// found, this function returns the empty string.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("Zn");
+    /// assert_eq!(atom.full_name(), "Zinc");
+    /// ```
+    pub fn full_name(&self) -> String {
+        let get_full_name = |ptr, len| unsafe { chfl_atom_full_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_full_name).expect("getting full name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Try to get the Van der Waals radius of the atom from the atomic type.
+    /// If the radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+    /// assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+    /// ```
+    pub fn vdw_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_vdw_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the covalent radius of the atom from the atomic type. If the
+    /// radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+    /// assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+    /// ```
+    pub fn covalent_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_covalent_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the atomic number of the atom from the atomic type. If the
+    /// number can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").atomic_number(), 2);
+    /// assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+    /// ```
+    pub fn atomic_number(&self) -> u64 {
+        let mut number = 0;
+        unsafe {
+            check_success(chfl_atom_atomic_number(self.as_ptr(), &mut number));
+        }
+        return number;
+    }
+
+    /// Add a new `property` with the given `name` to this atom.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("a bool", true);
+    /// atom.set("a string", "test");
+    ///
+    /// assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+    /// assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_atom_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+
+    /// Get a property with the given `name` in this atom, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(atom.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_atom_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                let property = Property::from_raw(raw);
+                Some(property)
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this atom
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    /// atom.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in atom.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_atom_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_atom_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Atom {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+
+        let copy = atom.clone();
+        assert_eq!(copy.name(), "He");
+
+        atom.set_name("Na");
+        assert_eq!(atom.name(), "Na");
+        assert_eq!(copy.name(), "He");
+    }
+
+    #[test]
+    fn mass() {
+        let mut atom = Atom::new("He");
+        assert_ulps_eq!(atom.mass(), 4.002602);
+        atom.set_mass(15.0);
+        assert_eq!(atom.mass(), 15.0);
+    }
+
+    #[test]
+    fn charge() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.charge(), 0.0);
+        atom.set_charge(-1.5);
+        assert_eq!(atom.charge(), -1.5);
+    }
+
+    #[test]
+    fn name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+        atom.set_name("Zn-12");
+        assert_eq!(atom.name(), "Zn-12");
+    }
+
+    #[test]
+    fn atomic_type() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.atomic_type(), "He");
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.atomic_type(), "Zn");
+    }
+
+    #[test]
+    fn full_name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.full_name(), "Helium");
+
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.full_name(), "Zinc");
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.full_name(), "");
+    }
+
+    #[test]
+    fn radii() {
+        let atom = Atom::new("He");
+        assert_ulps_eq!(atom.vdw_radius(), 1.4);
+        assert_ulps_eq!(atom.covalent_radius(), 0.32);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.vdw_radius(), 0.0);
+        assert_eq!(atom.covalent_radius(), 0.0);
+    }
+
+    #[test]
+    fn atomic_number() {
+        let atom = Atom::new("He");
+        assert_eq!(atom.atomic_number(), 2);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.atomic_number(), 0);
+    }
+
+    #[test]
+    fn property() {
+        let mut atom = Atom::new("F");
+
+        atom.set("foo", -22.0);
+        assert_eq!(atom.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(atom.get("bar"), None);
+
+        atom.set("bar", Property::String("here".into()));
+        for (name, property) in atom.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/cell.rs.html b/0.10.3/src/chemfiles/cell.rs.html new file mode 100644 index 000000000..12d969499 --- /dev/null +++ b/0.10.3/src/chemfiles/cell.rs.html @@ -0,0 +1,1109 @@ +cell.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref, DerefMut};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_success, check_not_null, check, Error};
+
+/// Available unit cell shapes.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum CellShape {
+    /// Orthorhombic cell, with the three angles equals to 90°.
+    Orthorhombic,
+    /// Triclinic cell, with any values for the angles.
+    Triclinic,
+    /// Infinite cell, to use when there is no cell.
+    Infinite,
+}
+
+impl From<chfl_cellshape> for CellShape {
+    fn from(celltype: chfl_cellshape) -> CellShape {
+        match celltype {
+            chfl_cellshape::CHFL_CELL_ORTHORHOMBIC => CellShape::Orthorhombic,
+            chfl_cellshape::CHFL_CELL_TRICLINIC => CellShape::Triclinic,
+            chfl_cellshape::CHFL_CELL_INFINITE => CellShape::Infinite,
+        }
+    }
+}
+
+impl From<CellShape> for chfl_cellshape {
+    fn from(celltype: CellShape) -> chfl_cellshape {
+        match celltype {
+            CellShape::Orthorhombic => chfl_cellshape::CHFL_CELL_ORTHORHOMBIC,
+            CellShape::Triclinic => chfl_cellshape::CHFL_CELL_TRICLINIC,
+            CellShape::Infinite => chfl_cellshape::CHFL_CELL_INFINITE,
+        }
+    }
+}
+
+/// An `UnitCell` represent the box containing the atoms, and its periodicity.
+///
+/// An unit cell is fully represented by three lengths (a, b, c); and three
+/// angles (alpha, beta, gamma). The angles are stored in degrees, and the
+/// lengths in Angstroms.
+///
+/// A cell also has a matricial representation, by projecting the three base
+/// vector into an orthonormal base. We choose to represent such matrix as an
+/// upper triangular matrix:
+///
+/// ```text
+/// | a_x   b_x   c_x |
+/// |  0    b_y   c_y |
+/// |  0     0    c_z |
+/// ```
+pub struct UnitCell {
+    handle: *mut CHFL_CELL,
+}
+
+/// An analog to a reference to an unit cell (`&UnitCell`)
+pub struct UnitCellRef<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a UnitCell>
+}
+
+impl<'a> Deref for UnitCellRef<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an unit cell (`&mut UnitCell`)
+pub struct UnitCellMut<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a mut UnitCell>
+}
+
+impl<'a> Deref for UnitCellMut<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+impl<'a> DerefMut for UnitCellMut<'a> {
+    fn deref_mut(&mut self) -> &mut UnitCell {
+        &mut self.inner
+    }
+}
+
+impl Clone for UnitCell {
+    fn clone(&self) -> UnitCell {
+        unsafe {
+            let new_handle = chfl_cell_copy(self.as_ptr());
+            UnitCell::from_ptr(new_handle)
+        }
+    }
+}
+
+impl UnitCell {
+    /// Create an owned `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_CELL) -> UnitCell {
+        check_not_null(ptr);
+        UnitCell {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime.
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_CELL) -> UnitCellRef<'a> {
+        UnitCellRef {
+            inner: UnitCell::from_ptr(ptr as *mut CHFL_CELL),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible for
+    /// setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_CELL) -> UnitCellMut<'a> {
+        UnitCellMut {
+            inner: UnitCell::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_CELL {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_CELL {
+        self.handle
+    }
+
+    /// Create an `Orthorhombic` `UnitCell` from the three lengths, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn new(lengths: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), ptr::null());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `Infinite` `UnitCell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::infinite();
+    ///
+    /// assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn infinite() -> UnitCell {
+        let mut cell = UnitCell::new([0.0, 0.0, 0.0]);
+        cell.set_shape(CellShape::Infinite).expect("could not set cell shape");
+        return cell;
+    }
+
+    /// Create an `Triclinic` `UnitCell` from the three lengths (in Angstroms)
+    /// and three angles (in degree). `alpha` is the angle between the vectors
+    /// `b` and `c`; `beta` is the between the vectors `a` and `c` and `gamma`
+    /// is the angle between the vectors `a` and `b`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// assert_eq!(cell.angles()[0], 98.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), angles.as_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `UnitCell` from a cell matrix. If `matrix` contains only
+    /// zeros, then an `Infinite` cell is created. If only the diagonal of the
+    /// matrix is non-zero, then the cell is `Orthorhombic`. Else a
+    /// `Triclinic` cell is created. The matrix entries should be in Angstroms.
+    ///
+    /// # Panics
+    ///
+    /// If the matrix has a negative determinant, or more generally is not
+    /// representing a unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::from_matrix([
+    ///     [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+    /// ]);
+    ///
+    /// assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn from_matrix(mut matrix: [[f64; 3]; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell_from_matrix(matrix.as_mut_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Get the three lengths of the cell, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// ```
+    pub fn lengths(&self) -> [f64; 3] {
+        let mut lengths = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_lengths(self.as_ptr(), lengths.as_mut_ptr()));
+        }
+        return lengths;
+    }
+
+    /// Set the three lengths of the cell, in Angstroms.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is infinite, or if one of the
+    /// lengths is negative.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+    /// assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+    ///
+    /// assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+    /// ```
+    pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_lengths(self.as_mut_ptr(), lengths.as_ptr()))
+        }
+    }
+
+    /// Get the three angles of the cell, in degrees.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([20.0, 20.0, 20.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    ///
+    /// let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// ```
+    pub fn angles(&self) -> [f64; 3] {
+        let mut angles = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_angles(self.as_ptr(), angles.as_mut_ptr()));
+        }
+        return angles;
+    }
+
+    /// Set the three angles of the cell, in degrees.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is not `Triclinic`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    ///
+    /// cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// ```
+    pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_angles(self.as_mut_ptr(), angles.as_ptr()))
+        }
+    }
+
+    /// Get the unit cell matricial representation.
+    ///
+    /// The unit cell representation is obtained by aligning the a vector along
+    /// the *x* axis and putting the b vector in the *xy* plane. This make the
+    /// matrix an upper triangular matrix:
+    ///
+    /// ```text
+    /// | a_x   b_x   c_x |
+    /// |  0    b_y   c_y |
+    /// |  0     0    c_z |
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let matrix = cell.matrix();
+    ///
+    /// assert_eq!(matrix[0][0], 10.0);
+    /// assert_eq!(matrix[1][1], 20.0);
+    /// assert_eq!(matrix[2][2], 30.0);
+    ///
+    /// assert!(matrix[1][2].abs() < 1e-9);
+    /// ```
+    pub fn matrix(&self) -> [[f64; 3]; 3] {
+        let mut matrix = [[0.0; 3]; 3];
+        unsafe {
+            check_success(chfl_cell_matrix(self.as_ptr(), matrix.as_mut_ptr()));
+        }
+        return matrix;
+    }
+
+    /// Get the shape of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn shape(&self) -> CellShape {
+        let mut shape = chfl_cellshape::CHFL_CELL_INFINITE;
+        unsafe {
+            check_success(chfl_cell_shape(self.as_ptr(), &mut shape));
+        }
+        return CellShape::from(shape);
+    }
+
+    /// Set the shape of the unit cell to `shape`.
+    ///
+    /// # Errors
+    ///
+    /// This can fail if the cell length or angles are incompatible with the
+    /// new shape.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    ///
+    /// cell.set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error> {
+        unsafe {
+            check(chfl_cell_set_shape(self.as_mut_ptr(), shape.into()))
+        }
+    }
+
+    /// Get the volume of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+    /// ```
+    pub fn volume(&self) -> f64 {
+        let mut volume = 0.0;
+        unsafe {
+            check_success(chfl_cell_volume(self.as_ptr(), &mut volume));
+        }
+        return volume;
+    }
+
+    /// Wrap a `vector` in this unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let mut vector = [12.0, 5.2, -45.3];
+    /// cell.wrap(&mut vector);
+    /// assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+    /// ```
+    pub fn wrap(&self, vector: &mut [f64; 3]) {
+        unsafe {
+            check_success(chfl_cell_wrap(self.as_ptr(), vector.as_mut_ptr()));
+        }
+    }
+}
+
+impl Drop for UnitCell {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+
+        let copy = cell.clone();
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+    }
+
+    #[test]
+    fn lengths() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+    }
+
+    #[test]
+    fn angles() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        crate::assert_vector3d_eq(&cell.angles(), &[90.0, 90.0, 90.0], 1e-6);
+
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        cell.set_angles([80.0, 89.0, 100.0]).unwrap();
+
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 89.0, 100.0], 1e-6);
+
+        let cell = UnitCell::triclinic([1., 2., 3.], [80., 90., 100.]);
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 90.0, 100.0], 1e-6);
+    }
+
+    #[test]
+    fn volume() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.volume(), 2.0 * 3.0 * 4.0);
+    }
+
+    #[test]
+    fn wrap() {
+        let cell = UnitCell::new([10.0, 20.0, 30.0]);
+        let mut vector = [12.0, 5.2, -45.3];
+        cell.wrap(&mut vector);
+        crate::assert_vector3d_eq(&vector, &[2.0, 5.2, 14.7], 1e-6);
+    }
+
+    #[test]
+    fn matrix() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+
+        let matrix = cell.matrix();
+        let result = [[2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 4.0]];
+
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn from_matrix() {
+        let cell = UnitCell::from_matrix([[10.0, 0.0, 0.0], [0.0, 21.0, 0.0], [0.0, 0.0, 32.0]]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        assert_eq!(cell.lengths(), [10.0, 21.0, 32.0]);
+
+        let result_matrix = [
+            [123.0, 4.08386, 71.7295],
+            [0.0, 233.964, 133.571],
+            [0.0, 0.0, 309.901],
+        ];
+        let cell = UnitCell::from_matrix(result_matrix);
+
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+        for i in 0..3 {
+            assert_ulps_eq!(
+                cell.lengths()[i],
+                [123.0, 234.0, 345.0][i],
+                epsilon = 1e-3
+            );
+            assert_ulps_eq!(cell.angles()[i], [67.0, 78.0, 89.0][i], epsilon = 1e-3);
+        }
+
+        let matrix = cell.matrix();
+        for i in 0..3 {
+            for j in 0..3 {
+                assert_ulps_eq!(matrix[i][j], result_matrix[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn shape() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+        let cell = UnitCell::infinite();
+        assert_eq!(cell.shape(), CellShape::Infinite);
+
+        let cell = UnitCell::triclinic([1.0, 2.0, 3.0], [80.0, 90.0, 100.0]);
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+
+        let mut cell = UnitCell::new([10.0, 10.0, 10.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/errors.rs.html b/0.10.3/src/chemfiles/errors.rs.html new file mode 100644 index 000000000..12dd2e0d0 --- /dev/null +++ b/0.10.3/src/chemfiles/errors.rs.html @@ -0,0 +1,455 @@ +errors.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+extern crate libc;
+
+use std::error;
+use std::fmt;
+use std::panic::{self, RefUnwindSafe};
+use std::path::Path;
+
+use self::libc::c_char;
+
+use chemfiles_sys::*;
+use strings;
+
+#[derive(Clone, Debug, PartialEq, Eq)]
+/// Error type for Chemfiles.
+pub struct Error {
+    /// The error status code
+    pub status: Status,
+    /// A message describing the error cause
+    pub message: String,
+}
+
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Clone, Debug, PartialEq, Eq)]
+/// Possible causes of error in chemfiles
+pub enum Status {
+    /// No error
+    Success = chfl_status::CHFL_SUCCESS as isize,
+    /// Error in memory allocations
+    MemoryError = chfl_status::CHFL_MEMORY_ERROR as isize,
+    /// Error while reading or writing a file
+    FileError = chfl_status::CHFL_FILE_ERROR as isize,
+    /// Error in file formatting, *i.e.* the file is invalid
+    FormatError = chfl_status::CHFL_FORMAT_ERROR as isize,
+    /// Error in selection string syntax
+    SelectionError = chfl_status::CHFL_SELECTION_ERROR as isize,
+    /// Error in configuration files syntax
+    ConfigurationError = chfl_status::CHFL_CONFIGURATION_ERROR as isize,
+    /// Error for out of bounds indexing
+    OutOfBounds = chfl_status::CHFL_OUT_OF_BOUNDS as isize,
+    /// Error related to properties
+    PropertyError = chfl_status::CHFL_PROPERTY_ERROR as isize,
+    /// Exception in the C++ chemfiles library
+    ChemfilesError = chfl_status::CHFL_GENERIC_ERROR as isize,
+    /// Exception in the C++ standard library
+    StdCppError = chfl_status::CHFL_CXX_ERROR as isize,
+    /// The given path is not valid UTF8
+    // TODO: rename this to UTF8Error in the next breaking release
+    UTF8PathError,
+}
+
+impl From<chfl_status> for Error {
+    fn from(status: chfl_status) -> Error {
+        let status = match status {
+            chfl_status::CHFL_SUCCESS => Status::Success,
+            chfl_status::CHFL_CXX_ERROR => Status::StdCppError,
+            chfl_status::CHFL_GENERIC_ERROR => Status::ChemfilesError,
+            chfl_status::CHFL_MEMORY_ERROR => Status::MemoryError,
+            chfl_status::CHFL_FILE_ERROR => Status::FileError,
+            chfl_status::CHFL_FORMAT_ERROR => Status::FormatError,
+            chfl_status::CHFL_SELECTION_ERROR => Status::SelectionError,
+            chfl_status::CHFL_CONFIGURATION_ERROR => Status::ConfigurationError,
+            chfl_status::CHFL_OUT_OF_BOUNDS => Status::OutOfBounds,
+            chfl_status::CHFL_PROPERTY_ERROR => Status::PropertyError,
+        };
+
+        let message = Error::last_error();
+        Error {
+            status,
+            message,
+        }
+    }
+}
+
+impl From<std::str::Utf8Error> for Error {
+    fn from(_: std::str::Utf8Error) -> Self {
+        Error {
+            status: Status::UTF8PathError,
+            message: "failed to convert data to UTF8 string".into(),
+        }
+    }
+}
+
+impl Error {
+    /// Create a new error because the given `path` is invalid UTF-8 data
+    pub(crate) fn utf8_path_error(path: &Path) -> Error {
+        Error {
+            status: Status::UTF8PathError,
+            message: format!("Could not convert '{}' to UTF8", path.display()),
+        }
+    }
+
+    /// Get the last error message from the C++ library.
+    pub fn last_error() -> String {
+        unsafe { strings::from_c(chfl_last_error()) }
+    }
+
+    /// Clear any error from the C++ library
+    pub fn cleanup() {
+        unsafe {
+            check(chfl_clear_errors()).expect("error in chfl_clear_errors. Things went very bad");
+        }
+    }
+}
+
+/// Check return value of a C function, and get the error if needed.
+pub(crate) fn check(status: chfl_status) -> Result<(), Error> {
+    if status == chfl_status::CHFL_SUCCESS {
+        Ok(())
+    } else {
+        Err(Error::from(status))
+    }
+}
+
+/// Check return value of a C function, panic if it failed.
+pub(crate) fn check_success(status: chfl_status) {
+    assert!(status == chfl_status::CHFL_SUCCESS, "unexpected failure: {}", Error::last_error());
+}
+
+/// Check a pointer for null.
+pub(crate) fn check_not_null<T>(ptr: *const T) {
+    assert!(!ptr.is_null(), "unexpected null pointer: {}", Error::last_error());
+}
+
+pub trait WarningCallback: RefUnwindSafe + Fn(&str) {}
+impl<T> WarningCallback for T
+where
+    T: RefUnwindSafe + Fn(&str),
+{
+}
+
+static mut LOGGING_CALLBACK: Option<*mut dyn WarningCallback<Output = ()>> = None;
+
+extern "C" fn warning_callback(message: *const c_char) {
+    unsafe {
+        let callback = &*LOGGING_CALLBACK.expect("No callback provided, this is an internal bug");
+        // ignore result. If a panic happened, everything is going badly anyway
+        let _result = panic::catch_unwind(|| {
+            callback(&strings::from_c(message));
+        });
+    }
+}
+
+/// Use `callback` for every chemfiles warning. The callback will be passed
+/// the warning message. This will drop any previous warning callback.
+pub fn set_warning_callback<F>(callback: F) where F: WarningCallback + 'static {
+    // box callback to ensure it stays accessible
+    let callback = Box::into_raw(Box::new(callback));
+    unsafe {
+        if let Some(previous) = LOGGING_CALLBACK {
+            // drop the previous callback
+            let previous = Box::from_raw(previous);
+            std::mem::drop(previous);
+            // set the LOGGING_CALLBACK to the new one
+            LOGGING_CALLBACK = Some(callback);
+        } else {
+            // set the LOGGING_CALLBACK
+            LOGGING_CALLBACK = Some(callback);
+            // Tell C code to use Rust-provided callback
+            check_success(chfl_set_warning_callback(warning_callback));
+        }
+    }
+}
+
+
+impl fmt::Display for Error {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        write!(fmt, "{}", self.message)
+    }
+}
+
+impl error::Error for Error {
+    fn description(&self) -> &str {
+        match self.status {
+            Status::Success => "Success",
+            Status::StdCppError => "Exception from the C++ standard library",
+            Status::ChemfilesError => "Exception from the chemfiles library",
+            Status::MemoryError => "Error in memory allocations",
+            Status::FileError => "Error while reading or writing a file",
+            Status::FormatError => "Error in file formatting, i.e. the file is invalid",
+            Status::SelectionError => "Error in selection string syntax",
+            Status::UTF8PathError => "A string is not valid UTF8",
+            Status::ConfigurationError => "Error in configuration files",
+            Status::OutOfBounds => "Out of bounds indexing",
+            Status::PropertyError => "Error in property",
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use Trajectory;
+
+    #[test]
+    fn errors() {
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+        assert!(Trajectory::open("nope", 'r').is_err());
+        assert_eq!(
+            Error::last_error(),
+            "file at \'nope\' does not have an extension, provide a format name to read it"
+        );
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+    }
+
+    #[test]
+    fn codes() {
+        assert_eq!(Error::from(chfl_status::CHFL_SUCCESS).status, Status::Success);
+        assert_eq!(Error::from(chfl_status::CHFL_CXX_ERROR).status, Status::StdCppError);
+        assert_eq!(Error::from(chfl_status::CHFL_GENERIC_ERROR).status, Status::ChemfilesError);
+        assert_eq!(Error::from(chfl_status::CHFL_MEMORY_ERROR).status, Status::MemoryError);
+        assert_eq!(Error::from(chfl_status::CHFL_FILE_ERROR).status, Status::FileError);
+        assert_eq!(Error::from(chfl_status::CHFL_FORMAT_ERROR).status, Status::FormatError);
+        assert_eq!(Error::from(chfl_status::CHFL_SELECTION_ERROR).status, Status::SelectionError);
+        assert_eq!(Error::from(chfl_status::CHFL_OUT_OF_BOUNDS).status, Status::OutOfBounds);
+        assert_eq!(Error::from(chfl_status::CHFL_PROPERTY_ERROR).status, Status::PropertyError);
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/frame.rs.html b/0.10.3/src/chemfiles/frame.rs.html new file mode 100644 index 000000000..c4058ff6c --- /dev/null +++ b/0.10.3/src/chemfiles/frame.rs.html @@ -0,0 +1,2463 @@ +frame.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::ptr;
+use std::slice;
+
+use super::{Atom, AtomMut, AtomRef};
+use super::{BondOrder, Residue, Topology, TopologyRef};
+use super::{UnitCell, UnitCellMut, UnitCellRef};
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use property::{PropertiesIter, Property, RawProperty};
+use strings;
+
+/// A `Frame` contains data from one simulation step: the current unit
+/// cell, the topology, the positions, and the velocities of the particles in
+/// the system. If some information is missing (topology or velocity or unit
+/// cell), the corresponding data is filled with a default value.
+pub struct Frame {
+    handle: *mut CHFL_FRAME,
+}
+
+impl Clone for Frame {
+    fn clone(&self) -> Frame {
+        unsafe {
+            let new_handle = chfl_frame_copy(self.as_ptr());
+            Frame::from_ptr(new_handle)
+        }
+    }
+}
+
+pub struct AtomIter<'a> {
+    frame: &'a Frame,
+    index: usize,
+    size: usize,
+}
+
+impl Frame {
+    /// Create a `Frame` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_FRAME) -> Frame {
+        check_not_null(ptr);
+        Frame { handle: ptr }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Create an empty frame. It will be resized by the library as needed.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    ///
+    /// assert_eq!(frame.size(), 0);
+    /// ```
+    pub fn new() -> Frame {
+        unsafe { Frame::from_ptr(chfl_frame()) }
+    }
+
+    /// Get a reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// let atom = frame.atom(0);
+    /// assert_eq!(atom.name(), "Zn");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle =
+                chfl_atom_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64);
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// assert_eq!(frame.atom(0).name(), "Zn");
+    ///
+    /// frame.atom_mut(0).set_name("Fe");
+    /// assert_eq!(frame.atom(0).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_frame(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.size(), 0);
+    ///
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_frame_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize the positions and the velocities in this frame, to make space for
+    /// `natoms` atoms. Previous data is conserved, as well as the presence of
+    /// absence of velocities.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_frame_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` and the corresponding position and optionally velocity
+    /// data to this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+    ///
+    /// frame.add_velocities();
+    /// frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+    /// ```
+    pub fn add_atom(
+        &mut self,
+        atom: &Atom,
+        position: [f64; 3],
+        velocity: impl Into<Option<[f64; 3]>>,
+    ) {
+        let velocity = velocity.into();
+        let velocity_ptr = match velocity {
+            Some(ref data) => data.as_ptr(),
+            None => ptr::null(),
+        };
+
+        unsafe {
+            check_success(chfl_frame_add_atom(
+                self.as_mut_ptr(),
+                atom.as_ptr(),
+                position.as_ptr(),
+                velocity_ptr,
+            ));
+        }
+    }
+
+    /// Remove the atom at index `i` in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+    /// assert_eq!(frame.size(), 3);
+    ///
+    /// frame.remove(1);
+    /// assert_eq!(frame.size(), 2);
+    /// assert_eq!(frame.atom(1).name(), "Sn");
+    /// ```
+    pub fn remove(&mut self, i: usize) {
+        unsafe {
+            check_success(chfl_frame_remove(self.as_mut_ptr(), i as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    /// assert_eq!(frame.topology().bonds_count(), 3);
+    ///
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+    /// assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(2);
+    ///
+    /// frame.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_frame_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// the frame.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    ///
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+    ///
+    /// frame.remove_bond(2, 4);
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_remove_bond(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+            ));
+        }
+    }
+
+    /// Add a copy of `residue` to this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue id is already in this frame's
+    /// topology, or if the residue contain atoms that are already in another
+    /// residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Residue};
+    /// let mut frame = Frame::new();
+    ///
+    /// let residue = Residue::new("foo");
+    /// frame.add_residue(&residue).unwrap();
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.residues_count(), 1);
+    /// assert_eq!(topology.residue(0).unwrap().name(), "foo");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe { check(chfl_frame_add_residue(self.as_mut_ptr(), residue.as_ptr())) }
+    }
+
+    /// Get the distance between the atoms at indexes `i` and `j` in this frame,
+    /// accounting for periodic boundary conditions. The result is expressed in
+    /// Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+    ///
+    /// assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+    /// ```
+    pub fn distance(&self, i: usize, j: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_distance(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get the angle formed by the atoms at indexes `i`, `j` and `k` in this
+    /// frame, accounting for periodic boundary conditions. The result is
+    /// expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+    /// ```
+    pub fn angle(&self, i: usize, j: usize, k: usize) -> f64 {
+        let mut angle = 0.0;
+        unsafe {
+            check_success(chfl_frame_angle(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                &mut angle,
+            ));
+        }
+        return angle;
+    }
+
+    /// Get the dihedral angle formed by the atoms at indexes `i`, `j`, `k` and
+    /// `m` in this frame, accounting for periodic boundary conditions. The
+    /// result is expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+    ///
+    /// assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+    /// ```
+    pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut dihedral = 0.0;
+        unsafe {
+            check_success(chfl_frame_dihedral(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut dihedral,
+            ));
+        }
+        return dihedral;
+    }
+
+    /// Get the out of plane distance formed by the atoms at indexes `i`, `j`,
+    /// `k` and `m` in this frame, accounting for periodic boundary conditions.
+    /// The result is expressed in angstroms.
+    ///
+    /// This is the distance between the atom j and the ikm plane. The j atom
+    /// is the center of the improper dihedral angle formed by i, j, k and m.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+    /// frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+    /// ```
+    pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_out_of_plane(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get a view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions.len(), 67);
+    /// assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn positions(&self) -> &[[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms,
+            ));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// {
+    ///     let positions = frame.positions_mut();
+    ///     assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    ///     positions[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn positions_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(
+                self.as_mut_ptr(),
+                &mut ptr,
+                &mut natoms,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Get a view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    ///
+    /// let velocities = frame.velocities().expect("missing velocities");
+    /// assert_eq!(velocities.len(), 67);
+    /// assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn velocities(&self) -> Option<&[[f64; 3]]> {
+        if !self.has_velocities() {
+            return None;
+        }
+
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return Some(slice::from_raw_parts(ptr, size));
+        }
+    }
+
+    /// Get a mutable view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    /// {
+    ///     let velocities = frame.velocities_mut().expect("missing velocities");
+    ///     assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    ///     velocities[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let velocities = frame.velocities().expect("missing velocities");
+    /// assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn velocities_mut(&mut self) -> Option<&mut [[f64; 3]]> {
+        if !self.has_velocities() {
+            return None;
+        }
+
+        let mut ptr = ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(
+                self.as_mut_ptr(),
+                &mut ptr,
+                &mut natoms,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return Some(slice::from_raw_parts_mut(ptr, size));
+        }
+    }
+
+    /// Check if this frame contains velocity data.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn has_velocities(&self) -> bool {
+        let mut res = 0;
+        unsafe {
+            check_success(chfl_frame_has_velocities(self.as_ptr(), &mut res));
+        }
+        return res != 0;
+    }
+
+    /// Add velocity data to this frame. If the frame already have velocities,
+    /// this does nothing.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn add_velocities(&mut self) {
+        unsafe {
+            check_success(chfl_frame_add_velocities(self.as_mut_ptr()));
+        }
+    }
+
+    /// Get a reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let frame = Frame::new();
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn cell(&self) -> UnitCellRef {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW());
+            UnitCell::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// assert_eq!(frame.cell().shape(), CellShape::Infinite);
+    ///
+    /// frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+    /// ```
+    pub fn cell_mut(&mut self) -> UnitCellMut {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr());
+            UnitCell::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Set the `UnitCell` of this frame to `cell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, UnitCell, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_frame_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get a reference to the `Topology` of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(42);
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.size(), 42);
+    /// ```
+    pub fn topology(&self) -> TopologyRef {
+        unsafe {
+            let handle = chfl_topology_from_frame(self.as_ptr());
+            Topology::ref_from_ptr(handle)
+        }
+    }
+
+    /// Set the `Topology` of this frame to `topology`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology contains a different number of atoms
+    /// than this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Topology, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.resize(2);
+    ///
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_bond(0, 1);
+    ///
+    /// frame.set_topology(&topology).unwrap();
+    /// assert_eq!(frame.atom(0).name(), "Cl");
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error> {
+        unsafe {
+            check(chfl_frame_set_topology(
+                self.as_mut_ptr(),
+                topology.as_ptr(),
+            ))
+        }
+    }
+
+    /// Get this frame step, i.e. the frame number in the trajectory
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    /// ```
+    pub fn step(&self) -> usize {
+        let mut step = 0;
+        unsafe {
+            check_success(chfl_frame_step(self.as_ptr(), &mut step));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return step as usize;
+    }
+
+    /// Set this frame step to `step`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    ///
+    /// frame.set_step(10);
+    /// assert_eq!(frame.step(), 10);
+    /// ```
+    pub fn set_step(&mut self, step: usize) {
+        unsafe {
+            check_success(chfl_frame_set_step(self.as_mut_ptr(), step as u64));
+        }
+    }
+
+    /// Guess the bonds, angles and dihedrals in this `frame`.
+    ///
+    /// The bonds are guessed using a distance-based algorithm, and then angles
+    /// and dihedrals are guessed from the bonds.
+    ///
+    /// # Errors
+    ////
+    /// This function can fail if the covalent radius is unknown for some atoms
+    /// in the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    ///
+    /// frame.guess_bonds().unwrap();
+    /// assert_eq!(frame.topology().bonds_count(), 1);
+    /// ```
+    pub fn guess_bonds(&mut self) -> Result<(), Error> {
+        unsafe { check(chfl_frame_guess_bonds(self.as_mut_ptr())) }
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology of the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, Frame};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(1, 2);
+    ///
+    /// assert_eq!(frame.topology().bonds().len(), 2);
+    /// assert_eq!(frame.topology().angles().len(), 1);
+    ///
+    /// frame.clear_bonds();
+    /// assert!(frame.topology().bonds().is_empty());
+    /// assert!(frame.topology().angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_frame_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a new `property` with the given `name` to this frame.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("a string", "hello");
+    /// frame.set("a double", 4.3);
+    ///
+    /// assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_frame_set_property(
+                self.as_mut_ptr(),
+                buffer.as_ptr(),
+                property.as_ptr(),
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(frame.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_frame_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    /// frame.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in frame.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_frame_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_frame_list_properties(
+                self.as_ptr(),
+                c_names.as_mut_ptr(),
+                count,
+            ));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property")),
+        }
+    }
+
+    /// Gets an iterator over atoms
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, AtomRef, Frame};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    ///
+    /// let mut atoms: Vec<AtomRef> = Vec::new();
+    ///
+    /// for atom in frame.iter_atoms() {
+    ///     atoms.push(atom);
+    /// }
+    ///
+    /// assert_eq!(atoms.len(), 2);
+    /// ```
+    pub fn iter_atoms(&self) -> AtomIter<'_> {
+        AtomIter {
+            frame: self,
+            index: 0,
+            size: self.size(),
+        }
+    }
+}
+
+impl Drop for Frame {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl<'a> Iterator for AtomIter<'a> {
+    type Item = AtomRef<'a>;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.size <= self.index {
+            return None;
+        }
+        let atom = self.frame.atom(self.index);
+        self.index += 1;
+        Some(atom)
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Topology, UnitCell};
+
+    #[test]
+    fn clone() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+        let copy = frame.clone();
+        assert_eq!(copy.size(), 0);
+
+        frame.resize(42);
+        assert_eq!(frame.size(), 42);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+
+        frame.resize(12);
+        assert_eq!(frame.size(), 12);
+    }
+
+    #[test]
+    fn add_atom() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        let positions = &[[1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        frame.add_velocities();
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], [4.0, 3.0, 2.0]);
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+        assert_eq!(frame.atom(1).name(), "F");
+
+        let positions = &[[1.0, 1.0, 2.0], [1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        let velocities = &[[0.0, 0.0, 0.0], [4.0, 3.0, 2.0]];
+        assert_eq!(frame.velocities().unwrap(), velocities);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_atom() {
+        let mut frame = Frame::new();
+        frame.resize(22);
+        let _atom = frame.atom(23);
+    }
+
+    #[test]
+    fn remove_atom() {
+        let mut frame = Frame::new();
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], None);
+
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        frame.remove(0);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "F");
+    }
+
+    #[test]
+    #[should_panic]
+    fn remove_out_of_bounds() {
+        let mut frame = Frame::new();
+        frame.resize(32);
+
+        frame.remove(100);
+    }
+
+    #[test]
+    fn positions() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.positions_mut().clone_from_slice(expected);
+        assert_eq!(frame.positions(), expected);
+    }
+
+    #[test]
+    fn velocities() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        assert!(!frame.has_velocities());
+        frame.add_velocities();
+        assert!(frame.has_velocities());
+
+        let expected = &[
+            [1.0, 2.0, 3.0],
+            [4.0, 5.0, 6.0],
+            [7.0, 8.0, 9.0],
+            [10.0, 11.0, 12.0],
+        ];
+
+        frame.velocities_mut().unwrap().clone_from_slice(expected);
+        assert_eq!(frame.velocities().unwrap(), expected);
+    }
+
+    #[test]
+    fn cell() {
+        let mut frame = Frame::new();
+        frame.set_cell(&UnitCell::new([3.0, 4.0, 5.0]));
+        let cell = frame.cell();
+        assert_eq!(cell.lengths(), [3.0, 4.0, 5.0]);
+    }
+
+    #[test]
+    fn topology() {
+        let mut frame = Frame::new();
+        frame.resize(2);
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Zn"));
+        topology.add_atom(&Atom::new("Ar"));
+
+        assert!(frame.set_topology(&topology).is_ok());
+
+        let topology = frame.topology();
+
+        assert_eq!(topology.atom(0).name(), "Zn");
+        assert_eq!(topology.atom(1).name(), "Ar");
+
+        assert_eq!(frame.atom(0).name(), "Zn");
+        assert_eq!(frame.atom(1).name(), "Ar");
+    }
+
+    #[test]
+    fn bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        assert_eq!(frame.topology().bonds_count(), 0);
+
+        frame.add_bond(0, 1);
+        frame.add_bond(9, 2);
+        frame.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(frame.topology().bonds_count(), 3);
+
+        assert_eq!(frame.topology().bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(frame.topology().bond_orders(), expected);
+
+        assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(frame.topology().bond_order(3, 7), BondOrder::Aromatic);
+
+        frame.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        frame.remove_bond(8, 7);
+        assert_eq!(frame.topology().bonds_count(), 2);
+
+        frame.clear_bonds();
+        assert_eq!(frame.topology().bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn residues() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.topology().residues_count(), 0);
+
+        let residue = &Residue::new("foobar");
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+
+        assert_eq!(frame.topology().residues_count(), 3);
+        assert_eq!(frame.topology().residue(0).unwrap().name(), "foobar");
+    }
+
+    #[test]
+    fn step() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.step(), 0);
+        frame.set_step(42);
+        assert_eq!(frame.step(), 42);
+    }
+
+    #[test]
+    fn property() {
+        let mut frame = Frame::new();
+        frame.set("foo", -22.0);
+        assert_eq!(frame.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(frame.get("bar"), None);
+
+        frame.set("bar", Property::String("here".into()));
+        for (name, property) in frame.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+
+    #[test]
+    fn pbc_geometry() {
+        use std::f64::consts::PI;
+
+        let mut frame = Frame::new();
+        let atom = &Atom::new("");
+
+        frame.add_atom(atom, [1.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 1.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 2.0], None);
+
+        assert_eq!(frame.distance(0, 2), f64::sqrt(2.0));
+        assert_eq!(frame.angle(0, 1, 2), PI / 2.0);
+        assert_eq!(frame.dihedral(0, 1, 2, 3), PI / 2.0);
+        assert_eq!(frame.out_of_plane(1, 4, 0, 2), 2.0);
+    }
+
+    #[test]
+    fn atom_iterator() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("H1"), [1.0, 0.0, 0.0], None);
+        frame.add_atom(&Atom::new("H2"), [0.0, 1.0, 0.0], None);
+        frame.add_atom(&Atom::new("H3"), [0.0, 0.0, 1.0], None);
+        frame.add_atom(&Atom::new("H4"), [1.0, 1.0, 1.0], None);
+
+        let mut items: Vec<(AtomRef, &[f64; 3])> = Vec::new();
+
+        for item in frame.iter_atoms().zip(frame.positions()) {
+            items.push(item);
+        }
+
+        assert_eq!(items[0].0.name(), "H1");
+        assert_eq!(items[2].0.name(), "H3");
+
+        assert_eq!(items[1].1, &[0.0_f64, 1.0_f64, 0.0_f64]);
+        assert_eq!(items[3].1, &[1.0_f64, 1.0_f64, 1.0_f64]);
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/lib.rs.html b/0.10.3/src/chemfiles/lib.rs.html new file mode 100644 index 000000000..cbdadac7e --- /dev/null +++ b/0.10.3/src/chemfiles/lib.rs.html @@ -0,0 +1,289 @@ +lib.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! Chemfiles is a multi-language library written in modern C++ for reading and
+//! writing from and to molecular trajectory files. These files are created by
+//! your favorite theoretical chemistry program, and contains information about
+//! atomic or residues names and positions. Some format also have additional
+//! information, such as velocities, forces, energy, …
+//!
+//! This crate expose the C API of chemfiles to Rust, and make all the
+//! functionalities accessible. For more information on the C++ library,
+//! please see its [documentation][cxx_doc]. Specifically, the following pages
+//! are worth reading:
+//!
+//! - The [overview][overview] of the classes organization;
+//! - The list of [supported formats][formats];
+//! - The documentation for the [selection language][selections];
+//!
+//! [cxx_doc]: https://chemfiles.org/chemfiles
+//! [overview]: https://chemfiles.org/chemfiles/latest/overview.html
+//! [formats]: https://chemfiles.org/chemfiles/latest/formats.html
+//! [selections]: https://chemfiles.org/chemfiles/latest/selections.html
+
+#![deny(missing_docs)]
+#![warn(trivial_casts, unused_import_braces, variant_size_differences)]
+#![warn(unused_results)]
+// Configuration for clippy lints
+#![warn(clippy::all, clippy::pedantic)]
+#![allow(clippy::needless_return, clippy::module_name_repetitions)]
+#![allow(clippy::must_use_candidate, clippy::wildcard_imports)]
+
+// Allow a few more clippy lints in test mode
+#![cfg_attr(test, allow(clippy::float_cmp, clippy::unreadable_literal, clippy::shadow_unrelated))]
+
+// deny(warnings) in doc tests
+#![doc(test(attr(deny(warnings))))]
+#![doc(test(attr(allow(unused_variables))))]
+
+#[cfg(test)]
+#[macro_use]
+extern crate approx;
+
+extern crate chemfiles_sys;
+use chemfiles_sys::{chfl_add_configuration, chfl_version};
+
+mod strings;
+
+mod errors;
+pub use errors::{Error, Status};
+pub use errors::set_warning_callback;
+
+mod atom;
+pub use atom::Atom;
+pub use atom::AtomRef;
+pub use atom::AtomMut;
+
+mod cell;
+pub use cell::UnitCell;
+pub use cell::UnitCellRef;
+pub use cell::UnitCellMut;
+pub use cell::CellShape;
+
+mod residue;
+pub use residue::Residue;
+pub use residue::ResidueRef;
+
+mod topology;
+pub use topology::Topology;
+pub use topology::TopologyRef;
+pub use topology::BondOrder;
+
+mod frame;
+pub use frame::Frame;
+
+mod trajectory;
+pub use trajectory::Trajectory;
+
+mod selection;
+pub use selection::{Match, Selection};
+
+mod property;
+pub use property::Property;
+pub use property::PropertiesIter;
+
+mod misc;
+pub use misc::{FormatMetadata, formats_list, guess_format};
+
+/// Get the version of the chemfiles library.
+///
+/// # Example
+/// ```
+/// let version = chemfiles::version();
+/// assert!(version.starts_with("0.10"));
+/// ```
+pub fn version() -> String {
+    unsafe { strings::from_c(chfl_version()) }
+}
+
+/// Read configuration data from the file at `path`.
+///
+/// By default, chemfiles reads configuration from any file named
+/// `.chemfiles.toml` in the current directory or any parent directory. This
+/// function can be used to add data from another configuration file. Data from
+/// the new configuration file will overwrite any existing data.
+///
+/// # Errors
+///
+/// This function will fail if there is no file at `path`, or if the file is
+/// incorrectly formatted.
+///
+/// # Example
+/// ```no_run
+/// chemfiles::add_configuration("local-config.toml").unwrap();
+/// // from now on, the data from "local-config.toml" will be used
+/// ```
+pub fn add_configuration<S>(path: S) -> Result<(), Error>
+where
+    S: AsRef<str>,
+{
+    let buffer = strings::to_c(path.as_ref());
+    unsafe {
+        errors::check(chfl_add_configuration(buffer.as_ptr()))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    fn version() {
+        assert!(!crate::version().is_empty());
+        assert!(crate::version().starts_with("0.10"));
+    }
+}
+
+#[cfg(test)]
+fn assert_vector3d_eq(lhs: &[f64; 3], rhs: &[f64; 3], eps: f64) {
+    lhs.iter()
+        .zip(rhs)
+        .for_each(|(l, r)| assert_ulps_eq!(l, r, epsilon = eps));
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/misc.rs.html b/0.10.3/src/chemfiles/misc.rs.html new file mode 100644 index 000000000..007317e71 --- /dev/null +++ b/0.10.3/src/chemfiles/misc.rs.html @@ -0,0 +1,281 @@ +misc.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2020 Guillaume Fraux -- BSD licensed
+
+use std::convert::TryInto;
+use std::ffi::CStr;
+
+use chemfiles_sys::{chfl_format_metadata, chfl_formats_list, chfl_free, chfl_guess_format};
+use errors::check_success;
+
+/// `FormatMetadata` contains metadata associated with one format.
+#[allow(clippy::struct_excessive_bools)]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct FormatMetadata {
+    /// Name of the format.
+    pub name: &'static str,
+    /// Extension associated with the format.
+    pub extension: Option<&'static str>,
+    /// Extended, user-facing description of the format.
+    pub description: &'static str,
+    /// URL pointing to the format definition/reference.
+    pub reference: &'static str,
+    /// Is reading files in this format implemented?
+    pub read: bool,
+    /// Is writing files in this format implemented?
+    pub write: bool,
+    /// Does this format support in-memory IO?
+    pub memory: bool,
+    /// Does this format support storing atomic positions?
+    pub positions: bool,
+    /// Does this format support storing atomic velocities?
+    pub velocities: bool,
+    /// Does this format support storing unit cell information?
+    pub unit_cell: bool,
+    /// Does this format support storing atom names or types?
+    pub atoms: bool,
+    /// Does this format support storing bonds between atoms?
+    pub bonds: bool,
+    /// Does this format support storing residues?
+    pub residues: bool,
+}
+
+impl FormatMetadata {
+    pub(crate) fn from_raw(raw: &chfl_format_metadata) -> Self {
+        let str_from_ptr = |ptr| unsafe {
+            CStr::from_ptr(ptr)
+                .to_str()
+                .expect("Invalid Rust str from C")
+        };
+        let extension = if raw.extension.is_null() {
+            None
+        } else {
+            Some(str_from_ptr(raw.extension))
+        };
+        Self {
+            name: str_from_ptr(raw.name),
+            extension,
+            description: str_from_ptr(raw.description),
+            reference: str_from_ptr(raw.reference),
+            read: raw.read,
+            write: raw.write,
+            memory: raw.memory,
+            positions: raw.positions,
+            velocities: raw.velocities,
+            unit_cell: raw.unit_cell,
+            atoms: raw.atoms,
+            bonds: raw.bonds,
+            residues: raw.residues,
+        }
+    }
+}
+
+/// Get the list of formats known by chemfiles, as well as all associated metadata.
+///
+/// # Example
+/// ```
+/// let formats = chemfiles::formats_list();
+/// println!("chemfiles supports {} formats:", formats.len());
+/// for format in &formats {
+///     println!(
+///         "   {:<15} {}",
+///         format.name,
+///         format.extension.as_deref().unwrap_or("")
+///     );
+/// }
+/// ```
+#[must_use]
+pub fn formats_list() -> Vec<FormatMetadata> {
+    let mut formats = std::ptr::null_mut();
+    let mut count: u64 = 0;
+    let formats_slice = unsafe {
+        check_success(chfl_formats_list(&mut formats, &mut count));
+        std::slice::from_raw_parts(formats, count.try_into().expect("failed to convert u64 to usize"))
+    };
+    let formats_vec = formats_slice
+        .iter()
+        .map(FormatMetadata::from_raw)
+        .collect();
+    unsafe {
+        let _ = chfl_free(formats as *const _);
+    }
+    return formats_vec;
+}
+
+#[allow(clippy::doc_markdown)]
+/// Get the format that chemfiles would use to read a file at the given
+/// ``path``.
+///
+/// The format is mostly guessed from the path extension, chemfiles only tries
+/// to read the file to distinguish between CIF and mmCIF files. Opening the
+/// file using the returned format string might still fail. For example, it will
+/// fail if the file is not actually formatted according to the guessed format;
+/// or the format/compression combination is not supported (e.g. `XTC / GZ` will
+/// not work since the XTC reader does not support compressed files).
+///
+/// The returned format is represented in a way compatible with the various
+/// `Trajectory` constructors, i.e. `"<format name> [/ <compression>]"`, where
+/// compression is optional.
+///
+/// # Examples
+/// ```
+/// let format = chemfiles::guess_format("trajectory.xyz.xz");
+/// assert_eq!(format, "XYZ / XZ");
+///
+/// let format = chemfiles::guess_format("trajectory.nc");
+/// assert_eq!(format, "Amber NetCDF");
+/// ```
+pub fn guess_format(path: &str) -> String {
+    let path = crate::strings::to_c(path);
+    let mut buffer = vec![0; 128];
+    unsafe {
+        check_success(chfl_guess_format(
+            path.as_ptr(), buffer.as_mut_ptr(), buffer.len() as u64
+        ));
+    }
+    return crate::strings::from_c(buffer.as_ptr());
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/property.rs.html b/0.10.3/src/chemfiles/property.rs.html new file mode 100644 index 000000000..e8f2a3697 --- /dev/null +++ b/0.10.3/src/chemfiles/property.rs.html @@ -0,0 +1,589 @@ +property.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::Drop;
+use std::vec::IntoIter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use strings;
+
+/// A thin wrapper around `CHFL_PROPERTY`
+pub(crate) struct RawProperty {
+    handle: *mut CHFL_PROPERTY,
+}
+
+impl RawProperty {
+    /// Create a `RawProperty` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    pub unsafe fn from_ptr(ptr: *mut CHFL_PROPERTY) -> RawProperty {
+        check_not_null(ptr);
+        RawProperty {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    pub fn as_ptr(&self) -> *const CHFL_PROPERTY {
+        self.handle
+    }
+
+    fn double(value: f64) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_double(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn bool(value: bool) -> RawProperty {
+        let value = if value { 1 } else { 0 };
+        unsafe {
+            let handle = chfl_property_bool(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn vector3d(value: [f64; 3]) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_vector3d(value.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn string(value: &str) -> RawProperty {
+        let buffer = strings::to_c(value);
+        unsafe {
+            let handle = chfl_property_string(buffer.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn get_kind(&self) -> chfl_property_kind {
+        let mut kind = chfl_property_kind::CHFL_PROPERTY_BOOL;
+        unsafe {
+            check_success(chfl_property_get_kind(self.as_ptr(), &mut kind));
+        }
+        return kind;
+    }
+
+    fn get_bool(&self) -> Result<bool, Error> {
+        let mut value = 0;
+        unsafe {
+            check(chfl_property_get_bool(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value != 0);
+    }
+
+    fn get_double(&self) -> Result<f64, Error> {
+        let mut value = 0.0;
+        unsafe {
+            check(chfl_property_get_double(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value);
+    }
+
+    fn get_string(&self) -> Result<String, Error> {
+        let get_string = |ptr, len| unsafe { chfl_property_get_string(self.as_ptr(), ptr, len) };
+        let value = strings::call_autogrow_buffer(64, get_string)?;
+        return Ok(strings::from_c(value.as_ptr()));
+    }
+
+    fn get_vector3d(&self) -> Result<[f64; 3], Error> {
+        let mut value = [0.0; 3];
+        unsafe {
+            check(chfl_property_get_vector3d(self.as_ptr(), value.as_mut_ptr()))?;
+        }
+        return Ok(value);
+    }
+}
+
+impl Drop for RawProperty {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+/// A `Property` is a piece of data that can be associated with an `Atom` or a
+/// `Frame`.
+#[derive(Debug, Clone, PartialEq, PartialOrd)]
+pub enum Property {
+    /// Boolean property
+    Bool(bool),
+    /// Floating point property
+    Double(f64),
+    /// String property
+    String(String),
+    /// 3-dimensional vector property
+    Vector3D([f64; 3]),
+}
+
+impl From<bool> for Property {
+    fn from(value: bool) -> Self {
+        Property::Bool(value)
+    }
+}
+
+impl From<f64> for Property {
+    fn from(value: f64) -> Self {
+        Property::Double(value)
+    }
+}
+
+impl From<String> for Property {
+    fn from(value: String) -> Self {
+        Property::String(value)
+    }
+}
+
+impl<'a> From<&'a str> for Property {
+    fn from(value: &'a str) -> Self {
+        Property::String(value.into())
+    }
+}
+
+impl From<[f64; 3]> for Property {
+    fn from(value: [f64; 3]) -> Self {
+        Property::Vector3D(value)
+    }
+}
+
+impl Property {
+    pub(crate) fn as_raw(&self) -> RawProperty {
+        match *self {
+            Property::Bool(value) => RawProperty::bool(value),
+            Property::Double(value) => RawProperty::double(value),
+            Property::String(ref value) => RawProperty::string(value),
+            Property::Vector3D(value) => RawProperty::vector3d(value),
+        }
+    }
+
+    #[allow(clippy::needless_pass_by_value)]  // raw property
+    pub(crate) fn from_raw(raw: RawProperty) -> Property {
+        match raw.get_kind() {
+            chfl_property_kind::CHFL_PROPERTY_BOOL => {
+                Property::Bool(raw.get_bool().expect("shoudl be a bool"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_DOUBLE => {
+                Property::Double(raw.get_double().expect("should be a double"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_STRING => {
+                Property::String(raw.get_string().expect("should be a string"))
+            }
+            chfl_property_kind::CHFL_PROPERTY_VECTOR3D => {
+                Property::Vector3D(raw.get_vector3d().expect("should be a vector3d"))
+            }
+        }
+    }
+}
+
+/// An iterator over the properties in an atom/frame/residue
+pub struct PropertiesIter<'a> where  {
+    pub(crate) names: IntoIter<String>,
+    pub(crate) getter: Box<dyn Fn(&str) -> Property + 'a>,
+}
+
+impl<'a> Iterator for PropertiesIter<'a> {
+    type Item = (String, Property);
+    fn next(&mut self) -> Option<Self::Item> {
+        self.names.next().map(|name| {
+            let property = (self.getter)(&*name);
+            (name, property)
+        })
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.names.size_hint()
+    }
+
+    fn count(self) -> usize {
+        self.names.count()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    mod raw {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = RawProperty::bool(false);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(property.get_bool(), Ok(false));
+        }
+
+        #[test]
+        fn double() {
+            let property = RawProperty::double(45.0);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(property.get_double(), Ok(45.0));
+        }
+
+        #[test]
+        fn string() {
+            let property = RawProperty::string("test");
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(property.get_string(), Ok("test".into()));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = RawProperty::vector3d([1.2, 3.4, 5.6]);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(property.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+        }
+    }
+
+    mod rust {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = Property::Bool(false);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(raw.get_bool(), Ok(false));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn double() {
+            let property = Property::Double(45.0);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(raw.get_double(), Ok(45.0));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn string() {
+            let property = Property::String("test".into());
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(raw.get_string(), Ok("test".into()));
+
+            assert_eq!(Property::from_raw(raw), property);
+
+            let property = Property::String("long string ".repeat(128));
+            let raw = property.as_raw();
+            assert_eq!(raw.get_string(), Ok("long string ".repeat(128)));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = Property::Vector3D([1.2, 3.4, 5.6]);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(raw.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/residue.rs.html b/0.10.3/src/chemfiles/residue.rs.html new file mode 100644 index 000000000..4c23a4290 --- /dev/null +++ b/0.10.3/src/chemfiles/residue.rs.html @@ -0,0 +1,831 @@ +residue.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+use std::ptr;
+
+use chemfiles_sys::*;
+use errors::{check_not_null, check_success};
+use property::{Property, RawProperty, PropertiesIter};
+use strings;
+
+/// A `Residue` is a group of atoms belonging to the same logical unit. They
+/// can be small molecules, amino-acids in a protein, monomers in polymers,
+/// *etc.*
+pub struct Residue {
+    handle: *mut CHFL_RESIDUE,
+}
+
+/// An analog to a reference to a residue (`&Residue`)
+pub struct ResidueRef<'a> {
+    inner: Residue,
+    marker: PhantomData<&'a Residue>
+}
+
+impl<'a> Deref for ResidueRef<'a> {
+    type Target = Residue;
+    fn deref(&self) -> &Residue {
+        &self.inner
+    }
+}
+
+impl Clone for Residue {
+    fn clone(&self) -> Residue {
+        unsafe {
+            let new_handle = chfl_residue_copy(self.as_ptr());
+            Residue::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Residue {
+    /// Create a `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_RESIDUE) -> Residue {
+        check_not_null(ptr);
+        Residue {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_RESIDUE) -> ResidueRef<'a> {
+        ResidueRef {
+            inner: Residue::from_ptr(ptr as *mut CHFL_RESIDUE),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Create a new residue with the given `name`
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("ALA");
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), None);
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue(buffer.as_ptr());
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Create a new residue with the given `name` and `id` as identifier.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("ALA", 67);
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), Some(67));
+    /// ```
+    pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue_with_id(buffer.as_ptr(), id);
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Get the number of atoms in this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    ///
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// assert_eq!(residue.size(), 3);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_residue_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the identifier of this residue in the initial topology file.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("", 42);
+    /// assert_eq!(residue.id(), Some(42));
+    /// ```
+    pub fn id(&self) -> Option<i64> {
+        let mut resid = 0;
+        let status = unsafe {
+            chfl_residue_id(self.as_ptr(), &mut resid)
+        };
+
+        if status == chfl_status::CHFL_SUCCESS {
+            return Some(resid);
+        } else if status == chfl_status::CHFL_GENERIC_ERROR {
+            return None;
+        }
+
+        // call check_success to panic in case of error
+        check_success(status);
+        unreachable!();
+    }
+
+    /// Get the name of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("water");
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_residue_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(64, get_name).expect("getting residue name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Add the atom at index `atom` in this residue.
+    ///
+    /// This will fail if the atom is already in the residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// assert_eq!(residue.contains(56), true);
+    ///
+    /// // Adding the same atom twice is fine
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// ```
+    pub fn add_atom(&mut self, atom: usize) {
+        unsafe {
+            check_success(chfl_residue_add_atom(self.as_mut_ptr(), atom as u64));
+        }
+    }
+
+    /// Check if the atom at index `i` is in this residue
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.contains(56), true);
+    /// ```
+    pub fn contains(&self, atom: usize) -> bool {
+        let mut inside = 0;
+        unsafe {
+            check_success(chfl_residue_contains(self.as_ptr(), atom as u64, &mut inside));
+        }
+        return inside != 0;
+    }
+
+    /// Get the list of atoms of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.atoms(), vec![]);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.atoms(), vec![56]);
+    /// ```
+    pub fn atoms(&self) -> Vec<usize> {
+        let size = self.size();
+        let count = size as u64;
+        let mut indices = vec![u64::max_value(); size];
+        unsafe {
+            check_success(chfl_residue_atoms(
+                self.as_ptr(),
+                indices.as_mut_ptr(),
+                count,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return indices.into_iter().map(|idx| idx as usize).collect();
+    }
+
+    /// Add a new `property` with the given `name` to this residue.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("a string", "hello");
+    /// residue.set("a double", 3.2);
+    ///
+    /// assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_residue_set_property(
+                self.as_mut_ptr(), buffer.as_ptr(), property.as_ptr()
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(residue.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_residue_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    /// residue.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in residue.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_residue_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_residue_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property"))
+        }
+    }
+}
+
+impl Drop for Residue {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        let copy = residue.clone();
+        assert_eq!(copy.size(), 0);
+
+        residue.add_atom(3);
+        residue.add_atom(7);
+        assert_eq!(residue.size(), 2);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn name() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.name(), "A");
+    }
+
+    #[test]
+    fn id() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.id(), None);
+
+        let residue = Residue::with_id("A", 42);
+        assert_eq!(residue.id(), Some(42));
+
+        let residue = Residue::with_id("A", -3);
+        assert_eq!(residue.id(), Some(-3));
+    }
+
+    #[test]
+    fn atoms() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        residue.add_atom(0);
+        residue.add_atom(3);
+        residue.add_atom(45);
+        assert_eq!(residue.size(), 3);
+
+        assert!(residue.contains(3));
+        assert!(!residue.contains(5));
+
+        assert_eq!(residue.atoms(), vec![0, 3, 45]);
+    }
+
+    #[test]
+    fn property() {
+        let mut residue = Residue::new("ALA");
+
+        residue.set("foo", -22.0);
+        assert_eq!(residue.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(residue.get("bar"), None);
+
+        residue.set("bar", Property::String("here".into()));
+        for (name, property) in residue.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/selection.rs.html b/0.10.3/src/chemfiles/selection.rs.html new file mode 100644 index 000000000..f76bc3338 --- /dev/null +++ b/0.10.3/src/chemfiles/selection.rs.html @@ -0,0 +1,865 @@ +selection.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Index};
+use std::iter::IntoIterator;
+use std::slice::Iter;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error, Status};
+use strings;
+use frame::Frame;
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+/// A `Match` is a set of atomic indexes matching a given selection. It can
+/// mostly be used like a `&[usize]`.
+pub struct Match {
+    size: usize,
+    atoms: [usize; 4],
+}
+
+#[allow(clippy::len_without_is_empty)]
+impl Match {
+    /// Get the length of the Match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// ```
+    pub fn len(&self) -> usize {
+        self.size
+    }
+
+    /// Create a new match containing the atoms in the `atoms` slice.
+    ///
+    /// # Panics
+    ///
+    /// If the slice contains more than 4 elements, which is the maximal size
+    /// of a match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// assert_eq!(atomic_match[0], 3);
+    /// assert_eq!(atomic_match[1], 4);
+    /// assert_eq!(atomic_match[2], 5);
+    /// ```
+    pub fn new(atoms: &[usize]) -> Match {
+        assert!(atoms.len() <= 4);
+        let size = atoms.len();
+        let mut matches = [usize::max_value(); 4];
+        for (i, atom) in atoms.iter().enumerate() {
+            matches[i] = *atom;
+        }
+        Match {
+            size,
+            atoms: matches,
+        }
+    }
+
+    /// Iterate over the atomic indexes in the match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// let mut iter = atomic_match.iter();
+    ///
+    /// assert_eq!(iter.next(), Some(&3));
+    /// assert_eq!(iter.next(), Some(&4));
+    /// assert_eq!(iter.next(), Some(&5));
+    /// assert_eq!(iter.next(), None);
+    /// ```
+    pub fn iter(&self) -> Iter<usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+impl Index<usize> for Match {
+    type Output = usize;
+    fn index(&self, i: usize) -> &Self::Output {
+        assert!(i < self.len());
+        &self.atoms[i]
+    }
+}
+
+impl<'a> IntoIterator for &'a Match {
+    type Item = &'a usize;
+    type IntoIter = Iter<'a, usize>;
+    fn into_iter(self) -> Iter<'a, usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+/// A `Selection` allow to select atoms in a `Frame`, from a selection
+/// language. The selection language is built by combining basic operations.
+/// Each basic operation follows the `<selector>[(<variable>)] <operator>
+/// <value>` structure, where `<operator>` is a comparison operator in
+/// `== != < <= > >=`.
+pub struct Selection {
+    handle: *mut CHFL_SELECTION,
+}
+
+impl Clone for Selection {
+    fn clone(&self) -> Selection {
+        unsafe {
+            let new_handle = chfl_selection_copy(self.as_ptr());
+            Selection::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Drop for Selection {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl Selection {
+    /// Create a `Selection` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_SELECTION) -> Selection {
+        check_not_null(ptr);
+        Selection {
+            handle: ptr
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Create a new selection from the given selection string.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the selection string is invalid.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// ```
+    pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error> {
+        let buffer = strings::to_c(selection.into());
+        unsafe {
+            let handle = chfl_selection(buffer.as_ptr());
+            if handle.is_null() {
+                Err(Error {
+                    status: Status::SelectionError,
+                    message: Error::last_error()
+                })
+            } else {
+                Ok(Selection::from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the size of the selection, i.e. the number of atoms we are selecting
+    /// together.
+    ///
+    /// This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond'
+    /// context, 3 for the 'three' and 'angles' context and 4 for the 'four'
+    /// and 'dihedral' context.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// assert_eq!(selection.size(), 2);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_selection_size(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the selection string used to create this selection.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("name H").unwrap();
+    /// assert_eq!(selection.string(), "name H");
+    /// ```
+    pub fn string(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_selection_string(self.as_ptr(), ptr, len) };
+        let selection = strings::call_autogrow_buffer(1024, get_string).expect("failed to get selection string");
+        return strings::from_c(selection.as_ptr());
+    }
+
+    /// Evaluate a selection for a given frame, and return the corresponding
+    /// matches.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// let matches = selection.evaluate(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    ///
+    /// assert_eq!(matches[0].len(), 2);
+    /// assert_eq!(matches[0][0], 0);
+    /// assert_eq!(matches[0][1], 1);
+    ///
+    /// assert_eq!(matches[1].len(), 2);
+    /// assert_eq!(matches[1][0], 2);
+    /// assert_eq!(matches[1][1], 1);
+    /// ```
+    pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match> {
+        #![allow(clippy::cast_possible_truncation)]
+        let mut count = 0;
+        unsafe {
+            check(chfl_selection_evaluate(
+                self.as_mut_ptr(), frame.as_ptr(), &mut count
+            )).expect("failed to evaluate selection");
+        }
+
+        let size = count as usize;
+        let mut chfl_matches = vec![chfl_match { size: 0, atoms: [0; 4] }; size];
+        unsafe {
+            check(chfl_selection_matches(
+                self.handle,
+                chfl_matches.as_mut_ptr(),
+                count
+            )).expect("failed to extract matches");
+        }
+
+        return chfl_matches.into_iter()
+            .map(|chfl_match| Match {
+                size: chfl_match.size as usize,
+                atoms: [
+                    chfl_match.atoms[0] as usize,
+                    chfl_match.atoms[1] as usize,
+                    chfl_match.atoms[2] as usize,
+                    chfl_match.atoms[3] as usize,
+                ],
+            })
+            .collect();
+    }
+
+    /// Evaluates a selection of size 1 on a given `frame`. This function
+    /// returns the list of atomic indexes in the frame matching this selection.
+    ///
+    /// # Panics
+    ///
+    /// If the selection size is not 1
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("name H").unwrap();
+    /// let matches = selection.list(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    /// assert_eq!(matches[0], 0);
+    /// assert_eq!(matches[1], 2);
+    /// ```
+    pub fn list(&mut self, frame: &Frame) -> Vec<usize> {
+        if self.size() != 1 {
+            panic!("can not call `Selection::list` on a multiple selection");
+        }
+        return self.evaluate(frame)
+            .into_iter()
+            .map(|m| m[0] as usize)
+            .collect();
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use Frame;
+    use Topology;
+    use Atom;
+
+    #[test]
+    fn clone() {
+        let selection = Selection::new("name H").unwrap();
+
+        let copy = selection.clone();
+        assert_eq!(selection.size(), 1);
+        assert_eq!(copy.size(), 1);
+    }
+
+    fn testing_frame() -> Frame {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("H"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("H"));
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(2, 3);
+
+        let mut frame = Frame::new();
+        frame.resize(4);
+        frame.set_topology(&topology).unwrap();
+        return frame;
+    }
+
+    mod matches {
+        use super::*;
+
+        #[test]
+        fn index() {
+            let m = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+            assert_eq!(m[2], 3);
+            assert_eq!(m[3], 4);
+
+            let m = Match::new(&[1, 2]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+        }
+
+        #[test]
+        fn iter() {
+            let match_ = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(match_.iter().copied().collect::<Vec<usize>>(), vec![1, 2, 3, 4]);
+
+            let v = vec![1, 2, 3, 4];
+            for (i, &m) in match_.iter().enumerate() {
+                assert_eq!(v[i], m);
+            }
+        }
+
+        #[test]
+        #[should_panic]
+        fn out_of_bound() {
+            let m = Match::new(&[1, 2]);
+            let _ = m[2];
+        }
+
+        #[test]
+        #[should_panic]
+        fn too_big() {
+            let _ = Match::new(&[1, 2, 3, 5, 4]);
+        }
+    }
+
+    #[test]
+    fn size() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.size(), 1);
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 3);
+
+        let selection = Selection::new("four: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 4);
+    }
+
+    #[test]
+    fn string() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.string(), "name H");
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.string(), "angles: name(#1) H");
+    }
+
+    #[test]
+    fn evaluate() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.evaluate(&frame);
+        assert_eq!(res, &[Match::new(&[0]), Match::new(&[3])]);
+
+        let mut selection = Selection::new("angles: all").unwrap();
+        let res = selection.evaluate(&frame);
+        for m in &[Match::new(&[0, 1, 2]), Match::new(&[1, 2, 3])] {
+            assert!(res.iter().any(|r| r == m));
+        }
+    }
+
+    #[test]
+    fn list() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.list(&frame);
+        assert_eq!(res, vec![0, 3]);
+    }
+
+    #[test]
+    #[should_panic = "can not call `Selection::list` on a multiple selection"]
+    fn list_on_size_1_selection() {
+        let frame = testing_frame();
+        let mut selection = Selection::new("pairs: name(#1) H").unwrap();
+        let _list = selection.list(&frame);
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/strings.rs.html b/0.10.3/src/chemfiles/strings.rs.html new file mode 100644 index 000000000..db5bd8f62 --- /dev/null +++ b/0.10.3/src/chemfiles/strings.rs.html @@ -0,0 +1,125 @@ +strings.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! String conversions between C and Rust
+use std::ffi::{CStr, CString};
+use std::os::raw::c_char;
+
+use chemfiles_sys::chfl_status;
+use errors::{check, Error};
+
+/// Create a Rust string from a C string. Clones all characters in `buffer`.
+pub fn from_c(buffer: *const c_char) -> String {
+    unsafe {
+        let rust_str = CStr::from_ptr(buffer)
+            .to_str()
+            .expect("Invalid Rust string from C");
+        return String::from(rust_str);
+    }
+}
+
+/// Create a C string from a Rust string.
+pub fn to_c(string: &str) -> CString {
+    CString::new(string).expect("Invalid C string from Rust")
+}
+
+/// Check if a string buffer was big enough when passed to a C function
+fn buffer_was_big_enough(buffer: &[c_char]) -> bool {
+    let len = buffer.len();
+    if len < 2 {
+        false
+    } else {
+        // The C code should always set the last element to 0
+        debug_assert_eq!(buffer[len - 1], 0);
+        buffer[len - 2] == 0
+    }
+}
+
+/// Call `callback` C function with a string buffer and it length, using
+/// `initial` as the buffer initial size. If the buffer was filled and the
+/// result truncated by the C library, grow the buffer and try again until we
+/// get all the data. Then return the filled buffer to the caller.
+pub fn call_autogrow_buffer<F>(initial: usize, callback: F) -> Result<Vec<c_char>, Error>
+where
+    F: Fn(*mut c_char, u64) -> chfl_status,
+{
+    let mut size = initial;
+    let mut buffer = vec![0; size];
+    check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+
+    while !buffer_was_big_enough(&buffer) {
+        // Grow the buffer and retry
+        size *= 2;
+        buffer.resize(size, 0);
+        check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+    }
+
+    Ok(buffer)
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/topology.rs.html b/0.10.3/src/chemfiles/topology.rs.html new file mode 100644 index 000000000..e5eb7525b --- /dev/null +++ b/0.10.3/src/chemfiles/topology.rs.html @@ -0,0 +1,2019 @@ +topology.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+1000
+1001
+1002
+1003
+1004
+1005
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::ops::{Drop, Deref};
+use std::marker::PhantomData;
+
+use chemfiles_sys::*;
+use errors::{check, check_not_null, check_success, Error};
+use super::{Atom, AtomRef, AtomMut};
+use super::{Residue, ResidueRef};
+
+/// Possible bond order associated with bonds
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+pub enum BondOrder {
+    /// Unknown or unspecified bond order
+    Unknown = chfl_bond_order::CHFL_BOND_UNKNOWN as isize,
+    /// Single bond
+    Single = chfl_bond_order::CHFL_BOND_SINGLE as isize,
+    /// Double bond
+    Double = chfl_bond_order::CHFL_BOND_DOUBLE as isize,
+    /// Triple bond
+    Triple = chfl_bond_order::CHFL_BOND_TRIPLE as isize,
+    /// Quadruple bond (present in some metals)
+    Quadruple = chfl_bond_order::CHFL_BOND_QUADRUPLE as isize,
+    /// Quintuplet bond (present in some metals)
+    Quintuplet = chfl_bond_order::CHFL_BOND_QUINTUPLET as isize,
+    /// Amide bond (required by some file formats)
+    Amide = chfl_bond_order::CHFL_BOND_AMIDE as isize,
+    /// Aromatic bond (required by some file formats)
+    Aromatic = chfl_bond_order::CHFL_BOND_AROMATIC as isize,
+}
+
+impl BondOrder {
+    pub(crate) fn as_raw(self) -> chfl_bond_order {
+        match self {
+            BondOrder::Unknown => chfl_bond_order::CHFL_BOND_UNKNOWN,
+            BondOrder::Single => chfl_bond_order::CHFL_BOND_SINGLE,
+            BondOrder::Double => chfl_bond_order::CHFL_BOND_DOUBLE,
+            BondOrder::Triple => chfl_bond_order::CHFL_BOND_TRIPLE,
+            BondOrder::Quadruple => chfl_bond_order::CHFL_BOND_QUADRUPLE,
+            BondOrder::Quintuplet => chfl_bond_order::CHFL_BOND_QUINTUPLET,
+            BondOrder::Amide => chfl_bond_order::CHFL_BOND_AMIDE,
+            BondOrder::Aromatic => chfl_bond_order::CHFL_BOND_AROMATIC,
+        }
+    }
+}
+
+impl From<chfl_bond_order> for BondOrder {
+    fn from(order: chfl_bond_order) -> BondOrder {
+        match order {
+            chfl_bond_order::CHFL_BOND_UNKNOWN => BondOrder::Unknown,
+            chfl_bond_order::CHFL_BOND_SINGLE => BondOrder::Single,
+            chfl_bond_order::CHFL_BOND_DOUBLE => BondOrder::Double,
+            chfl_bond_order::CHFL_BOND_TRIPLE => BondOrder::Triple,
+            chfl_bond_order::CHFL_BOND_QUADRUPLE => BondOrder::Quadruple,
+            chfl_bond_order::CHFL_BOND_QUINTUPLET => BondOrder::Quintuplet,
+            chfl_bond_order::CHFL_BOND_AMIDE => BondOrder::Amide,
+            chfl_bond_order::CHFL_BOND_AROMATIC => BondOrder::Aromatic,
+        }
+    }
+}
+
+/// A `Topology` contains the definition of all the atoms in the system, and
+/// the liaisons between the atoms (bonds, angles, dihedrals, ...). It will
+/// also contain all the residues information if it is available.
+pub struct Topology {
+    handle: *mut CHFL_TOPOLOGY,
+}
+
+/// An analog to a reference to a topology (`&Topology`)
+pub struct TopologyRef<'a> {
+    inner: Topology,
+    marker: PhantomData<&'a Topology>
+}
+
+impl<'a> Deref for TopologyRef<'a> {
+    type Target = Topology;
+    fn deref(&self) -> &Topology {
+        &self.inner
+    }
+}
+
+impl Clone for Topology {
+    fn clone(&self) -> Topology {
+        unsafe {
+            let new_handle = chfl_topology_copy(self.as_ptr());
+            Topology::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Topology {
+    /// Create a `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TOPOLOGY) -> Topology {
+        check_not_null(ptr);
+        Topology {
+            handle: ptr
+        }
+    }
+
+    /// Create a borrowed `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_TOPOLOGY) -> TopologyRef<'a> {
+        TopologyRef {
+            inner: Topology::from_ptr(ptr as *mut CHFL_TOPOLOGY),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Create a new empty topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    /// ```
+    pub fn new() -> Topology {
+        unsafe {
+            Topology::from_ptr(chfl_topology())
+        }
+    }
+
+    /// Get a reference of the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// let atom = topology.atom(4);
+    /// assert_eq!(atom.name(), "");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64
+            );
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// assert_eq!(topology.atom(4).name(), "");
+    ///
+    /// topology.atom_mut(4).set_name("Fe");
+    /// assert_eq!(topology.atom(4).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_topology(
+                self.as_mut_ptr(), index as u64
+            );
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_topology_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize this topology to hold `natoms` atoms, inserting dummy atoms if
+    /// the new size if bigger than the old one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_topology_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` at the end of this topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Atom};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Mg"));
+    ///
+    /// let atom = topology.atom(0);
+    /// assert_eq!(atom.name(), "Mg");
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom) {
+        unsafe {
+            check_success(chfl_topology_add_atom(self.as_mut_ptr(), atom.as_ptr()));
+        }
+    }
+
+    /// Remove an `Atom` from this topology by `index`. This modify all the
+    /// other atoms indexes.
+    ///
+    /// # Panics
+    ///
+    /// If the `index` is out of bounds
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(9);
+    /// assert_eq!(topology.size(), 9);
+    ///
+    /// topology.remove(7);
+    /// assert_eq!(topology.size(), 8);
+    /// ```
+    pub fn remove(&mut self, index: usize) {
+        unsafe {
+            check_success(chfl_topology_remove(self.as_mut_ptr(), index as u64));
+        }
+    }
+
+    /// Get the number of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds_count(), 3);
+    /// ```
+    pub fn bonds_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_bonds_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.angles_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles_count(), 2);
+    /// ```
+    pub fn angles_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_angles_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.dihedrals_count(), 1);
+    /// ```
+    pub fn dihedrals_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_dihedrals_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    /// assert_eq!(topology.impropers_count(), 1);
+    /// ```
+    pub fn impropers_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_impropers_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the list of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+    /// ```
+    pub fn bonds(&self) -> Vec<[usize; 2]> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![[u64::max_value(); 2]; size];
+        unsafe {
+            check_success(chfl_topology_bonds(self.as_ptr(), bonds.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return bonds
+            .into_iter()
+            .map(|bond| [bond[0] as usize, bond[1] as usize])
+            .collect();
+    }
+
+    /// Get the list of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+    /// ```
+    pub fn angles(&self) -> Vec<[usize; 3]> {
+        let size = self.angles_count();
+        let count = size as u64;
+        let mut angles = vec![[u64::max_value(); 3]; size];
+        unsafe {
+            check_success(chfl_topology_angles(self.as_ptr(), angles.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return angles
+            .into_iter()
+            .map(|angle| [angle[0] as usize, angle[1] as usize, angle[2] as usize])
+            .collect();
+    }
+
+    /// Get the list of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    ///
+    /// assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+    /// ```
+    pub fn dihedrals(&self) -> Vec<[usize; 4]> {
+        let size = self.dihedrals_count();
+        let count = size as u64;
+        let mut dihedrals = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_dihedrals(
+                self.as_ptr(), dihedrals.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return dihedrals
+            .into_iter()
+            .map(|dihedral| {
+                [
+                    dihedral[0] as usize,
+                    dihedral[1] as usize,
+                    dihedral[2] as usize,
+                    dihedral[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Get the list of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    ///
+    /// assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+    /// ```
+    pub fn impropers(&self) -> Vec<[usize; 4]> {
+        let size = self.impropers_count();
+        let count = size as u64;
+        let mut impropers = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_impropers(
+                self.as_ptr(), impropers.as_mut_ptr(), count
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return impropers
+            .into_iter()
+            .map(|improper| {
+                [
+                    improper[0] as usize,
+                    improper[1] as usize,
+                    improper[2] as usize,
+                    improper[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    /// assert_eq!(topology.angles().len(), 1);
+    ///
+    /// topology.clear_bonds();
+    /// assert!(topology.bonds().is_empty());
+    /// assert!(topology.angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_topology_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_topology_bond_with_order(
+                self.as_mut_ptr(), i as u64, j as u64, order.as_raw()
+            ));
+        }
+    }
+
+    /// Get the bond order for the bond between the atoms at indexes `i` and
+    /// `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn bond_order(&self, i: usize, j: usize) -> BondOrder {
+        let mut order = chfl_bond_order::CHFL_BOND_UNKNOWN;
+        unsafe {
+            check_success(chfl_topology_bond_order(
+                self.as_ptr(), i as u64, j as u64, &mut order
+            ));
+        }
+        return order.into()
+    }
+
+    /// Get the bond order for all the bonds in the topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(3);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// topology.add_bond_with_order(0, 2, BondOrder::Single);
+    ///
+    /// assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+    /// ```
+    pub fn bond_orders(&self) -> Vec<BondOrder> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![BondOrder::Unknown; size];
+        unsafe {
+            check_success(chfl_topology_bond_orders(
+                self.as_ptr(),
+                // Casting BondOrder to chfl_bond_order is safe, as they are
+                // both `repr(C)` enums with the same values.
+                bonds.as_mut_ptr().cast(),
+                count
+            ));
+        }
+        return bonds;
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// this topology.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// topology.remove_bond(0, 1);
+    /// assert_eq!(topology.bonds_count(), 1);
+    ///
+    /// // Removing a bond that does not exists is fine
+    /// topology.remove_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 1);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Get a reference to the residue at index `index` from this topology.
+    ///
+    /// The residue index in the topology is not always the same as the residue
+    /// `id`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn residue(&self, index: u64) -> Option<ResidueRef> {
+        unsafe {
+            let handle = chfl_residue_from_topology(self.as_ptr(), index as u64);
+            if handle.is_null() {
+                None
+            } else {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get a copy of the residue containing the atom at index `index` in this
+    /// topology, if any.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.resize(8);
+    ///
+    /// let mut residue = Residue::new("water");
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// topology.add_residue(&residue).unwrap();
+    ///
+    /// let residue = topology.residue_for_atom(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    ///
+    /// assert!(topology.residue_for_atom(6).is_none());
+    /// ```
+    pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef> {
+        let handle = unsafe {
+            chfl_residue_for_atom(self.as_ptr(), index as u64)
+        };
+        if handle.is_null() {
+            None
+        } else {
+            unsafe {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the number of residues in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.residues_count(), 0);
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    /// assert_eq!(topology.residues_count(), 2);
+    /// ```
+    pub fn residues_count(&self) -> u64 {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_residues_count(self.as_ptr(), &mut count));
+        }
+        return count;
+    }
+
+    /// Add a residue to this topology.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue `id` is not already in the topology,
+    /// or if the residue contains atoms that are already in another residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe {
+            check(chfl_topology_add_residue(self.as_mut_ptr(), residue.as_ptr()))
+        }
+    }
+
+    /// Check if the two residues `first` and `second` from the `topology` are
+    /// linked together, *i.e.* if there is a bond between one atom in the
+    /// first residue and one atom in the second one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    ///
+    /// let first = topology.residue(0).unwrap();
+    /// let second = topology.residue(1).unwrap();
+    /// assert_eq!(topology.are_linked(&first, &second), false);
+    /// ```
+    pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool {
+        let mut linked = 0;
+        unsafe {
+            check_success(chfl_topology_residues_linked(
+                self.as_ptr(),
+                first.as_ptr(),
+                second.as_ptr(),
+                &mut linked
+            ));
+        }
+        return linked != 0;
+    }
+}
+
+impl Drop for Topology {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use {Atom, Residue};
+
+    #[test]
+    fn clone() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        let copy = topology.clone();
+        assert_eq!(copy.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+
+        topology.remove(7);
+        assert_eq!(topology.size(), 9);
+
+        topology.add_atom(&Atom::new("Hg"));
+        assert_eq!(topology.size(), 10);
+    }
+
+    #[test]
+    fn atoms() {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(3).name(), "Fe");
+    }
+
+    #[test]
+    fn remove() {
+        let mut topology = Topology::new();
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "W");
+
+        topology.remove(1);
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "Fe");
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove() {
+        let mut topology = Topology::new();
+        topology.resize(18);
+        topology.remove(33);
+    }
+
+
+    #[test]
+    fn bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.bonds_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(9, 2);
+        topology.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(topology.bonds_count(), 3);
+
+        assert_eq!(topology.bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(topology.bond_orders(), expected);
+
+        assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(topology.bond_order(3, 7), BondOrder::Aromatic);
+
+        topology.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        topology.remove_bond(8, 7);
+        assert_eq!(topology.bonds_count(), 2);
+
+        topology.clear_bonds();
+        assert_eq!(topology.bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn angles() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.angles_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 7);
+        topology.add_bond(3, 5);
+        assert_eq!(topology.angles_count(), 2);
+
+        assert_eq!(topology.angles(), vec![[0, 1, 2], [5, 3, 7]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.angles_count(), 0);
+    }
+
+    #[test]
+    fn dihedrals() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.dihedrals_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 2);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(7, 10);
+        assert_eq!(topology.dihedrals_count(), 2);
+
+        assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3], [5, 4, 7, 10]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.dihedrals_count(), 0);
+    }
+
+    #[test]
+    fn impropers() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.impropers_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(0, 2);
+        topology.add_bond(0, 3);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(4, 8);
+        assert_eq!(topology.impropers_count(), 2);
+
+        assert_eq!(topology.impropers(), vec![[1, 0, 2, 3], [5, 4, 7, 8]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.impropers_count(), 0);
+    }
+
+    #[test]
+    fn residues() {
+        let mut topology = Topology::new();
+        topology.resize(4);
+        assert_eq!(topology.residues_count(), 0);
+
+        let mut residue = Residue::new("Foo");
+        residue.add_atom(0);
+        residue.add_atom(2);
+
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 1);
+
+        assert_eq!(topology.residue(0).unwrap().name(), "Foo");
+        {
+            let residue = topology.residue_for_atom(2).unwrap();
+            assert_eq!(residue.name(), "Foo");
+        }
+
+        let mut residue = Residue::new("Bar");
+        residue.add_atom(3);
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 2);
+
+        let first = topology.residue(0).unwrap();
+        let second = topology.residue(0).unwrap();
+        assert!(topology.are_linked(&first, &second));
+
+        // missing residue
+        assert!(topology.residue_for_atom(1).is_none());
+        // out of bounds
+        assert!(topology.residue_for_atom(67).is_none());
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/src/chemfiles/trajectory.rs.html b/0.10.3/src/chemfiles/trajectory.rs.html new file mode 100644 index 000000000..ad66e128c --- /dev/null +++ b/0.10.3/src/chemfiles/trajectory.rs.html @@ -0,0 +1,1185 @@ +trajectory.rs - source +
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::convert::TryInto;
+use std::path::Path;
+use std::ptr;
+use std::os::raw::c_char;
+
+use chemfiles_sys::*;
+use errors::{check, check_success, Error, Status};
+use strings;
+
+use {Frame, Topology, UnitCell};
+
+/// The `Trajectory` type is the main entry point when using chemfiles. A
+/// `Trajectory` behave a bit like a file, allowing to read and/or write
+/// `Frame`.
+pub struct Trajectory {
+    handle: *mut CHFL_TRAJECTORY,
+}
+
+impl Trajectory {
+    /// Create a `Trajectory` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TRAJECTORY) -> Result<Trajectory, Error> {
+        if ptr.is_null() {
+            Err(Error {
+                status: Status::FileError,
+                message: Error::last_error()
+            })
+        } else {
+            Ok(Trajectory {
+                handle: ptr
+            })
+        }
+    }
+
+    /// Get the underlying C pointer as a pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Open the file at the given `path` in the given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// ```
+    pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_open(path.as_ptr(), mode as c_char);
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Open the file at the given `path` using a specific file `format` and the
+    /// given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// Specifying a format is needed when the file format does not match the
+    /// extension, or when there is not standard extension for this format. If
+    /// `format` is an empty string, the format will be guessed from the
+    /// extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+    /// ```
+    pub fn open_with_format<'a, P, S>(filename: P, mode: char, format: S) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let filename =
+            filename.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(filename.as_ref()))?;
+
+        let filename = strings::to_c(filename);
+        let format = strings::to_c(format.into());
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_with_format(
+                filename.as_ptr(), mode as c_char, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read a memory buffer as though it was a formatted file.
+    ///
+    /// The memory buffer used to store the file is given using the `data`
+    /// argument. The `format` parameter is required and should follow the same
+    /// rules as in the main `Trajectory` constructor.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or if the format do not support in-memory readers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+    /// let mut trajectory = Trajectory::memory_reader(aromatics, "SMI").unwrap();
+    /// let mut frame = Frame::new();
+    /// trajectory.read(&mut frame).unwrap();
+    /// assert_eq!(frame.size(), 6);
+    /// ```
+    pub fn memory_reader<'a, S>(data: S, format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let data = strings::to_c(data.into());
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_reader(
+                data.as_ptr(), data.as_bytes().len() as u64, format.as_ptr()
+            );
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Write to a memory buffer as though it was a formatted file.
+    ///
+    /// The `format` parameter should follow the same rules as in the main
+    /// `Trajectory` constructor, except that compression specification
+    /// is not supported.
+    ///
+    /// The `memory_buffer` function can be used to retrieve the data written
+    /// to memory of the `Trajectory`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the format do not support in-memory writers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Trajectory;
+    /// let trajectory_memory = Trajectory::memory_writer("SMI");
+    ///
+    /// // Binary formats typically do not support this feature
+    /// assert!(Trajectory::memory_writer("XTC").is_err());
+    /// ```
+    pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>
+    where S: Into<&'a str>,
+    {
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_writer(format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read the next step of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of atom
+    /// in the next step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read(&mut frame).unwrap();
+    /// ```
+    pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read(self.as_mut_ptr(), frame.as_mut_ptr()))
+        }
+    }
+
+    /// Read a specific `step` of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of
+    /// atom at this step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read_step(10, &mut frame).unwrap();
+    /// ```
+    pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read_step(self.as_mut_ptr(), step as u64, frame.as_mut_ptr()))
+        }
+    }
+
+    /// Write a `frame` to this trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.write(&mut frame).unwrap();
+    /// ```
+    pub fn write(&mut self, frame: &Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_write(self.as_mut_ptr(), frame.as_ptr()))
+        }
+    }
+
+    /// Set the `topology` associated with this trajectory. This topology will
+    /// be used when reading and writing the files, replacing any topology in
+    /// the frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Atom, Topology};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_atom(&Atom::new("O"));
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    ///
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_topology(&topology);
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) {
+        unsafe {
+            check_success(chfl_trajectory_set_topology(self.as_mut_ptr(), topology.as_ptr()));
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in `format`;
+    /// and extracting the topology of this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_file("topology.pdb").unwrap();
+    /// ```
+    pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), ptr::null()))
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in
+    /// `format`; and extracting the topology of this frame.
+    ///
+    /// If `format` is an empty string, the format will be guessed from the
+    /// `path` extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+    /// ```
+    pub fn set_topology_with_format<'a, P, S>(&mut self, path: P, format: S) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let path = path.as_ref().to_str().ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let format = strings::to_c(format.into());
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(self.as_mut_ptr(), path.as_ptr(), format.as_ptr()))
+        }
+    }
+
+    /// Set the unit `cell` associated with a trajectory. This cell will be
+    /// used when reading and writing the files, replacing any unit cell in the
+    /// frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, UnitCell};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_trajectory_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get the number of steps (the number of frames) in a trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// println!("This trajectory contains {} steps", trajectory.nsteps());
+    /// ```
+    // FIXME should this take &self instead? The file can be modified by this
+    // function, but the format should reset the state.
+    pub fn nsteps(&mut self) -> usize {
+        let mut res = 0;
+        unsafe {
+            check(chfl_trajectory_nsteps(self.as_mut_ptr(), &mut res)).expect(
+                "failed to get the number of steps in this trajectory"
+            );
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return res as usize;
+    }
+
+    /// Obtain the memory buffer written to by the trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This fails if the trajectory was not opened with
+    /// `Trajectory::memory_writer`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, BondOrder, Frame, Trajectory};
+    /// let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+    ///
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_bond_with_order(0, 1, BondOrder::Single);
+    ///
+    /// trajectory_memory.write(&frame).unwrap();
+    ///
+    /// let result = trajectory_memory.memory_buffer();
+    /// assert_eq!(result.unwrap(), "CC\n");
+    /// ```
+    #[allow(clippy::cast_possible_truncation)]
+    pub fn memory_buffer(&self) -> Result<&str, Error> {
+            let mut ptr: *const c_char = std::ptr::null();
+            let mut count: u64 = 0;
+            let buffer = unsafe {
+                check(chfl_trajectory_memory_buffer(self.as_ptr(), &mut ptr, &mut count))?;
+                 std::slice::from_raw_parts(
+                    ptr.cast(), count.try_into().expect("failed to convert u64 to usize")
+                )
+            };
+
+            let string = std::str::from_utf8(buffer)?;
+            Ok(string)
+    }
+
+    /// Get file path for this trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// assert_eq!(trajectory.path(), "water.xyz");
+    /// ```
+    pub fn path(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_trajectory_path(self.as_ptr(), ptr, len) };
+        let path = strings::call_autogrow_buffer(1024, get_string).expect("failed to get path string");
+        return strings::from_c(path.as_ptr());
+    }
+}
+
+impl Drop for Trajectory {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_trajectory_close(self.as_ptr());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use std::fs;
+    use std::path::Path;
+    use std::io::Read;
+
+    use approx::assert_ulps_eq;
+
+    use {Atom, CellShape, Frame, Topology, UnitCell};
+
+    #[test]
+    fn read() {
+        let root = Path::new(file!()).parent().unwrap().join("..");
+        let filename = root.join("data").join("water.xyz");
+        let mut file = Trajectory::open(filename.to_str().unwrap(), 'r').unwrap();
+
+        if cfg!(target_family = "unix") {
+            assert_eq!(file.path(), "src/../data/water.xyz");
+        } else if cfg!(target_family = "windows") {
+            assert_eq!(file.path(), "src\\..\\data\\water.xyz");
+        } else {
+            panic!("please add test for this OS!");
+        }
+
+        assert_eq!(file.nsteps(), 100);
+
+        let mut frame = Frame::new();
+        assert!(file.read(&mut frame).is_ok());
+
+        assert_eq!(frame.size(), 297);
+        assert_ulps_eq!(frame.positions()[0][0], 0.417219);
+        assert_ulps_eq!(frame.positions()[0][1], 8.303366);
+        assert_ulps_eq!(frame.positions()[0][2], 11.737172);
+        assert_ulps_eq!(frame.positions()[124][0], 5.099554);
+        assert_ulps_eq!(frame.positions()[124][1], -0.045104);
+        assert_ulps_eq!(frame.positions()[124][2], 14.153846);
+
+        assert_eq!(frame.atom(0).name(), "O");
+
+        file.set_cell(&UnitCell::new([30.0, 30.0, 30.0]));
+        assert!(file.read_step(41, &mut frame).is_ok());
+        let cell = frame.cell().clone();
+        assert_eq!(cell.lengths(), [30.0, 30.0, 30.0]);
+
+
+        assert_ulps_eq!(frame.positions()[0][0], 0.761277);
+        assert_ulps_eq!(frame.positions()[0][1], 8.106125);
+        assert_ulps_eq!(frame.positions()[0][2], 10.622949);
+        assert_ulps_eq!(frame.positions()[124][0], 5.13242);
+        assert_ulps_eq!(frame.positions()[124][1], 0.079862);
+        assert_ulps_eq!(frame.positions()[124][2], 14.194161);
+
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 0);
+        }
+
+        assert!(frame.guess_bonds().is_ok());
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 180);
+            assert_eq!(topology.angles_count(), 84);
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("Cs");
+        for _ in 0..297 {
+            topology.add_atom(&atom);
+        }
+
+        file.set_topology(&topology);
+        assert!(file.read_step(10, &mut frame).is_ok());
+        assert_eq!(frame.atom(42).name(), "Cs");
+
+        let filename = root.join("data").join("topology.xyz");
+        assert!(file.set_topology_file(filename.to_str().unwrap()).is_ok());
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.atom(100).name(), "Rd");
+
+        let filename = root.join("data").join("helium.xyz.but.not.really");
+        let filename = filename.to_str().unwrap();
+        let mut file = Trajectory::open_with_format(filename, 'r', "XYZ").unwrap();
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.size(), 125);
+    }
+
+    fn write_file(path: &str) {
+        let mut file = Trajectory::open(path, 'w').unwrap();
+        let mut frame = Frame::new();
+        frame.resize(4);
+
+        for position in frame.positions_mut() {
+            *position = [1.0, 2.0, 3.0];
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("X");
+        for _ in 0..4 {
+            topology.add_atom(&atom);
+        }
+        frame.set_topology(&topology).unwrap();
+        assert!(file.write(&frame).is_ok());
+    }
+
+    #[test]
+    fn write() {
+        let filename = "test-tmp.xyz";
+        write_file(filename);
+
+        let expected_content = "4
+Properties=species:S:1:pos:R:3
+X 1 2 3
+X 1 2 3
+X 1 2 3
+X 1 2 3".lines().collect::<Vec<_>>();
+
+        let mut file = fs::File::open(filename).unwrap();
+        let mut content = String::new();
+        let _ = file.read_to_string(&mut content).unwrap();
+
+        assert_eq!(expected_content, content.lines().collect::<Vec<_>>());
+        fs::remove_file(filename).unwrap();
+    }
+
+    #[test]
+    fn memory() {
+        // formats in decreasing order of their memory buffer length to check null termination
+        for format in &["CSSR", "GRO", "XYZ"] {
+            let mut frame_write = Frame::new();
+            frame_write.add_atom(&Atom::new("H"), [1.5, 3.0, -10.0], None);
+            frame_write.add_atom(&Atom::new("O"), [2.3, -1.4, 50.0], None);
+            frame_write.add_atom(&Atom::new("H"), [-1.5, 10.0, 0.0], None);
+            let cell = UnitCell::new([10.0, 11.0, 12.5]);
+
+            let mut trajectory_write = Trajectory::memory_writer(*format).unwrap();
+            trajectory_write.set_cell(&cell);
+            trajectory_write.write(&frame_write).unwrap();
+
+            let buffer = trajectory_write.memory_buffer().unwrap();
+            let mut trajectory_read = Trajectory::memory_reader(buffer, *format).unwrap();
+            let mut frame_read = Frame::new();
+            trajectory_read.read(&mut frame_read).unwrap();
+
+            assert_eq!(trajectory_read.nsteps(), 1);
+            assert_eq!(frame_read.cell().shape(), CellShape::Orthorhombic);
+            assert_eq!(frame_read.size(), 3);
+            assert_eq!(frame_read.atom(1).name(), "O");
+            crate::assert_vector3d_eq(&frame_read.positions()[2], &[-1.5, 10.0, 0.0], 1e-4);
+        }
+    }
+}
+
+
+ \ No newline at end of file diff --git a/0.10.3/storage.js b/0.10.3/storage.js new file mode 100644 index 000000000..ad14b2a0a --- /dev/null +++ b/0.10.3/storage.js @@ -0,0 +1 @@ +"use strict";const darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");window.mainTheme=document.getElementById("mainThemeStyle");const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");if(settingsElement===null){return null}const dataset=settingsElement.dataset;if(dataset===undefined){return null}return dataset})();function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current!==null){return current}if(settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def}}return null}const localStoredTheme=getSettingValue("theme");const savedHref=[];function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(!elem||!elem.classList){return}elem.classList.add(className)}function removeClass(elem,className){if(!elem||!elem.classList){return}elem.classList.remove(className)}function onEach(arr,func,reversed){if(arr&&arr.length>0&&func){if(reversed){const length=arr.length;for(let i=length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(const elem of arr){if(func(elem)){return true}}}}return false}function onEachLazy(lazyArray,func,reversed){return onEach(Array.prototype.slice.call(lazyArray),func,reversed)}function updateLocalStorage(name,value){try{window.localStorage.setItem("rustdoc-"+name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name)}catch(e){return null}}function switchTheme(styleElem,mainStyleElem,newTheme,saveTheme){const newHref=mainStyleElem.href.replace(/\/rustdoc([^/]*)\.css/,"/"+newTheme+"$1"+".css");if(saveTheme){updateLocalStorage("theme",newTheme)}if(styleElem.href===newHref){return}let found=false;if(savedHref.length===0){onEachLazy(document.getElementsByTagName("link"),el=>{savedHref.push(el.href)})}onEach(savedHref,el=>{if(el===newHref){found=true;return true}});if(found){styleElem.href=newHref}}function useSystemTheme(value){if(value===undefined){value=true}updateLocalStorage("use-system-theme",value);const toggle=document.getElementById("use-system-theme");if(toggle&&toggle instanceof HTMLInputElement){toggle.checked=value}}const updateSystemTheme=(function(){if(!window.matchMedia){return()=>{const cssTheme=getComputedStyle(document.documentElement).getPropertyValue("content");switchTheme(window.currentTheme,window.mainTheme,JSON.parse(cssTheme)||"light",true)}}const mql=window.matchMedia("(prefers-color-scheme: dark)");function handlePreferenceChange(mql){const use=theme=>{switchTheme(window.currentTheme,window.mainTheme,theme,true)};if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";if(mql.matches){use(darkTheme)}else{use(lightTheme)}}else{use(getSettingValue("theme"))}}mql.addListener(handlePreferenceChange);return()=>{handlePreferenceChange(mql)}})();function switchToSavedTheme(){switchTheme(window.currentTheme,window.mainTheme,getSettingValue("theme")||"light",false)}if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}updateSystemTheme()}else{switchToSavedTheme()}if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"source-sidebar-expanded")}window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(switchToSavedTheme,0)}}) \ No newline at end of file diff --git a/0.10.3/toggle-minus.svg b/0.10.3/toggle-minus.svg new file mode 100644 index 000000000..73154788a --- /dev/null +++ b/0.10.3/toggle-minus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.3/toggle-plus.svg b/0.10.3/toggle-plus.svg new file mode 100644 index 000000000..08b17033e --- /dev/null +++ b/0.10.3/toggle-plus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.3/wheel.svg b/0.10.3/wheel.svg new file mode 100644 index 000000000..01da3b24c --- /dev/null +++ b/0.10.3/wheel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.4/.lock b/0.10.4/.lock new file mode 100644 index 000000000..e69de29bb diff --git a/0.10.4/chemfiles/all.html b/0.10.4/chemfiles/all.html new file mode 100644 index 000000000..df3770c0d --- /dev/null +++ b/0.10.4/chemfiles/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/0.10.4/chemfiles/atom/struct.Atom.html b/0.10.4/chemfiles/atom/struct.Atom.html new file mode 100644 index 000000000..591fac7c9 --- /dev/null +++ b/0.10.4/chemfiles/atom/struct.Atom.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Atom.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/atom/struct.AtomMut.html b/0.10.4/chemfiles/atom/struct.AtomMut.html new file mode 100644 index 000000000..2843d6f36 --- /dev/null +++ b/0.10.4/chemfiles/atom/struct.AtomMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomMut.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/atom/struct.AtomRef.html b/0.10.4/chemfiles/atom/struct.AtomRef.html new file mode 100644 index 000000000..fc21ff8b9 --- /dev/null +++ b/0.10.4/chemfiles/atom/struct.AtomRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomRef.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/cell/enum.CellShape.html b/0.10.4/chemfiles/cell/enum.CellShape.html new file mode 100644 index 000000000..9d3d95dbc --- /dev/null +++ b/0.10.4/chemfiles/cell/enum.CellShape.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.CellShape.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/cell/struct.UnitCell.html b/0.10.4/chemfiles/cell/struct.UnitCell.html new file mode 100644 index 000000000..c199c7635 --- /dev/null +++ b/0.10.4/chemfiles/cell/struct.UnitCell.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCell.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/cell/struct.UnitCellMut.html b/0.10.4/chemfiles/cell/struct.UnitCellMut.html new file mode 100644 index 000000000..a07e76605 --- /dev/null +++ b/0.10.4/chemfiles/cell/struct.UnitCellMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellMut.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/cell/struct.UnitCellRef.html b/0.10.4/chemfiles/cell/struct.UnitCellRef.html new file mode 100644 index 000000000..7455c76ac --- /dev/null +++ b/0.10.4/chemfiles/cell/struct.UnitCellRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellRef.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/enum.BondOrder.html b/0.10.4/chemfiles/enum.BondOrder.html new file mode 100644 index 000000000..2d168517d --- /dev/null +++ b/0.10.4/chemfiles/enum.BondOrder.html @@ -0,0 +1,39 @@ +BondOrder in chemfiles - Rust

Enum chemfiles::BondOrder

source ·
#[repr(C)]
+#[non_exhaustive]
+pub enum BondOrder {
+    Unknown,
+    Single,
+    Double,
+    Triple,
+    Quadruple,
+    Quintuplet,
+    Amide,
+    Aromatic,
+}
Expand description

Possible bond order associated with bonds

+

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Unknown

Unknown or unspecified bond order

+
§

Single

Single bond

+
§

Double

Double bond

+
§

Triple

Triple bond

+
§

Quadruple

Quadruple bond (present in some metals)

+
§

Quintuplet

Quintuplet bond (present in some metals)

+
§

Amide

Amide bond (required by some file formats)

+
§

Aromatic

Aromatic bond (required by some file formats)

+

Trait Implementations§

source§

impl Clone for BondOrder

source§

fn clone(&self) -> BondOrder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BondOrder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<chfl_bond_order> for BondOrder

source§

fn from(order: chfl_bond_order) -> BondOrder

Converts to this type from the input type.
source§

impl Ord for BondOrder

source§

fn cmp(&self, other: &BondOrder) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<BondOrder> for BondOrder

source§

fn eq(&self, other: &BondOrder) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<BondOrder> for BondOrder

source§

fn partial_cmp(&self, other: &BondOrder) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Copy for BondOrder

source§

impl Eq for BondOrder

source§

impl StructuralEq for BondOrder

source§

impl StructuralPartialEq for BondOrder

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/enum.CellShape.html b/0.10.4/chemfiles/enum.CellShape.html new file mode 100644 index 000000000..3acd1a3e3 --- /dev/null +++ b/0.10.4/chemfiles/enum.CellShape.html @@ -0,0 +1,22 @@ +CellShape in chemfiles - Rust

Enum chemfiles::CellShape

source ·
pub enum CellShape {
+    Orthorhombic,
+    Triclinic,
+    Infinite,
+}
Expand description

Available unit cell shapes.

+

Variants§

§

Orthorhombic

Orthorhombic cell, with the three angles equals to 90°.

+
§

Triclinic

Triclinic cell, with any values for the angles.

+
§

Infinite

Infinite cell, to use when there is no cell.

+

Trait Implementations§

source§

impl Clone for CellShape

source§

fn clone(&self) -> CellShape

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CellShape

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<CellShape> for chfl_cellshape

source§

fn from(celltype: CellShape) -> chfl_cellshape

Converts to this type from the input type.
source§

impl From<chfl_cellshape> for CellShape

source§

fn from(celltype: chfl_cellshape) -> CellShape

Converts to this type from the input type.
source§

impl PartialEq<CellShape> for CellShape

source§

fn eq(&self, other: &CellShape) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for CellShape

source§

impl StructuralEq for CellShape

source§

impl StructuralPartialEq for CellShape

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/enum.Property.html b/0.10.4/chemfiles/enum.Property.html new file mode 100644 index 000000000..5a1ca05f1 --- /dev/null +++ b/0.10.4/chemfiles/enum.Property.html @@ -0,0 +1,27 @@ +Property in chemfiles - Rust

Enum chemfiles::Property

source ·
pub enum Property {
+    Bool(bool),
+    Double(f64),
+    String(String),
+    Vector3D([f64; 3]),
+}
Expand description

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

Variants§

§

Bool(bool)

Boolean property

+
§

Double(f64)

Floating point property

+
§

String(String)

String property

+
§

Vector3D([f64; 3])

3-dimensional vector property

+

Trait Implementations§

source§

impl Clone for Property

source§

fn clone(&self) -> Property

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Property

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a str> for Property

source§

fn from(value: &'a str) -> Self

Converts to this type from the input type.
source§

impl From<[f64; 3]> for Property

source§

fn from(value: [f64; 3]) -> Self

Converts to this type from the input type.
source§

impl From<String> for Property

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Property

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Property

source§

fn from(value: f64) -> Self

Converts to this type from the input type.
source§

impl PartialEq<Property> for Property

source§

fn eq(&self, other: &Property) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Property> for Property

source§

fn partial_cmp(&self, other: &Property) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl StructuralPartialEq for Property

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/enum.Status.html b/0.10.4/chemfiles/enum.Status.html new file mode 100644 index 000000000..d8a8328c9 --- /dev/null +++ b/0.10.4/chemfiles/enum.Status.html @@ -0,0 +1,40 @@ +Status in chemfiles - Rust

Enum chemfiles::Status

source ·
#[repr(C)]
+#[non_exhaustive]
+pub enum Status {
+    Success,
+    MemoryError,
+    FileError,
+    FormatError,
+    SelectionError,
+    ConfigurationError,
+    OutOfBounds,
+    PropertyError,
+    ChemfilesError,
+    StdCppError,
+    UTF8PathError,
+}
Expand description

Possible causes of error in chemfiles

+

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Success

No error

+
§

MemoryError

Error in memory allocations

+
§

FileError

Error while reading or writing a file

+
§

FormatError

Error in file formatting, i.e. the file is invalid

+
§

SelectionError

Error in selection string syntax

+
§

ConfigurationError

Error in configuration files syntax

+
§

OutOfBounds

Error for out of bounds indexing

+
§

PropertyError

Error related to properties

+
§

ChemfilesError

Exception in the C++ chemfiles library

+
§

StdCppError

Exception in the C++ standard library

+
§

UTF8PathError

The given path is not valid UTF8

+

Trait Implementations§

source§

impl Clone for Status

source§

fn clone(&self) -> Status

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Status

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<Status> for Status

source§

fn eq(&self, other: &Status) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Status

source§

impl StructuralEq for Status

source§

impl StructuralPartialEq for Status

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/errors/enum.Status.html b/0.10.4/chemfiles/errors/enum.Status.html new file mode 100644 index 000000000..6aa83fd28 --- /dev/null +++ b/0.10.4/chemfiles/errors/enum.Status.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Status.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/errors/fn.set_warning_callback.html b/0.10.4/chemfiles/errors/fn.set_warning_callback.html new file mode 100644 index 000000000..97bc2a1ba --- /dev/null +++ b/0.10.4/chemfiles/errors/fn.set_warning_callback.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.set_warning_callback.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/errors/struct.Error.html b/0.10.4/chemfiles/errors/struct.Error.html new file mode 100644 index 000000000..34339c749 --- /dev/null +++ b/0.10.4/chemfiles/errors/struct.Error.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Error.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/fn.add_configuration.html b/0.10.4/chemfiles/fn.add_configuration.html new file mode 100644 index 000000000..9922d5c74 --- /dev/null +++ b/0.10.4/chemfiles/fn.add_configuration.html @@ -0,0 +1,13 @@ +add_configuration in chemfiles - Rust
pub fn add_configuration<S>(path: S) -> Result<(), Error>where
+    S: AsRef<str>,
Expand description

Read configuration data from the file at path.

+

By default, chemfiles reads configuration from any file named +.chemfiles.toml in the current directory or any parent directory. This +function can be used to add data from another configuration file. Data from +the new configuration file will overwrite any existing data.

+

Errors

+

This function will fail if there is no file at path, or if the file is +incorrectly formatted.

+

Example

+
chemfiles::add_configuration("local-config.toml").unwrap();
+// from now on, the data from "local-config.toml" will be used
+
\ No newline at end of file diff --git a/0.10.4/chemfiles/fn.formats_list.html b/0.10.4/chemfiles/fn.formats_list.html new file mode 100644 index 000000000..bd41ef90e --- /dev/null +++ b/0.10.4/chemfiles/fn.formats_list.html @@ -0,0 +1,12 @@ +formats_list in chemfiles - Rust

Function chemfiles::formats_list

source ·
pub fn formats_list() -> Vec<FormatMetadata>
Expand description

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Example

+
let formats = chemfiles::formats_list();
+println!("chemfiles supports {} formats:", formats.len());
+for format in &formats {
+    println!(
+        "   {:<15} {}",
+        format.name,
+        format.extension.as_deref().unwrap_or("")
+    );
+}
+
\ No newline at end of file diff --git a/0.10.4/chemfiles/fn.guess_format.html b/0.10.4/chemfiles/fn.guess_format.html new file mode 100644 index 000000000..70b3089df --- /dev/null +++ b/0.10.4/chemfiles/fn.guess_format.html @@ -0,0 +1,26 @@ +guess_format in chemfiles - Rust

Function chemfiles::guess_format

source ·
pub fn guess_format<P>(path: P) -> Result<String, Error>where
+    P: AsRef<Path>,
Expand description

Get the format that chemfiles would use to read a file at the given +path.

+

The format is mostly guessed from the path extension, chemfiles only tries +to read the file to distinguish between CIF and mmCIF files. Opening the +file using the returned format string might still fail. For example, it will +fail if the file is not actually formatted according to the guessed format; +or the format/compression combination is not supported (e.g. XTC / GZ will +not work since the XTC reader does not support compressed files).

+

The returned format is represented in a way compatible with the various +Trajectory constructors, i.e. "<format name> [/ <compression>]", where +compression is optional.

+

Errors

+

This function returns an error if the file format couldn’t be guessed.

+

Panics

+

This function panics if the path can’t be converted to a Unicode string.

+

Examples

+
let format = chemfiles::guess_format("trajectory.xyz.xz").unwrap();
+assert_eq!(format, "XYZ / XZ");
+
+let format = chemfiles::guess_format("trajectory.nc").unwrap();
+assert_eq!(format, "Amber NetCDF");
+
+let format = chemfiles::guess_format("trajectory.unknown.format");
+assert!(format.is_err());
+
\ No newline at end of file diff --git a/0.10.4/chemfiles/fn.set_warning_callback.html b/0.10.4/chemfiles/fn.set_warning_callback.html new file mode 100644 index 000000000..587e9a650 --- /dev/null +++ b/0.10.4/chemfiles/fn.set_warning_callback.html @@ -0,0 +1,4 @@ +set_warning_callback in chemfiles - Rust
pub fn set_warning_callback<F>(callback: F)where
+    F: WarningCallback + 'static,
Expand description

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
\ No newline at end of file diff --git a/0.10.4/chemfiles/fn.version.html b/0.10.4/chemfiles/fn.version.html new file mode 100644 index 000000000..cd576d3ec --- /dev/null +++ b/0.10.4/chemfiles/fn.version.html @@ -0,0 +1,5 @@ +version in chemfiles - Rust

Function chemfiles::version

source ·
pub fn version() -> String
Expand description

Get the version of the chemfiles library.

+

Example

+
let version = chemfiles::version();
+assert!(version.starts_with("0.10"));
+
\ No newline at end of file diff --git a/0.10.4/chemfiles/frame/struct.Frame.html b/0.10.4/chemfiles/frame/struct.Frame.html new file mode 100644 index 000000000..32b972752 --- /dev/null +++ b/0.10.4/chemfiles/frame/struct.Frame.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Frame.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/index.html b/0.10.4/chemfiles/index.html new file mode 100644 index 000000000..a272193f0 --- /dev/null +++ b/0.10.4/chemfiles/index.html @@ -0,0 +1,32 @@ +chemfiles - Rust

Crate chemfiles

source ·
Expand description

Chemfiles is a multi-language library written in modern C++ for reading and +writing from and to molecular trajectory files. These files are created by +your favorite theoretical chemistry program, and contains information about +atomic or residues names and positions. Some format also have additional +information, such as velocities, forces, energy, …

+

This crate expose the C API of chemfiles to Rust, and make all the +functionalities accessible. For more information on the C++ library, +please see its documentation. Specifically, the following pages +are worth reading:

+ +

Structs

  • An Atom is a particle in the current Frame. It stores the following +atomic properties:
  • An analog to a mutable reference to an atom (&mut Atom)
  • An analog to a reference to an atom (&Atom)
  • Error type for Chemfiles.
  • FormatMetadata contains metadata associated with one format.
  • A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.
  • A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].
  • MemoryTrajectoryReader is a handle for a Trajectory in memory.
  • An iterator over the properties in an atom/frame/residue
  • A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.
  • An analog to a reference to a residue (&Residue)
  • A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.
  • A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.
  • An analog to a reference to a topology (&Topology)
  • The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.
  • An UnitCell represent the box containing the atoms, and its periodicity.
  • An analog to a mutable reference to an unit cell (&mut UnitCell)
  • An analog to a reference to an unit cell (&UnitCell)

Enums

  • Possible bond order associated with bonds
  • Available unit cell shapes.
  • A Property is a piece of data that can be associated with an Atom or a +Frame.
  • Possible causes of error in chemfiles

Functions

  • Read configuration data from the file at path.
  • Get the list of formats known by chemfiles, as well as all associated metadata.
  • Get the format that chemfiles would use to read a file at the given +path.
  • Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.
  • Get the version of the chemfiles library.
\ No newline at end of file diff --git a/0.10.4/chemfiles/misc/fn.formats_list.html b/0.10.4/chemfiles/misc/fn.formats_list.html new file mode 100644 index 000000000..481646355 --- /dev/null +++ b/0.10.4/chemfiles/misc/fn.formats_list.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.formats_list.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/misc/fn.guess_format.html b/0.10.4/chemfiles/misc/fn.guess_format.html new file mode 100644 index 000000000..681a66ce5 --- /dev/null +++ b/0.10.4/chemfiles/misc/fn.guess_format.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.guess_format.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/misc/struct.FormatMetadata.html b/0.10.4/chemfiles/misc/struct.FormatMetadata.html new file mode 100644 index 000000000..10fda814b --- /dev/null +++ b/0.10.4/chemfiles/misc/struct.FormatMetadata.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.FormatMetadata.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/property/enum.Property.html b/0.10.4/chemfiles/property/enum.Property.html new file mode 100644 index 000000000..87bfc97da --- /dev/null +++ b/0.10.4/chemfiles/property/enum.Property.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Property.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/property/struct.PropertiesIter.html b/0.10.4/chemfiles/property/struct.PropertiesIter.html new file mode 100644 index 000000000..2faef8a54 --- /dev/null +++ b/0.10.4/chemfiles/property/struct.PropertiesIter.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.PropertiesIter.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/residue/struct.Residue.html b/0.10.4/chemfiles/residue/struct.Residue.html new file mode 100644 index 000000000..e8f25ad8a --- /dev/null +++ b/0.10.4/chemfiles/residue/struct.Residue.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Residue.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/residue/struct.ResidueRef.html b/0.10.4/chemfiles/residue/struct.ResidueRef.html new file mode 100644 index 000000000..9d26d5daa --- /dev/null +++ b/0.10.4/chemfiles/residue/struct.ResidueRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.ResidueRef.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/selection/struct.Match.html b/0.10.4/chemfiles/selection/struct.Match.html new file mode 100644 index 000000000..3c7b0b709 --- /dev/null +++ b/0.10.4/chemfiles/selection/struct.Match.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Match.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/selection/struct.Selection.html b/0.10.4/chemfiles/selection/struct.Selection.html new file mode 100644 index 000000000..8ed2b5d77 --- /dev/null +++ b/0.10.4/chemfiles/selection/struct.Selection.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Selection.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/sidebar-items.js b/0.10.4/chemfiles/sidebar-items.js new file mode 100644 index 000000000..99ded65b4 --- /dev/null +++ b/0.10.4/chemfiles/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["BondOrder","CellShape","Property","Status"],"fn":["add_configuration","formats_list","guess_format","set_warning_callback","version"],"struct":["Atom","AtomMut","AtomRef","Error","FormatMetadata","Frame","Match","MemoryTrajectoryReader","PropertiesIter","Residue","ResidueRef","Selection","Topology","TopologyRef","Trajectory","UnitCell","UnitCellMut","UnitCellRef"]}; \ No newline at end of file diff --git a/0.10.4/chemfiles/struct.Atom.html b/0.10.4/chemfiles/struct.Atom.html new file mode 100644 index 000000000..971735be0 --- /dev/null +++ b/0.10.4/chemfiles/struct.Atom.html @@ -0,0 +1,118 @@ +Atom in chemfiles - Rust

Struct chemfiles::Atom

source ·
pub struct Atom { /* private fields */ }
Expand description

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
    +
  • atom name;
  • +
  • atom type;
  • +
  • atom mass;
  • +
  • atom charge.
  • +
+

The atom name is usually an unique identifier (H1, C_a) while the +atom type will be shared between all particles of the same type: H, +Ow, CH3.

+

Implementations§

source§

impl Atom

source

pub fn new<'a>(name: impl Into<&'a str>) -> Atom

Create an atom with the given name, and set the atom type to name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+
source

pub fn mass(&self) -> f64

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+
source

pub fn set_mass(&mut self, mass: f64)

Set the atom mass to mass, in atomic mass units.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+
source

pub fn charge(&self) -> f64

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+
source

pub fn set_charge(&mut self, charge: f64)

Set the atom charge to charge, in number of the electron charge e.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+
source

pub fn name(&self) -> String

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+
source

pub fn atomic_type(&self) -> String

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+
source

pub fn set_name<'a>(&mut self, name: impl Into<&'a str>)

Set the atom name to name.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+
source

pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>)

Set the atom type to atomic_type.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+
source

pub fn full_name(&self) -> String

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+
source

pub fn vdw_radius(&self) -> f64

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+
source

pub fn covalent_radius(&self) -> f64

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+
source

pub fn atomic_number(&self) -> u64

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+
source

pub fn set(&mut self, name: &str, property: impl Into<Property>)

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl Clone for Atom

source§

fn clone(&self) -> Atom

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Atom

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Atom

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Atom

§

impl !Send for Atom

§

impl !Sync for Atom

§

impl Unpin for Atom

§

impl UnwindSafe for Atom

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.AtomMut.html b/0.10.4/chemfiles/struct.AtomMut.html new file mode 100644 index 000000000..a1999e1eb --- /dev/null +++ b/0.10.4/chemfiles/struct.AtomMut.html @@ -0,0 +1,103 @@ +AtomMut in chemfiles - Rust

Struct chemfiles::AtomMut

source ·
pub struct AtomMut<'a> { /* private fields */ }
Expand description

An analog to a mutable reference to an atom (&mut Atom)

+

Methods from Deref<Target = Atom>§

source

pub fn mass(&self) -> f64

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+
source

pub fn set_mass(&mut self, mass: f64)

Set the atom mass to mass, in atomic mass units.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+
source

pub fn charge(&self) -> f64

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+
source

pub fn set_charge(&mut self, charge: f64)

Set the atom charge to charge, in number of the electron charge e.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+
source

pub fn name(&self) -> String

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+
source

pub fn atomic_type(&self) -> String

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+
source

pub fn set_name<'a>(&mut self, name: impl Into<&'a str>)

Set the atom name to name.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+
source

pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>)

Set the atom type to atomic_type.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+
source

pub fn full_name(&self) -> String

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+
source

pub fn vdw_radius(&self) -> f64

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+
source

pub fn covalent_radius(&self) -> f64

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+
source

pub fn atomic_number(&self) -> u64

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+
source

pub fn set(&mut self, name: &str, property: impl Into<Property>)

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl<'a> Debug for AtomMut<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for AtomMut<'a>

§

type Target = Atom

The resulting type after dereferencing.
source§

fn deref(&self) -> &Atom

Dereferences the value.
source§

impl<'a> DerefMut for AtomMut<'a>

source§

fn deref_mut(&mut self) -> &mut Atom

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for AtomMut<'a>

§

impl<'a> !Send for AtomMut<'a>

§

impl<'a> !Sync for AtomMut<'a>

§

impl<'a> Unpin for AtomMut<'a>

§

impl<'a> !UnwindSafe for AtomMut<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.AtomRef.html b/0.10.4/chemfiles/struct.AtomRef.html new file mode 100644 index 000000000..c95853fc7 --- /dev/null +++ b/0.10.4/chemfiles/struct.AtomRef.html @@ -0,0 +1,69 @@ +AtomRef in chemfiles - Rust

Struct chemfiles::AtomRef

source ·
pub struct AtomRef<'a> { /* private fields */ }
Expand description

An analog to a reference to an atom (&Atom)

+

Methods from Deref<Target = Atom>§

source

pub fn mass(&self) -> f64

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+
source

pub fn charge(&self) -> f64

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+
source

pub fn name(&self) -> String

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+
source

pub fn atomic_type(&self) -> String

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+
source

pub fn full_name(&self) -> String

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+
source

pub fn vdw_radius(&self) -> f64

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+
source

pub fn covalent_radius(&self) -> f64

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+
source

pub fn atomic_number(&self) -> u64

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl<'a> Debug for AtomRef<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for AtomRef<'a>

§

type Target = Atom

The resulting type after dereferencing.
source§

fn deref(&self) -> &Atom

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for AtomRef<'a>

§

impl<'a> !Send for AtomRef<'a>

§

impl<'a> !Sync for AtomRef<'a>

§

impl<'a> Unpin for AtomRef<'a>

§

impl<'a> UnwindSafe for AtomRef<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.Error.html b/0.10.4/chemfiles/struct.Error.html new file mode 100644 index 000000000..708cabeaf --- /dev/null +++ b/0.10.4/chemfiles/struct.Error.html @@ -0,0 +1,25 @@ +Error in chemfiles - Rust

Struct chemfiles::Error

source ·
pub struct Error {
+    pub status: Status,
+    pub message: String,
+}
Expand description

Error type for Chemfiles.

+

Fields§

§status: Status

The error status code

+
§message: String

A message describing the error cause

+

Implementations§

source§

impl Error

source

pub fn last_error() -> String

Get the last error message from the C++ library.

+
source

pub fn cleanup()

Clear any error from the C++ library

+

Trait Implementations§

source§

impl Clone for Error

source§

fn clone(&self) -> Error

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Error

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Error for Error

source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<Utf8Error> for Error

source§

fn from(_: Utf8Error) -> Self

Converts to this type from the input type.
source§

impl From<chfl_status> for Error

source§

fn from(status: chfl_status) -> Error

Converts to this type from the input type.
source§

impl PartialEq<Error> for Error

source§

fn eq(&self, other: &Error) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Error

source§

impl StructuralEq for Error

source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<E> Provider for Ewhere + E: Error + ?Sized,

source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.FormatMetadata.html b/0.10.4/chemfiles/struct.FormatMetadata.html new file mode 100644 index 000000000..2ff4aa7ef --- /dev/null +++ b/0.10.4/chemfiles/struct.FormatMetadata.html @@ -0,0 +1,42 @@ +FormatMetadata in chemfiles - Rust
pub struct FormatMetadata {
Show 13 fields + pub name: &'static str, + pub extension: Option<&'static str>, + pub description: &'static str, + pub reference: &'static str, + pub read: bool, + pub write: bool, + pub memory: bool, + pub positions: bool, + pub velocities: bool, + pub unit_cell: bool, + pub atoms: bool, + pub bonds: bool, + pub residues: bool, +
}
Expand description

FormatMetadata contains metadata associated with one format.

+

Fields§

§name: &'static str

Name of the format.

+
§extension: Option<&'static str>

Extension associated with the format.

+
§description: &'static str

Extended, user-facing description of the format.

+
§reference: &'static str

URL pointing to the format definition/reference.

+
§read: bool

Is reading files in this format implemented?

+
§write: bool

Is writing files in this format implemented?

+
§memory: bool

Does this format support in-memory IO?

+
§positions: bool

Does this format support storing atomic positions?

+
§velocities: bool

Does this format support storing atomic velocities?

+
§unit_cell: bool

Does this format support storing unit cell information?

+
§atoms: bool

Does this format support storing atom names or types?

+
§bonds: bool

Does this format support storing bonds between atoms?

+
§residues: bool

Does this format support storing residues?

+

Trait Implementations§

source§

impl Clone for FormatMetadata

source§

fn clone(&self) -> FormatMetadata

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FormatMetadata

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<FormatMetadata> for FormatMetadata

source§

fn eq(&self, other: &FormatMetadata) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for FormatMetadata

source§

impl StructuralEq for FormatMetadata

source§

impl StructuralPartialEq for FormatMetadata

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.Frame.html b/0.10.4/chemfiles/struct.Frame.html new file mode 100644 index 000000000..f72964e88 --- /dev/null +++ b/0.10.4/chemfiles/struct.Frame.html @@ -0,0 +1,365 @@ +Frame in chemfiles - Rust

Struct chemfiles::Frame

source ·
pub struct Frame { /* private fields */ }
Expand description

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

Implementations§

source§

impl Frame

source

pub fn new() -> Frame

Create an empty frame. It will be resized by the library as needed.

+
Example
+
let frame = Frame::new();
+
+assert_eq!(frame.size(), 0);
+
source

pub fn atom(&self, index: usize) -> AtomRef<'_>

Get a reference to the atom at the given index in this frame.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+let atom = frame.atom(0);
+assert_eq!(atom.name(), "Zn");
+
source

pub fn atom_mut(&mut self, index: usize) -> AtomMut<'_>

Get a mutable reference to the atom at the given index in this frame.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+assert_eq!(frame.atom(0).name(), "Zn");
+
+frame.atom_mut(0).set_name("Fe");
+assert_eq!(frame.atom(0).name(), "Fe");
+
source

pub fn size(&self) -> usize

Get the current number of atoms in this frame.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.size(), 0);
+
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+
source

pub fn resize(&mut self, natoms: usize)

Resize the positions and the velocities in this frame, to make space for +natoms atoms. Previous data is conserved, as well as the presence of +absence of velocities.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+
source

pub fn add_atom( + &mut self, + atom: &Atom, + position: [f64; 3], + velocity: impl Into<Option<[f64; 3]>> +)

Add an Atom and the corresponding position and optionally velocity +data to this frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+
+frame.add_velocities();
+frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+
source

pub fn remove(&mut self, i: usize)

Remove the atom at index i in this frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+assert_eq!(frame.size(), 3);
+
+frame.remove(1);
+assert_eq!(frame.size(), 2);
+assert_eq!(frame.atom(1).name(), "Sn");
+
source

pub fn add_bond(&mut self, i: usize, j: usize)

Add a bond between the atoms at indexes i and j in the frame.

+

The bond order is set to BondOrder::Unknown.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+assert_eq!(frame.topology().bonds_count(), 3);
+
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+
source

pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder)

Add a bond between the atoms at indexes i and j in the frame +with the given bond order.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(2);
+
+frame.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+
source

pub fn remove_bond(&mut self, i: usize, j: usize)

Remove any existing bond between the atoms at indexes i and j in +the frame.

+

This function does nothing if there is no bond between i and j.

+
Example
+
let mut frame = Frame::new();
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+
+frame.remove_bond(2, 4);
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+
source

pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error>

Add a copy of residue to this frame.

+
Errors
+

This function fails is the residue id is already in this frame’s +topology, or if the residue contain atoms that are already in another +residue.

+
Example
+
let mut frame = Frame::new();
+
+let residue = Residue::new("foo");
+frame.add_residue(&residue).unwrap();
+
+let topology = frame.topology();
+assert_eq!(topology.residues_count(), 1);
+assert_eq!(topology.residue(0).unwrap().name(), "foo");
+
source

pub fn distance(&self, i: usize, j: usize) -> f64

Get the distance between the atoms at indexes i and j in this frame, +accounting for periodic boundary conditions. The result is expressed in +Angstroms.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+
+assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+
source

pub fn angle(&self, i: usize, j: usize, k: usize) -> f64

Get the angle formed by the atoms at indexes i, j and k in this +frame, accounting for periodic boundary conditions. The result is +expressed in radians.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+
source

pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64

Get the dihedral angle formed by the atoms at indexes i, j, k and +m in this frame, accounting for periodic boundary conditions. The +result is expressed in radians.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+
+assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+
source

pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64

Get the out of plane distance formed by the atoms at indexes i, j, +k and m in this frame, accounting for periodic boundary conditions. +The result is expressed in angstroms.

+

This is the distance between the atom j and the ikm plane. The j atom +is the center of the improper dihedral angle formed by i, j, k and m.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+
source

pub fn positions(&self) -> &[[f64; 3]]

Get a view into the positions of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+
+let positions = frame.positions();
+assert_eq!(positions.len(), 67);
+assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+
source

pub fn positions_mut(&mut self) -> &mut [[f64; 3]]

Get a mutable view into the positions of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+{
+    let positions = frame.positions_mut();
+    assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    positions[0] = [1.0, 2.0, 3.0];
+}
+
+let positions = frame.positions();
+assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+
source

pub fn velocities(&self) -> Option<&[[f64; 3]]>

Get a view into the velocities of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+
+let velocities = frame.velocities().expect("missing velocities");
+assert_eq!(velocities.len(), 67);
+assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+
source

pub fn velocities_mut(&mut self) -> Option<&mut [[f64; 3]]>

Get a mutable view into the velocities of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+{
+    let velocities = frame.velocities_mut().expect("missing velocities");
+    assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    velocities[0] = [1.0, 2.0, 3.0];
+}
+
+let velocities = frame.velocities().expect("missing velocities");
+assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+
source

pub fn has_velocities(&self) -> bool

Check if this frame contains velocity data.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+
source

pub fn add_velocities(&mut self)

Add velocity data to this frame. If the frame already have velocities, +this does nothing.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+
source

pub fn cell(&self) -> UnitCellRef<'_>

Get a reference to the UnitCell from this frame.

+
Example
+
let frame = Frame::new();
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Infinite);
+
source

pub fn cell_mut(&mut self) -> UnitCellMut<'_>

Get a mutable reference to the UnitCell from this frame.

+
Example
+
let mut frame = Frame::new();
+
+assert_eq!(frame.cell().shape(), CellShape::Infinite);
+
+frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+
source

pub fn set_cell(&mut self, cell: &UnitCell)

Set the UnitCell of this frame to cell.

+
Example
+
let mut frame = Frame::new();
+
+frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+
source

pub fn topology(&self) -> TopologyRef<'_>

Get a reference to the Topology of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(42);
+
+let topology = frame.topology();
+assert_eq!(topology.size(), 42);
+
source

pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error>

Set the Topology of this frame to topology.

+
Errors
+

This function fails if the topology contains a different number of atoms +than this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(2);
+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Cl"));
+topology.add_atom(&Atom::new("Cl"));
+topology.add_bond(0, 1);
+
+frame.set_topology(&topology).unwrap();
+assert_eq!(frame.atom(0).name(), "Cl");
+
source

pub fn step(&self) -> usize

Get this frame step, i.e. the frame number in the trajectory

+
Example
+
let frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
source

pub fn set_step(&mut self, step: usize)

Set this frame step to step.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
+frame.set_step(10);
+assert_eq!(frame.step(), 10);
+
source

pub fn guess_bonds(&mut self) -> Result<(), Error>

Guess the bonds, angles and dihedrals in this frame.

+

The bonds are guessed using a distance-based algorithm, and then angles +and dihedrals are guessed from the bonds.

+
Errors
+

This function can fail if the covalent radius is unknown for some atoms +in the frame.

+
Example
+
let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+assert_eq!(frame.topology().bonds_count(), 0);
+
+frame.guess_bonds().unwrap();
+assert_eq!(frame.topology().bonds_count(), 1);
+
source

pub fn clear_bonds(&mut self)

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology of the frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+
+frame.add_bond(0, 1);
+frame.add_bond(1, 2);
+
+assert_eq!(frame.topology().bonds().len(), 2);
+assert_eq!(frame.topology().angles().len(), 1);
+
+frame.clear_bonds();
+assert!(frame.topology().bonds().is_empty());
+assert!(frame.topology().angles().is_empty());
+
source

pub fn set(&mut self, name: &str, property: impl Into<Property>)

Add a new property with the given name to this frame.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut frame = Frame::new();
+frame.set("a string", "hello");
+frame.set("a double", 4.3);
+
+assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+
+assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(frame.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+frame.set("bar", Property::Bool(false));
+
+for (name, property) in frame.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+
source

pub fn iter_atoms(&self) -> AtomIter<'_>

Gets an iterator over atoms

+
Example
+
let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+
+let mut atoms: Vec<AtomRef> = Vec::new();
+
+for atom in frame.iter_atoms() {
+    atoms.push(atom);
+}
+
+assert_eq!(atoms.len(), 2);
+

Trait Implementations§

source§

impl Clone for Frame

source§

fn clone(&self) -> Frame

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Frame

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Frame

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Frame

§

impl !Send for Frame

§

impl !Sync for Frame

§

impl Unpin for Frame

§

impl UnwindSafe for Frame

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.Match.html b/0.10.4/chemfiles/struct.Match.html new file mode 100644 index 000000000..5628d0cb8 --- /dev/null +++ b/0.10.4/chemfiles/struct.Match.html @@ -0,0 +1,39 @@ +Match in chemfiles - Rust

Struct chemfiles::Match

source ·
pub struct Match { /* private fields */ }
Expand description

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

Implementations§

source§

impl Match

source

pub fn len(&self) -> usize

Get the length of the Match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+
source

pub fn new(atoms: &[usize]) -> Match

Create a new match containing the atoms in the atoms slice.

+
Panics
+

If the slice contains more than 4 elements, which is the maximal size +of a match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+assert_eq!(atomic_match[0], 3);
+assert_eq!(atomic_match[1], 4);
+assert_eq!(atomic_match[2], 5);
+
source

pub fn iter(&self) -> Iter<'_, usize>

Iterate over the atomic indexes in the match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+let mut iter = atomic_match.iter();
+
+assert_eq!(iter.next(), Some(&3));
+assert_eq!(iter.next(), Some(&4));
+assert_eq!(iter.next(), Some(&5));
+assert_eq!(iter.next(), None);
+

Trait Implementations§

source§

impl Clone for Match

source§

fn clone(&self) -> Match

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Match

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Index<usize> for Match

§

type Output = usize

The returned type after indexing.
source§

fn index(&self, i: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<'a> IntoIterator for &'a Match

§

type Item = &'a usize

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, usize>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<Match> for Match

source§

fn eq(&self, other: &Match) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Match

source§

impl StructuralEq for Match

source§

impl StructuralPartialEq for Match

Auto Trait Implementations§

§

impl RefUnwindSafe for Match

§

impl Send for Match

§

impl Sync for Match

§

impl Unpin for Match

§

impl UnwindSafe for Match

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.MemoryTrajectoryReader.html b/0.10.4/chemfiles/struct.MemoryTrajectoryReader.html new file mode 100644 index 000000000..eb4428931 --- /dev/null +++ b/0.10.4/chemfiles/struct.MemoryTrajectoryReader.html @@ -0,0 +1,133 @@ +MemoryTrajectoryReader in chemfiles - Rust
pub struct MemoryTrajectoryReader<'data> { /* private fields */ }
Expand description

MemoryTrajectoryReader is a handle for a Trajectory in memory.

+

Implementations§

source§

impl<'data> MemoryTrajectoryReader<'data>

source

pub fn new<Data, Format>( + data: Data, + format: Format +) -> Result<MemoryTrajectoryReader<'data>, Error>where + Data: Into<&'data [u8]>, + Format: AsRef<str>,

Read a memory buffer as though it was a formatted file.

+

The memory buffer used to store the file is given using the data +argument. The format parameter is required and should follow the same +rules as in the main Trajectory constructor.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format, or if the format do not support in-memory readers.

+
Example
+
let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+let mut trajectory = MemoryTrajectoryReader::new(aromatics.as_bytes(), "SMI").unwrap();
+let mut frame = Frame::new();
+trajectory.read(&mut frame).unwrap();
+assert_eq!(frame.size(), 6);
+

Methods from Deref<Target = Trajectory>§

source

pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error>

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+
source

pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error>

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+
source

pub fn write(&mut self, frame: &Frame) -> Result<(), Error>

Write a frame to this trajectory.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+
source

pub fn set_topology(&mut self, topology: &Topology)

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+
Example
+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+
source

pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>where + P: AsRef<Path>,

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+
source

pub fn set_topology_with_format<'a, P, S>( + &mut self, + path: P, + format: S +) -> Result<(), Error>where + P: AsRef<Path>, + S: Into<&'a str>,

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+
source

pub fn set_cell(&mut self, cell: &UnitCell)

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+
source

pub fn nsteps(&mut self) -> usize

Get the number of steps (the number of frames) in a trajectory.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+
source

pub fn memory_buffer(&self) -> Result<&str, Error>

Obtain the memory buffer written to by the trajectory.

+
Errors
+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+
Example
+
let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+
source

pub fn path(&self) -> String

Get file path for this trajectory.

+
Example
+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations§

source§

impl<'a> Deref for MemoryTrajectoryReader<'a>

§

type Target = Trajectory

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> DerefMut for MemoryTrajectoryReader<'a>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'data> RefUnwindSafe for MemoryTrajectoryReader<'data>

§

impl<'data> !Send for MemoryTrajectoryReader<'data>

§

impl<'data> !Sync for MemoryTrajectoryReader<'data>

§

impl<'data> Unpin for MemoryTrajectoryReader<'data>

§

impl<'data> UnwindSafe for MemoryTrajectoryReader<'data>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.PropertiesIter.html b/0.10.4/chemfiles/struct.PropertiesIter.html new file mode 100644 index 000000000..e017254a7 --- /dev/null +++ b/0.10.4/chemfiles/struct.PropertiesIter.html @@ -0,0 +1,185 @@ +PropertiesIter in chemfiles - Rust
pub struct PropertiesIter<'a> { /* private fields */ }
Expand description

An iterator over the properties in an atom/frame/residue

+

Trait Implementations§

source§

impl<'a> Iterator for PropertiesIter<'a>

§

type Item = (String, Property)

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
source§

fn count(self) -> usize

Consumes the iterator, counting the number of iterations and returning it. Read more
source§

fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · source§

fn last(self) -> Option<Self::Item>where + Self: Sized,

Consumes the iterator, returning the last element. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), usize>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Selfwhere + Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> Bwhere + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> boolwhere + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> Rwhere + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · source§

fn fold<B, F>(self, init: B, f: F) -> Bwhere + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
source§

fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
source§

fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> Swhere + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> Pwhere + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are unequal to those of +another. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> boolwhere + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd<K>,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for PropertiesIter<'a>

§

impl<'a> !Send for PropertiesIter<'a>

§

impl<'a> !Sync for PropertiesIter<'a>

§

impl<'a> Unpin for PropertiesIter<'a>

§

impl<'a> !UnwindSafe for PropertiesIter<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<I> IntoIterator for Iwhere + I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.Residue.html b/0.10.4/chemfiles/struct.Residue.html new file mode 100644 index 000000000..ba7b6d676 --- /dev/null +++ b/0.10.4/chemfiles/struct.Residue.html @@ -0,0 +1,100 @@ +Residue in chemfiles - Rust

Struct chemfiles::Residue

source ·
pub struct Residue { /* private fields */ }
Expand description

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

Implementations§

source§

impl Residue

source

pub fn new<'a>(name: impl Into<&'a str>) -> Residue

Create a new residue with the given name

+
Example
+
let residue = Residue::new("ALA");
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), None);
+
source

pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue

Create a new residue with the given name and id as identifier.

+
Example
+
let residue = Residue::with_id("ALA", 67);
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), Some(67));
+
source

pub fn size(&self) -> usize

Get the number of atoms in this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+
source

pub fn id(&self) -> Option<i64>

Get the identifier of this residue in the initial topology file.

+
Example
+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+
source

pub fn name(&self) -> String

Get the name of this residue.

+
Example
+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+
source

pub fn add_atom(&mut self, atom: usize)

Add the atom at index atom in this residue.

+

This will fail if the atom is already in the residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+assert_eq!(residue.contains(56), true);
+
+// Adding the same atom twice is fine
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+
source

pub fn contains(&self, atom: usize) -> bool

Check if the atom at index i is in this residue

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+
source

pub fn atoms(&self) -> Vec<usize>

Get the list of atoms of this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+
source

pub fn set(&mut self, name: &str, property: impl Into<Property>)

Add a new property with the given name to this residue.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("a string", "hello");
+residue.set("a double", 3.2);
+
+assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl Clone for Residue

source§

fn clone(&self) -> Residue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Residue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Residue

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.ResidueRef.html b/0.10.4/chemfiles/struct.ResidueRef.html new file mode 100644 index 000000000..e40a04658 --- /dev/null +++ b/0.10.4/chemfiles/struct.ResidueRef.html @@ -0,0 +1,63 @@ +ResidueRef in chemfiles - Rust

Struct chemfiles::ResidueRef

source ·
pub struct ResidueRef<'a> { /* private fields */ }
Expand description

An analog to a reference to a residue (&Residue)

+

Methods from Deref<Target = Residue>§

source

pub fn size(&self) -> usize

Get the number of atoms in this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+
source

pub fn id(&self) -> Option<i64>

Get the identifier of this residue in the initial topology file.

+
Example
+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+
source

pub fn name(&self) -> String

Get the name of this residue.

+
Example
+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+
source

pub fn contains(&self, atom: usize) -> bool

Check if the atom at index i is in this residue

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+
source

pub fn atoms(&self) -> Vec<usize>

Get the list of atoms of this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl<'a> Debug for ResidueRef<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for ResidueRef<'a>

§

type Target = Residue

The resulting type after dereferencing.
source§

fn deref(&self) -> &Residue

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for ResidueRef<'a>

§

impl<'a> !Send for ResidueRef<'a>

§

impl<'a> !Sync for ResidueRef<'a>

§

impl<'a> Unpin for ResidueRef<'a>

§

impl<'a> UnwindSafe for ResidueRef<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.Selection.html b/0.10.4/chemfiles/struct.Selection.html new file mode 100644 index 000000000..7819a68e9 --- /dev/null +++ b/0.10.4/chemfiles/struct.Selection.html @@ -0,0 +1,69 @@ +Selection in chemfiles - Rust

Struct chemfiles::Selection

source ·
pub struct Selection { /* private fields */ }
Expand description

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

Implementations§

source§

impl Selection

source

pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error>

Create a new selection from the given selection string.

+
Errors
+

This function fails if the selection string is invalid.

+
Example
+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+
source

pub fn size(&self) -> usize

Get the size of the selection, i.e. the number of atoms we are selecting +together.

+

This value is 1 for the ‘atom’ context, 2 for the ‘pair’ and ‘bond’ +context, 3 for the ‘three’ and ‘angles’ context and 4 for the ‘four’ +and ‘dihedral’ context.

+
Example
+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+assert_eq!(selection.size(), 2);
+
source

pub fn string(&self) -> String

Get the selection string used to create this selection.

+
Example
+
let selection = Selection::new("name H").unwrap();
+assert_eq!(selection.string(), "name H");
+
source

pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match>

Evaluate a selection for a given frame, and return the corresponding +matches.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+let matches = selection.evaluate(&frame);
+
+assert_eq!(matches.len(), 2);
+
+assert_eq!(matches[0].len(), 2);
+assert_eq!(matches[0][0], 0);
+assert_eq!(matches[0][1], 1);
+
+assert_eq!(matches[1].len(), 2);
+assert_eq!(matches[1][0], 2);
+assert_eq!(matches[1][1], 1);
+
source

pub fn list(&mut self, frame: &Frame) -> Vec<usize>

Evaluates a selection of size 1 on a given frame. This function +returns the list of atomic indexes in the frame matching this selection.

+
Panics
+

If the selection size is not 1

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("name H").unwrap();
+let matches = selection.list(&frame);
+
+assert_eq!(matches.len(), 2);
+assert_eq!(matches[0], 0);
+assert_eq!(matches[1], 2);
+

Trait Implementations§

source§

impl Clone for Selection

source§

fn clone(&self) -> Selection

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Selection

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Selection

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.Topology.html b/0.10.4/chemfiles/struct.Topology.html new file mode 100644 index 000000000..a0abfc8de --- /dev/null +++ b/0.10.4/chemfiles/struct.Topology.html @@ -0,0 +1,277 @@ +Topology in chemfiles - Rust

Struct chemfiles::Topology

source ·
pub struct Topology { /* private fields */ }
Expand description

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

Implementations§

source§

impl Topology

source

pub fn new() -> Topology

Create a new empty topology.

+
Example
+
let topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
source

pub fn atom(&self, index: usize) -> AtomRef<'_>

Get a reference of the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+
source

pub fn atom_mut(&mut self, index: usize) -> AtomMut<'_>

Get a mutable reference to the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+assert_eq!(topology.atom(4).name(), "");
+
+topology.atom_mut(4).set_name("Fe");
+assert_eq!(topology.atom(4).name(), "Fe");
+
source

pub fn size(&self) -> usize

Get the current number of atoms in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+
source

pub fn resize(&mut self, natoms: usize)

Resize this topology to hold natoms atoms, inserting dummy atoms if +the new size if bigger than the old one.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+
source

pub fn add_atom(&mut self, atom: &Atom)

Add an Atom at the end of this topology

+
Example
+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Mg"));
+
+let atom = topology.atom(0);
+assert_eq!(atom.name(), "Mg");
+
source

pub fn remove(&mut self, index: usize)

Remove an Atom from this topology by index. This modify all the +other atoms indexes.

+
Panics
+

If the index is out of bounds

+
Example
+
let mut topology = Topology::new();
+topology.resize(9);
+assert_eq!(topology.size(), 9);
+
+topology.remove(7);
+assert_eq!(topology.size(), 8);
+
source

pub fn bonds_count(&self) -> usize

Get the number of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+
source

pub fn angles_count(&self) -> usize

Get the number of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+
source

pub fn dihedrals_count(&self) -> usize

Get the number of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+
source

pub fn impropers_count(&self) -> usize

Get the number of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+
source

pub fn bonds(&self) -> Vec<[usize; 2]>

Get the list of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+
source

pub fn angles(&self) -> Vec<[usize; 3]>

Get the list of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+
source

pub fn dihedrals(&self) -> Vec<[usize; 4]>

Get the list of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+
source

pub fn impropers(&self) -> Vec<[usize; 4]>

Get the list of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+
source

pub fn clear_bonds(&mut self)

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+assert_eq!(topology.angles().len(), 1);
+
+topology.clear_bonds();
+assert!(topology.bonds().is_empty());
+assert!(topology.angles().is_empty());
+
source

pub fn add_bond(&mut self, i: usize, j: usize)

Add a bond between the atoms at indexes i and j in the topology.

+

The bond order is set to BondOrder::Unknown.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+
source

pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder)

Add a bond between the atoms at indexes i and j in the topology +with the given bond order.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+
source

pub fn bond_order(&self, i: usize, j: usize) -> BondOrder

Get the bond order for the bond between the atoms at indexes i and +j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+
source

pub fn bond_orders(&self) -> Vec<BondOrder>

Get the bond order for all the bonds in the topology

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+
source

pub fn remove_bond(&mut self, i: usize, j: usize)

Remove any existing bond between the atoms at indexes i and j in +this topology.

+

This function does nothing if there is no bond between i and j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+topology.remove_bond(0, 1);
+assert_eq!(topology.bonds_count(), 1);
+
+// Removing a bond that does not exists is fine
+topology.remove_bond(0, 2);
+assert_eq!(topology.bonds_count(), 1);
+
source

pub fn residue(&self, index: usize) -> Option<ResidueRef<'_>>

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+
source

pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef<'_>>

Get a copy of the residue containing the atom at index index in this +topology, if any.

+
Example
+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+
source

pub fn residues_count(&self) -> u64

Get the number of residues in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+
source

pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error>

Add a residue to this topology.

+
Errors
+

This function fails is the residue id is not already in the topology, +or if the residue contains atoms that are already in another residue.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+
source

pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+
Example
+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations§

source§

impl Clone for Topology

source§

fn clone(&self) -> Topology

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Topology

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Topology

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.TopologyRef.html b/0.10.4/chemfiles/struct.TopologyRef.html new file mode 100644 index 000000000..1d50426a9 --- /dev/null +++ b/0.10.4/chemfiles/struct.TopologyRef.html @@ -0,0 +1,170 @@ +TopologyRef in chemfiles - Rust

Struct chemfiles::TopologyRef

source ·
pub struct TopologyRef<'a> { /* private fields */ }
Expand description

An analog to a reference to a topology (&Topology)

+

Methods from Deref<Target = Topology>§

source

pub fn atom(&self, index: usize) -> AtomRef<'_>

Get a reference of the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+
source

pub fn size(&self) -> usize

Get the current number of atoms in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+
source

pub fn bonds_count(&self) -> usize

Get the number of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+
source

pub fn angles_count(&self) -> usize

Get the number of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+
source

pub fn dihedrals_count(&self) -> usize

Get the number of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+
source

pub fn impropers_count(&self) -> usize

Get the number of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+
source

pub fn bonds(&self) -> Vec<[usize; 2]>

Get the list of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+
source

pub fn angles(&self) -> Vec<[usize; 3]>

Get the list of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+
source

pub fn dihedrals(&self) -> Vec<[usize; 4]>

Get the list of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+
source

pub fn impropers(&self) -> Vec<[usize; 4]>

Get the list of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+
source

pub fn bond_order(&self, i: usize, j: usize) -> BondOrder

Get the bond order for the bond between the atoms at indexes i and +j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+
source

pub fn bond_orders(&self) -> Vec<BondOrder>

Get the bond order for all the bonds in the topology

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+
source

pub fn residue(&self, index: usize) -> Option<ResidueRef<'_>>

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+
source

pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef<'_>>

Get a copy of the residue containing the atom at index index in this +topology, if any.

+
Example
+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+
source

pub fn residues_count(&self) -> u64

Get the number of residues in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+
source

pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+
Example
+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations§

source§

impl<'a> Debug for TopologyRef<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for TopologyRef<'a>

§

type Target = Topology

The resulting type after dereferencing.
source§

fn deref(&self) -> &Topology

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for TopologyRef<'a>

§

impl<'a> !Send for TopologyRef<'a>

§

impl<'a> !Sync for TopologyRef<'a>

§

impl<'a> Unpin for TopologyRef<'a>

§

impl<'a> UnwindSafe for TopologyRef<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.Trajectory.html b/0.10.4/chemfiles/struct.Trajectory.html new file mode 100644 index 000000000..18fa7bd46 --- /dev/null +++ b/0.10.4/chemfiles/struct.Trajectory.html @@ -0,0 +1,159 @@ +Trajectory in chemfiles - Rust

Struct chemfiles::Trajectory

source ·
pub struct Trajectory { /* private fields */ }
Expand description

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

Implementations§

source§

impl Trajectory

source

pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>where + P: AsRef<Path>,

Open the file at the given path in the given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+
Errors
+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+
Example
+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
source

pub fn open_with_format<'a, P, S>( + filename: P, + mode: char, + format: S +) -> Result<Trajectory, Error>where + P: AsRef<Path>, + S: Into<&'a str>,

Open the file at the given path using a specific file format and the +given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Specifying a format is needed when the file format does not match the +extension, or when there is not standard extension for this format. If +format is an empty string, the format will be guessed from the +extension.

+
Errors
+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+
Example
+
let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+
source

pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>where + S: Into<&'a str>,

Write to a memory buffer as though it was a formatted file.

+

The format parameter should follow the same rules as in the main +Trajectory constructor, except that compression specification +is not supported.

+

The memory_buffer function can be used to retrieve the data written +to memory of the Trajectory.

+
Errors
+

This function fails if the format do not support in-memory writers.

+
Example
+
let trajectory_memory = Trajectory::memory_writer("SMI");
+
+// Binary formats typically do not support this feature
+assert!(Trajectory::memory_writer("XTC").is_err());
+
source

pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error>

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+
source

pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error>

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+
source

pub fn write(&mut self, frame: &Frame) -> Result<(), Error>

Write a frame to this trajectory.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+
source

pub fn set_topology(&mut self, topology: &Topology)

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+
Example
+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+
source

pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>where + P: AsRef<Path>,

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+
source

pub fn set_topology_with_format<'a, P, S>( + &mut self, + path: P, + format: S +) -> Result<(), Error>where + P: AsRef<Path>, + S: Into<&'a str>,

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+
source

pub fn set_cell(&mut self, cell: &UnitCell)

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+
source

pub fn nsteps(&mut self) -> usize

Get the number of steps (the number of frames) in a trajectory.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+
source

pub fn memory_buffer(&self) -> Result<&str, Error>

Obtain the memory buffer written to by the trajectory.

+
Errors
+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+
Example
+
let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+
source

pub fn path(&self) -> String

Get file path for this trajectory.

+
Example
+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations§

source§

impl Debug for Trajectory

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Trajectory

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.UnitCell.html b/0.10.4/chemfiles/struct.UnitCell.html new file mode 100644 index 000000000..5b82f2a1d --- /dev/null +++ b/0.10.4/chemfiles/struct.UnitCell.html @@ -0,0 +1,143 @@ +UnitCell in chemfiles - Rust

Struct chemfiles::UnitCell

source ·
pub struct UnitCell { /* private fields */ }
Expand description

An UnitCell represent the box containing the atoms, and its periodicity.

+

An unit cell is fully represented by three lengths (a, b, c); and three +angles (alpha, beta, gamma). The angles are stored in degrees, and the +lengths in Angstroms.

+

A cell also has a matricial representation, by projecting the three base +vector into an orthonormal base. We choose to represent such matrix as an +upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+

Implementations§

source§

impl UnitCell

source

pub fn new(lengths: [f64; 3]) -> UnitCell

Create an Orthorhombic UnitCell from the three lengths, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn infinite() -> UnitCell

Create an Infinite UnitCell.

+
Example
+
let cell = UnitCell::infinite();
+
+assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Infinite);
+
source

pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell

Create an Triclinic UnitCell from the three lengths (in Angstroms) +and three angles (in degree). alpha is the angle between the vectors +b and c; beta is the between the vectors a and c and gamma +is the angle between the vectors a and b.

+
Example
+
let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+assert_eq!(cell.angles()[0], 98.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+assert_eq!(cell.shape(), CellShape::Triclinic);
+
source

pub fn from_matrix(matrix: [[f64; 3]; 3]) -> UnitCell

Create an UnitCell from a cell matrix. If matrix contains only +zeros, then an Infinite cell is created. If only the diagonal of the +matrix is non-zero, then the cell is Orthorhombic. Else a +Triclinic cell is created. The matrix entries should be in Angstroms.

+
Panics
+

If the matrix has a negative determinant, or more generally is not +representing a unit cell.

+
Example
+
let cell = UnitCell::from_matrix([
+    [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+]);
+
+assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn lengths(&self) -> [f64; 3]

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+
source

pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error>

Set the three lengths of the cell, in Angstroms.

+
Errors
+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+
Example
+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+
source

pub fn angles(&self) -> [f64; 3]

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
source

pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error>

Set the three angles of the cell, in degrees.

+
Errors
+

This function fails if the unit cell is not Triclinic.

+
Example
+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
source

pub fn matrix(&self) -> [[f64; 3]; 3]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+
source

pub fn shape(&self) -> CellShape

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error>

Set the shape of the unit cell to shape.

+
Errors
+

This can fail if the cell length or angles are incompatible with the +new shape.

+
Example
+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+
source

pub fn volume(&self) -> f64

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+
source

pub fn wrap(&self, vector: &mut [f64; 3])

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations§

source§

impl Clone for UnitCell

source§

fn clone(&self) -> UnitCell

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UnitCell

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for UnitCell

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.UnitCellMut.html b/0.10.4/chemfiles/struct.UnitCellMut.html new file mode 100644 index 000000000..f307b2d99 --- /dev/null +++ b/0.10.4/chemfiles/struct.UnitCellMut.html @@ -0,0 +1,91 @@ +UnitCellMut in chemfiles - Rust

Struct chemfiles::UnitCellMut

source ·
pub struct UnitCellMut<'a> { /* private fields */ }
Expand description

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

Methods from Deref<Target = UnitCell>§

source

pub fn lengths(&self) -> [f64; 3]

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+
source

pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error>

Set the three lengths of the cell, in Angstroms.

+
Errors
+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+
Example
+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+
source

pub fn angles(&self) -> [f64; 3]

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
source

pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error>

Set the three angles of the cell, in degrees.

+
Errors
+

This function fails if the unit cell is not Triclinic.

+
Example
+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
source

pub fn matrix(&self) -> [[f64; 3]; 3]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+
source

pub fn shape(&self) -> CellShape

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error>

Set the shape of the unit cell to shape.

+
Errors
+

This can fail if the cell length or angles are incompatible with the +new shape.

+
Example
+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+
source

pub fn volume(&self) -> f64

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+
source

pub fn wrap(&self, vector: &mut [f64; 3])

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations§

source§

impl<'a> Debug for UnitCellMut<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for UnitCellMut<'a>

§

type Target = UnitCell

The resulting type after dereferencing.
source§

fn deref(&self) -> &UnitCell

Dereferences the value.
source§

impl<'a> DerefMut for UnitCellMut<'a>

source§

fn deref_mut(&mut self) -> &mut UnitCell

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for UnitCellMut<'a>

§

impl<'a> !Send for UnitCellMut<'a>

§

impl<'a> !Sync for UnitCellMut<'a>

§

impl<'a> Unpin for UnitCellMut<'a>

§

impl<'a> !UnwindSafe for UnitCellMut<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/struct.UnitCellRef.html b/0.10.4/chemfiles/struct.UnitCellRef.html new file mode 100644 index 000000000..311769e7f --- /dev/null +++ b/0.10.4/chemfiles/struct.UnitCellRef.html @@ -0,0 +1,58 @@ +UnitCellRef in chemfiles - Rust

Struct chemfiles::UnitCellRef

source ·
pub struct UnitCellRef<'a> { /* private fields */ }
Expand description

An analog to a reference to an unit cell (&UnitCell)

+

Methods from Deref<Target = UnitCell>§

source

pub fn lengths(&self) -> [f64; 3]

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+
source

pub fn angles(&self) -> [f64; 3]

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
source

pub fn matrix(&self) -> [[f64; 3]; 3]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+
source

pub fn shape(&self) -> CellShape

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn volume(&self) -> f64

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+
source

pub fn wrap(&self, vector: &mut [f64; 3])

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations§

source§

impl<'a> Debug for UnitCellRef<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for UnitCellRef<'a>

§

type Target = UnitCell

The resulting type after dereferencing.
source§

fn deref(&self) -> &UnitCell

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for UnitCellRef<'a>

§

impl<'a> !Send for UnitCellRef<'a>

§

impl<'a> !Sync for UnitCellRef<'a>

§

impl<'a> Unpin for UnitCellRef<'a>

§

impl<'a> UnwindSafe for UnitCellRef<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.4/chemfiles/topology/enum.BondOrder.html b/0.10.4/chemfiles/topology/enum.BondOrder.html new file mode 100644 index 000000000..14589bc12 --- /dev/null +++ b/0.10.4/chemfiles/topology/enum.BondOrder.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.BondOrder.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/topology/struct.Topology.html b/0.10.4/chemfiles/topology/struct.Topology.html new file mode 100644 index 000000000..1215dacfd --- /dev/null +++ b/0.10.4/chemfiles/topology/struct.Topology.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Topology.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/topology/struct.TopologyRef.html b/0.10.4/chemfiles/topology/struct.TopologyRef.html new file mode 100644 index 000000000..7cdec6164 --- /dev/null +++ b/0.10.4/chemfiles/topology/struct.TopologyRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.TopologyRef.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/trajectory/struct.MemoryTrajectoryReader.html b/0.10.4/chemfiles/trajectory/struct.MemoryTrajectoryReader.html new file mode 100644 index 000000000..2d8d0b029 --- /dev/null +++ b/0.10.4/chemfiles/trajectory/struct.MemoryTrajectoryReader.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.MemoryTrajectoryReader.html...

+ + + \ No newline at end of file diff --git a/0.10.4/chemfiles/trajectory/struct.Trajectory.html b/0.10.4/chemfiles/trajectory/struct.Trajectory.html new file mode 100644 index 000000000..bab83ffc9 --- /dev/null +++ b/0.10.4/chemfiles/trajectory/struct.Trajectory.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Trajectory.html...

+ + + \ No newline at end of file diff --git a/0.10.4/crates.js b/0.10.4/crates.js new file mode 100644 index 000000000..833ec8f70 --- /dev/null +++ b/0.10.4/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["chemfiles"]; \ No newline at end of file diff --git a/0.10.4/help.html b/0.10.4/help.html new file mode 100644 index 000000000..9c53f6f6c --- /dev/null +++ b/0.10.4/help.html @@ -0,0 +1 @@ +Rustdoc help

Rustdoc help

Back
\ No newline at end of file diff --git a/0.10.4/implementors/core/clone/trait.Clone.js b/0.10.4/implementors/core/clone/trait.Clone.js new file mode 100644 index 000000000..bdcafd59d --- /dev/null +++ b/0.10.4/implementors/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Clone for Atom"],["impl Clone for Property"],["impl Clone for Residue"],["impl Clone for Frame"],["impl Clone for Status"],["impl Clone for Match"],["impl Clone for FormatMetadata"],["impl Clone for Topology"],["impl Clone for Selection"],["impl Clone for BondOrder"],["impl Clone for CellShape"],["impl Clone for UnitCell"],["impl Clone for Error"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/cmp/trait.Eq.js b/0.10.4/implementors/core/cmp/trait.Eq.js new file mode 100644 index 000000000..da7591ea8 --- /dev/null +++ b/0.10.4/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Eq for Error"],["impl Eq for Status"],["impl Eq for Match"],["impl Eq for CellShape"],["impl Eq for FormatMetadata"],["impl Eq for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/cmp/trait.Ord.js b/0.10.4/implementors/core/cmp/trait.Ord.js new file mode 100644 index 000000000..42b233163 --- /dev/null +++ b/0.10.4/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Ord for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/cmp/trait.PartialEq.js b/0.10.4/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..2d32b629d --- /dev/null +++ b/0.10.4/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl PartialEq<BondOrder> for BondOrder"],["impl PartialEq<Property> for Property"],["impl PartialEq<CellShape> for CellShape"],["impl PartialEq<Status> for Status"],["impl PartialEq<FormatMetadata> for FormatMetadata"],["impl PartialEq<Error> for Error"],["impl PartialEq<Match> for Match"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/cmp/trait.PartialOrd.js b/0.10.4/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..3948947ec --- /dev/null +++ b/0.10.4/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl PartialOrd<Property> for Property"],["impl PartialOrd<BondOrder> for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/convert/trait.From.js b/0.10.4/implementors/core/convert/trait.From.js new file mode 100644 index 000000000..8b2cb2557 --- /dev/null +++ b/0.10.4/implementors/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> From<&'a str> for Property"],["impl From<chfl_cellshape> for CellShape"],["impl From<String> for Property"],["impl From<chfl_status> for Error"],["impl From<[f64; 3]> for Property"],["impl From<chfl_bond_order> for BondOrder"],["impl From<bool> for Property"],["impl From<CellShape> for chfl_cellshape"],["impl From<Utf8Error> for Error"],["impl From<f64> for Property"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/error/trait.Error.js b/0.10.4/implementors/core/error/trait.Error.js new file mode 100644 index 000000000..f894a3c3b --- /dev/null +++ b/0.10.4/implementors/core/error/trait.Error.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Error for Error"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/fmt/trait.Debug.js b/0.10.4/implementors/core/fmt/trait.Debug.js new file mode 100644 index 000000000..3e665c2ed --- /dev/null +++ b/0.10.4/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> Debug for AtomMut<'a>"],["impl Debug for UnitCell"],["impl<'a> Debug for TopologyRef<'a>"],["impl Debug for Atom"],["impl<'a> Debug for UnitCellRef<'a>"],["impl Debug for CellShape"],["impl Debug for Property"],["impl Debug for Error"],["impl<'a> Debug for ResidueRef<'a>"],["impl Debug for Topology"],["impl Debug for Match"],["impl Debug for Selection"],["impl Debug for BondOrder"],["impl Debug for Trajectory"],["impl<'a> Debug for UnitCellMut<'a>"],["impl Debug for Frame"],["impl Debug for Status"],["impl Debug for FormatMetadata"],["impl Debug for Residue"],["impl<'a> Debug for AtomRef<'a>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/fmt/trait.Display.js b/0.10.4/implementors/core/fmt/trait.Display.js new file mode 100644 index 000000000..45d534ff3 --- /dev/null +++ b/0.10.4/implementors/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Display for Error"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/iter/traits/collect/trait.IntoIterator.js b/0.10.4/implementors/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 000000000..594369825 --- /dev/null +++ b/0.10.4/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> IntoIterator for &'a Match"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/iter/traits/iterator/trait.Iterator.js b/0.10.4/implementors/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 000000000..de85e84a0 --- /dev/null +++ b/0.10.4/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> Iterator for PropertiesIter<'a>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/marker/trait.Copy.js b/0.10.4/implementors/core/marker/trait.Copy.js new file mode 100644 index 000000000..18d32a528 --- /dev/null +++ b/0.10.4/implementors/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Copy for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/marker/trait.Freeze.js b/0.10.4/implementors/core/marker/trait.Freeze.js new file mode 100644 index 000000000..b8a14d050 --- /dev/null +++ b/0.10.4/implementors/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Freeze for Error",1,["chemfiles::errors::Error"]],["impl Freeze for Status",1,["chemfiles::errors::Status"]],["impl Freeze for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> Freeze for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> Freeze for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl Freeze for CellShape",1,["chemfiles::cell::CellShape"]],["impl Freeze for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> Freeze for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> Freeze for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl Freeze for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> Freeze for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl Freeze for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl Freeze for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> Freeze for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl Freeze for Frame",1,["chemfiles::frame::Frame"]],["impl Freeze for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> Freeze for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl Freeze for Match",1,["chemfiles::selection::Match"]],["impl Freeze for Selection",1,["chemfiles::selection::Selection"]],["impl Freeze for Property",1,["chemfiles::property::Property"]],["impl<'a> Freeze for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl Freeze for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/marker/trait.Send.js b/0.10.4/implementors/core/marker/trait.Send.js new file mode 100644 index 000000000..d27da4c01 --- /dev/null +++ b/0.10.4/implementors/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Send for Error",1,["chemfiles::errors::Error"]],["impl Send for Status",1,["chemfiles::errors::Status"]],["impl !Send for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> !Send for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> !Send for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl Send for CellShape",1,["chemfiles::cell::CellShape"]],["impl !Send for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> !Send for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> !Send for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl !Send for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> !Send for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl Send for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl !Send for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> !Send for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl !Send for Frame",1,["chemfiles::frame::Frame"]],["impl !Send for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> !Send for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl Send for Match",1,["chemfiles::selection::Match"]],["impl !Send for Selection",1,["chemfiles::selection::Selection"]],["impl Send for Property",1,["chemfiles::property::Property"]],["impl<'a> !Send for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl Send for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/marker/trait.StructuralEq.js b/0.10.4/implementors/core/marker/trait.StructuralEq.js new file mode 100644 index 000000000..df434a1f5 --- /dev/null +++ b/0.10.4/implementors/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl StructuralEq for FormatMetadata"],["impl StructuralEq for CellShape"],["impl StructuralEq for Error"],["impl StructuralEq for BondOrder"],["impl StructuralEq for Match"],["impl StructuralEq for Status"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/marker/trait.StructuralPartialEq.js b/0.10.4/implementors/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 000000000..8d318c8ef --- /dev/null +++ b/0.10.4/implementors/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl StructuralPartialEq for Status"],["impl StructuralPartialEq for CellShape"],["impl StructuralPartialEq for Match"],["impl StructuralPartialEq for BondOrder"],["impl StructuralPartialEq for FormatMetadata"],["impl StructuralPartialEq for Property"],["impl StructuralPartialEq for Error"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/marker/trait.Sync.js b/0.10.4/implementors/core/marker/trait.Sync.js new file mode 100644 index 000000000..2b245a374 --- /dev/null +++ b/0.10.4/implementors/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Sync for Error",1,["chemfiles::errors::Error"]],["impl Sync for Status",1,["chemfiles::errors::Status"]],["impl !Sync for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> !Sync for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> !Sync for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl Sync for CellShape",1,["chemfiles::cell::CellShape"]],["impl !Sync for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> !Sync for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> !Sync for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl !Sync for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> !Sync for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl Sync for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl !Sync for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> !Sync for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl !Sync for Frame",1,["chemfiles::frame::Frame"]],["impl !Sync for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> !Sync for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl Sync for Match",1,["chemfiles::selection::Match"]],["impl !Sync for Selection",1,["chemfiles::selection::Selection"]],["impl Sync for Property",1,["chemfiles::property::Property"]],["impl<'a> !Sync for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl Sync for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/marker/trait.Unpin.js b/0.10.4/implementors/core/marker/trait.Unpin.js new file mode 100644 index 000000000..2c8a8f4a4 --- /dev/null +++ b/0.10.4/implementors/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Unpin for Error",1,["chemfiles::errors::Error"]],["impl Unpin for Status",1,["chemfiles::errors::Status"]],["impl Unpin for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> Unpin for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> Unpin for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl Unpin for CellShape",1,["chemfiles::cell::CellShape"]],["impl Unpin for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> Unpin for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> Unpin for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl Unpin for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> Unpin for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl Unpin for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl Unpin for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> Unpin for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl Unpin for Frame",1,["chemfiles::frame::Frame"]],["impl Unpin for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> Unpin for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl Unpin for Match",1,["chemfiles::selection::Match"]],["impl Unpin for Selection",1,["chemfiles::selection::Selection"]],["impl Unpin for Property",1,["chemfiles::property::Property"]],["impl<'a> Unpin for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl Unpin for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/ops/deref/trait.Deref.js b/0.10.4/implementors/core/ops/deref/trait.Deref.js new file mode 100644 index 000000000..ae4b18175 --- /dev/null +++ b/0.10.4/implementors/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> Deref for ResidueRef<'a>"],["impl<'a> Deref for AtomRef<'a>"],["impl<'a> Deref for UnitCellRef<'a>"],["impl<'a> Deref for UnitCellMut<'a>"],["impl<'a> Deref for MemoryTrajectoryReader<'a>"],["impl<'a> Deref for TopologyRef<'a>"],["impl<'a> Deref for AtomMut<'a>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/ops/deref/trait.DerefMut.js b/0.10.4/implementors/core/ops/deref/trait.DerefMut.js new file mode 100644 index 000000000..ae0d9f9c1 --- /dev/null +++ b/0.10.4/implementors/core/ops/deref/trait.DerefMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> DerefMut for MemoryTrajectoryReader<'a>"],["impl<'a> DerefMut for UnitCellMut<'a>"],["impl<'a> DerefMut for AtomMut<'a>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/ops/drop/trait.Drop.js b/0.10.4/implementors/core/ops/drop/trait.Drop.js new file mode 100644 index 000000000..054c9654d --- /dev/null +++ b/0.10.4/implementors/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Drop for Atom"],["impl Drop for Residue"],["impl Drop for Selection"],["impl Drop for Topology"],["impl Drop for UnitCell"],["impl Drop for Trajectory"],["impl Drop for Frame"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/ops/index/trait.Index.js b/0.10.4/implementors/core/ops/index/trait.Index.js new file mode 100644 index 000000000..7a7638aa5 --- /dev/null +++ b/0.10.4/implementors/core/ops/index/trait.Index.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Index<usize> for Match"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/0.10.4/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 000000000..ea23b6dce --- /dev/null +++ b/0.10.4/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl RefUnwindSafe for Error",1,["chemfiles::errors::Error"]],["impl RefUnwindSafe for Status",1,["chemfiles::errors::Status"]],["impl RefUnwindSafe for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> RefUnwindSafe for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> RefUnwindSafe for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl RefUnwindSafe for CellShape",1,["chemfiles::cell::CellShape"]],["impl RefUnwindSafe for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> RefUnwindSafe for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> RefUnwindSafe for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl RefUnwindSafe for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> RefUnwindSafe for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl RefUnwindSafe for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl RefUnwindSafe for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> RefUnwindSafe for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl RefUnwindSafe for Frame",1,["chemfiles::frame::Frame"]],["impl RefUnwindSafe for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> RefUnwindSafe for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl RefUnwindSafe for Match",1,["chemfiles::selection::Match"]],["impl RefUnwindSafe for Selection",1,["chemfiles::selection::Selection"]],["impl RefUnwindSafe for Property",1,["chemfiles::property::Property"]],["impl<'a> !RefUnwindSafe for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl RefUnwindSafe for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/0.10.4/implementors/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 000000000..3d6c86422 --- /dev/null +++ b/0.10.4/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl UnwindSafe for Error",1,["chemfiles::errors::Error"]],["impl UnwindSafe for Status",1,["chemfiles::errors::Status"]],["impl UnwindSafe for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> UnwindSafe for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> !UnwindSafe for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl UnwindSafe for CellShape",1,["chemfiles::cell::CellShape"]],["impl UnwindSafe for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> UnwindSafe for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> !UnwindSafe for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl UnwindSafe for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> UnwindSafe for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl UnwindSafe for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl UnwindSafe for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> UnwindSafe for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl UnwindSafe for Frame",1,["chemfiles::frame::Frame"]],["impl UnwindSafe for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> UnwindSafe for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl UnwindSafe for Match",1,["chemfiles::selection::Match"]],["impl UnwindSafe for Selection",1,["chemfiles::selection::Selection"]],["impl UnwindSafe for Property",1,["chemfiles::property::Property"]],["impl<'a> !UnwindSafe for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl UnwindSafe for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.4/index.html b/0.10.4/index.html new file mode 100644 index 000000000..8b8b920bb --- /dev/null +++ b/0.10.4/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/0.10.4/search-index.js b/0.10.4/search-index.js new file mode 100644 index 000000000..e91bc2aba --- /dev/null +++ b/0.10.4/search-index.js @@ -0,0 +1,5 @@ +var searchIndex = JSON.parse('{\ +"chemfiles":{"doc":"Chemfiles is a multi-language library written in modern …","t":"NNDDDENENNNNDNNDDNDNDNNDENNNDDDNNENNNDDDNNNDDDNNLLLLLLLFLLLLLLLLLLLLLLLMLLLMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLLLLLLLLLLLLLLLLLLMLLLLLLLLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLMLLMLLLLLLLLLLLLLLLLLMLLLLLLMLMLLLLLLMLLLLLLLLLLLLLLLLLLLLFLLLLLLMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLMLFLLLLM","n":["Amide","Aromatic","Atom","AtomMut","AtomRef","BondOrder","Bool","CellShape","ChemfilesError","ConfigurationError","Double","Double","Error","FileError","FormatError","FormatMetadata","Frame","Infinite","Match","MemoryError","MemoryTrajectoryReader","Orthorhombic","OutOfBounds","PropertiesIter","Property","PropertyError","Quadruple","Quintuplet","Residue","ResidueRef","Selection","SelectionError","Single","Status","StdCppError","String","Success","Topology","TopologyRef","Trajectory","Triclinic","Triple","UTF8PathError","UnitCell","UnitCellMut","UnitCellRef","Unknown","Vector3D","add_atom","add_atom","add_atom","add_bond","add_bond","add_bond_with_order","add_bond_with_order","add_configuration","add_residue","add_residue","add_velocities","angle","angles","angles","angles_count","are_linked","atom","atom","atom_mut","atom_mut","atomic_number","atomic_type","atoms","atoms","bond_order","bond_orders","bonds","bonds","bonds_count","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","cell","cell_mut","charge","cleanup","clear_bonds","clear_bonds","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","contains","count","covalent_radius","deref","deref","deref","deref","deref","deref","deref","deref_mut","deref_mut","deref_mut","description","description","dihedral","dihedrals","dihedrals_count","distance","drop","drop","drop","drop","drop","drop","drop","eq","eq","eq","eq","eq","eq","eq","evaluate","extension","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","formats_list","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_matrix","full_name","get","get","get","guess_bonds","guess_format","has_velocities","id","impropers","impropers_count","index","infinite","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into_iter","into_iter","iter","iter_atoms","last_error","len","lengths","list","mass","matrix","memory","memory_buffer","memory_writer","message","name","name","name","new","new","new","new","new","new","new","new","next","nsteps","open","open_with_format","out_of_plane","partial_cmp","partial_cmp","path","positions","positions","positions_mut","properties","properties","properties","provide","read","read","read_step","reference","remove","remove","remove_bond","remove_bond","residue","residue_for_atom","residues","residues_count","resize","resize","set","set","set","set_angles","set_atomic_type","set_cell","set_cell","set_charge","set_lengths","set_mass","set_name","set_shape","set_step","set_topology","set_topology","set_topology_file","set_topology_with_format","set_warning_callback","shape","size","size","size","size","size_hint","status","step","string","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","topology","triclinic","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","unit_cell","vdw_radius","velocities","velocities","velocities_mut","version","volume","with_id","wrap","write","write"],"q":["chemfiles","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],"d":["Amide bond (required by some file formats)","Aromatic bond (required by some file formats)","An Atom is a particle in the current Frame. It stores the …","An analog to a mutable reference to an atom (&mut Atom)","An analog to a reference to an atom (&Atom)","Possible bond order associated with bonds","Boolean property","Available unit cell shapes.","Exception in the C++ chemfiles library","Error in configuration files syntax","Double bond","Floating point property","Error type for Chemfiles.","Error while reading or writing a file","Error in file formatting, i.e. the file is invalid","FormatMetadata contains metadata associated with one …","A Frame contains data from one simulation step: the …","Infinite cell, to use when there is no cell.","A Match is a set of atomic indexes matching a given …","Error in memory allocations","MemoryTrajectoryReader is a handle for a Trajectory in …","Orthorhombic cell, with the three angles equals to 90°.","Error for out of bounds indexing","An iterator over the properties in an atom/frame/residue","A Property is a piece of data that can be associated with …","Error related to properties","Quadruple bond (present in some metals)","Quintuplet bond (present in some metals)","A Residue is a group of atoms belonging to the same …","An analog to a reference to a residue (&Residue)","A Selection allow to select atoms in a Frame, from a …","Error in selection string syntax","Single bond","Possible causes of error in chemfiles","Exception in the C++ standard library","String property","No error","A Topology contains the definition of all the atoms in the …","An analog to a reference to a topology (&Topology)","The Trajectory type is the main entry point when using …","Triclinic cell, with any values for the angles.","Triple bond","The given path is not valid UTF8","An UnitCell represent the box containing the atoms, and …","An analog to a mutable reference to an unit cell (…","An analog to a reference to an unit cell (&UnitCell)","Unknown or unspecified bond order","3-dimensional vector property","Add the atom at index atom in this residue.","Add an Atom at the end of this topology","Add an Atom and the corresponding position and optionally …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Read configuration data from the file at path.","Add a residue to this topology.","Add a copy of residue to this frame.","Add velocity data to this frame. If the frame already have …","Get the angle formed by the atoms at indexes i, j and k in …","Get the three angles of the cell, in degrees.","Get the list of angles in the topology.","Get the number of angles in the topology.","Check if the two residues first and second from the …","Get a reference of the atom at the given index in this …","Get a reference to the atom at the given index in this …","Get a mutable reference to the atom at the given index in …","Get a mutable reference to the atom at the given index in …","Try to get the atomic number of the atom from the atomic …","Get the atom type.","Get the list of atoms of this residue.","Does this format support storing atom names or types?","Get the bond order for the bond between the atoms at …","Get the bond order for all the bonds in the topology","Get the list of bonds in the topology.","Does this format support storing bonds between atoms?","Get the number of bonds in the topology.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get a reference to the UnitCell from this frame.","Get a mutable reference to the UnitCell from this frame.","Get the atom charge, in number of the electron charge e.","Clear any error from the C++ library","Remove all existing bonds, angles, dihedral angles and …","Remove all existing bonds, angles, dihedral angles and …","","","","","","","","","","","","","","","","","","","","","","","","","","","","Check if the atom at index i is in this residue","","Try to get the covalent radius of the atom from the atomic …","","","","","","","","","","","","Extended, user-facing description of the format.","Get the dihedral angle formed by the atoms at indexes i, j…","Get the list of dihedral angles in the topology.","Get the number of dihedral angles in the topology.","Get the distance between the atoms at indexes i and j in …","","","","","","","","","","","","","","","Evaluate a selection for a given frame, and return the …","Extension associated with the format.","","","","","","","","","","","","","","","","","","","","","","Get the list of formats known by chemfiles, as well as all …","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","Returns the argument unchanged.","","Returns the argument unchanged.","Create an UnitCell from a cell matrix. If matrix contains …","Try to get the full name of the atom from the atomic type. …","Get a property with the given name in this atom, if it …","Get a property with the given name in this frame, if it …","Get a property with the given name in this frame, if it …","Guess the bonds, angles and dihedrals in this frame.","Get the format that chemfiles would use to read a file at …","Check if this frame contains velocity data.","Get the identifier of this residue in the initial topology …","Get the list of improper dihedral angles in the topology.","Get the number of improper dihedral angles in the topology.","","Create an Infinite UnitCell.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","Iterate over the atomic indexes in the match.","Gets an iterator over atoms","Get the last error message from the C++ library.","Get the length of the Match.","Get the three lengths of the cell, in Angstroms.","Evaluates a selection of size 1 on a given frame. This …","Get the atom mass, in atomic mass units.","Get the unit cell matricial representation.","Does this format support in-memory IO?","Obtain the memory buffer written to by the trajectory.","Write to a memory buffer as though it was a formatted file.","A message describing the error cause","Get the atom name.","Get the name of this residue.","Name of the format.","Read a memory buffer as though it was a formatted file.","Create an atom with the given name, and set the atom type …","Create an Orthorhombic UnitCell from the three lengths, in …","Create a new residue with the given name","Create a new empty topology.","Create an empty frame. It will be resized by the library …","Create a new match containing the atoms in the atoms slice.","Create a new selection from the given selection string.","","Get the number of steps (the number of frames) in a …","Open the file at the given path in the given mode.","Open the file at the given path using a specific file …","Get the out of plane distance formed by the atoms at …","","","Get file path for this trajectory.","Get a view into the positions of this frame.","Does this format support storing atomic positions?","Get a mutable view into the positions of this frame.","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","","Read the next step of this trajectory into a frame.","Is reading files in this format implemented?","Read a specific step of this trajectory into a frame.","URL pointing to the format definition/reference.","Remove an Atom from this topology by index. This modify …","Remove the atom at index i in this frame.","Remove any existing bond between the atoms at indexes i …","Remove any existing bond between the atoms at indexes i …","Get a reference to the residue at index index from this …","Get a copy of the residue containing the atom at index …","Does this format support storing residues?","Get the number of residues in this topology.","Resize this topology to hold natoms atoms, inserting dummy …","Resize the positions and the velocities in this frame, to …","Add a new property with the given name to this atom.","Add a new property with the given name to this residue.","Add a new property with the given name to this frame.","Set the three angles of the cell, in degrees.","Set the atom type to atomic_type.","Set the UnitCell of this frame to cell.","Set the unit cell associated with a trajectory. This cell …","Set the atom charge to charge, in number of the electron …","Set the three lengths of the cell, in Angstroms.","Set the atom mass to mass, in atomic mass units.","Set the atom name to name.","Set the shape of the unit cell to shape.","Set this frame step to step.","Set the Topology of this frame to topology.","Set the topology associated with this trajectory. This …","Set the topology associated with this trajectory by …","Set the topology associated with this trajectory by …","Use callback for every chemfiles warning. The callback …","Get the shape of the unit cell.","Get the number of atoms in this residue.","Get the current number of atoms in this topology.","Get the current number of atoms in this frame.","Get the size of the selection, i.e. the number of atoms we …","","The error status code","Get this frame step, i.e. the frame number in the …","Get the selection string used to create this selection.","","","","","","","","","","","","","","","Get a reference to the Topology of this frame.","Create an Triclinic UnitCell from the three lengths (in …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Does this format support storing unit cell information?","Try to get the Van der Waals radius of the atom from the …","Get a view into the velocities of this frame.","Does this format support storing atomic velocities?","Get a mutable view into the velocities of this frame.","Get the version of the chemfiles library.","Get the volume of the unit cell.","Create a new residue with the given name and id as …","Wrap a vector in this unit cell.","Write a frame to this trajectory.","Is writing files in this format implemented?"],"i":[8,8,0,0,0,0,25,0,21,21,8,25,0,21,21,0,0,22,0,21,0,22,21,0,0,21,8,8,0,0,0,21,8,0,21,25,21,0,0,0,22,8,21,0,0,0,8,25,1,3,5,3,5,3,5,0,3,5,5,5,12,3,3,3,3,5,3,5,4,4,1,26,3,3,3,26,3,29,28,9,21,4,15,16,22,12,19,20,1,30,8,3,31,5,33,23,24,25,26,29,28,9,21,4,15,16,22,12,19,20,1,30,8,3,31,5,33,23,24,25,26,5,5,4,9,3,5,9,21,4,22,12,1,8,3,5,23,24,25,26,9,21,4,22,12,1,8,3,5,23,24,25,26,8,1,28,4,29,15,16,19,20,30,31,29,16,20,9,26,5,3,3,5,4,12,1,3,5,33,24,9,21,22,8,23,25,26,24,26,9,9,21,4,15,16,22,12,19,20,1,30,8,3,31,5,33,23,24,25,26,0,29,28,9,9,9,21,4,15,16,22,22,12,19,20,1,30,8,8,3,31,5,33,23,24,25,25,25,25,25,25,26,12,4,4,1,5,5,0,5,1,3,3,23,12,29,28,9,21,4,15,16,22,12,19,20,1,30,8,3,31,5,33,23,24,25,26,28,23,23,5,9,23,12,24,4,12,26,33,33,9,4,1,26,29,4,12,1,3,5,23,24,28,33,33,33,5,8,25,33,5,26,5,4,1,5,9,33,26,33,26,3,5,3,5,3,3,26,3,3,5,4,1,5,12,4,5,33,4,12,4,4,12,5,5,33,33,33,0,12,1,3,5,24,28,9,5,24,9,21,4,22,12,1,8,3,5,23,24,25,26,9,5,12,29,28,9,21,4,15,16,22,12,19,20,1,30,8,3,31,5,33,23,24,25,26,29,28,9,21,4,15,16,22,12,19,20,1,30,8,3,31,5,33,23,24,25,26,29,28,9,21,4,15,16,22,12,19,20,1,30,8,3,31,5,33,23,24,25,26,26,4,5,26,5,0,12,1,12,33,26],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[1,2]],[[3,4]],[[5,4,[7,[6]]]],[[3,2,2]],[[5,2,2]],[[3,2,2,8]],[[5,2,2,8]],[[],[[10,[9]]]],[[3,1],[[10,[9]]]],[[5,1],[[10,[9]]]],[5],[[5,2,2,2],11],[12],[3,13],[3,2],[[3,1,1],14],[[3,2],15],[[5,2],15],[[3,2],16],[[5,2],16],[4,17],[4,18],[1,[[13,[2]]]],0,[[3,2,2],8],[3,[[13,[8]]]],[3,13],0,[3,2],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[5,19],[5,20],[4,11],[[]],[3],[5],[9,9],[21,21],[4,4],[22,22],[12,12],[1,1],[8,8],[3,3],[5,5],[23,23],[24,24],[25,25],[26,26],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[8,8],27],[[1,2],14],[28,2],[4,11],[29],[15,4],[16,4],[19,12],[20,12],[30,1],[31,3],[29],[16,4],[20,12],[9,32],0,[[5,2,2,2,2],11],[3,13],[3,2],[[5,2,2],11],[4],[12],[1],[3],[5],[33],[24],[[9,9],14],[[21,21],14],[[22,22],14],[[8,8],14],[[23,23],14],[[25,25],14],[[26,26],14],[[24,5],[[13,[23]]]],0,[[9,34],[[10,[35]]]],[[9,34],36],[[21,34],36],[[4,34],36],[[15,34],36],[[16,34],36],[[22,34],36],[[12,34],36],[[19,34],36],[[20,34],36],[[1,34],36],[[30,34],36],[[8,34],36],[[3,34],36],[[31,34],36],[[5,34],36],[[33,34],36],[[23,34],36],[[24,34],36],[[25,34],36],[[26,34],36],[[],[[13,[26]]]],[[]],[[]],[37,9],[[]],[38,9],[[]],[[]],[[]],[[]],[39,22],[[]],[[]],[[]],[[]],[[]],[[]],[40,8],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[18,25],[[],25],[14,25],[32,25],[[]],[11,25],[[]],[[],12],[4,18],[[4,32],[[6,[25]]]],[[1,32],[[6,[25]]]],[[5,32],[[6,[25]]]],[5,[[10,[9]]]],[[],[[10,[18,9]]]],[5,14],[1,[[6,[41]]]],[3,13],[3,2],[[23,2]],[[],12],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[23],[23,[[42,[2]]]],0,[[],18],[23,2],[12],[[24,5],[[13,[2]]]],[4,11],[12],0,[33,[[10,[32,9]]]],[[],[[10,[33,9]]]],0,[4,18],[1,18],0,[[],[[10,[29,9]]]],[[[7,[32]]],4],[[],12],[[[7,[32]]],1],[[],3],[[],5],[[],23],[[[7,[32]]],[[10,[24,9]]]],[28,6],[33,2],[43,[[10,[33,9]]]],[43,[[10,[33,9]]]],[[5,2,2,2,2],11],[[8,8],[[6,[27]]]],[[25,25],[[6,[27]]]],[33,18],[5],0,[5],[4,28],[1,28],[5,28],[44],[[33,5],[[10,[9]]]],0,[[33,2,5],[[10,[9]]]],0,[[3,2]],[[5,2]],[[3,2,2]],[[5,2,2]],[[3,2],[[6,[30]]]],[[3,2],[[6,[30]]]],0,[3,17],[[3,2]],[[5,2]],[[4,32,[7,[25]]]],[[1,32,[7,[25]]]],[[5,32,[7,[25]]]],[12,[[10,[9]]]],[[4,[7,[32]]]],[[5,12]],[[33,12]],[[4,11]],[12,[[10,[9]]]],[[4,11]],[[4,[7,[32]]]],[[12,22],[[10,[9]]]],[[5,2]],[[5,3],[[10,[9]]]],[[33,3]],[33,[[10,[9]]]],[33,[[10,[9]]]],[[]],[12,22],[1,2],[3,2],[5,2],[24,2],[28],0,[5,2],[24,18],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],18],[5,31],[[],12],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],10],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],0,[4,11],[5,6],0,[5,6],[[],18],[12,11],[[[7,[32]],41],1],[12],[[33,5],[[10,[9]]]],0],"p":[[3,"Residue"],[15,"usize"],[3,"Topology"],[3,"Atom"],[3,"Frame"],[4,"Option"],[8,"Into"],[4,"BondOrder"],[3,"Error"],[4,"Result"],[15,"f64"],[3,"UnitCell"],[3,"Vec"],[15,"bool"],[3,"AtomRef"],[3,"AtomMut"],[15,"u64"],[3,"String"],[3,"UnitCellRef"],[3,"UnitCellMut"],[4,"Status"],[4,"CellShape"],[3,"Match"],[3,"Selection"],[4,"Property"],[3,"FormatMetadata"],[4,"Ordering"],[3,"PropertiesIter"],[3,"MemoryTrajectoryReader"],[3,"ResidueRef"],[3,"TopologyRef"],[15,"str"],[3,"Trajectory"],[3,"Formatter"],[3,"Error"],[6,"Result"],[3,"Utf8Error"],[4,"chfl_status"],[4,"chfl_cellshape"],[4,"chfl_bond_order"],[15,"i64"],[3,"Iter"],[15,"char"],[3,"Demand"],[3,"TypeId"]]}\ +}'); +if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; +if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; diff --git a/0.10.4/settings.html b/0.10.4/settings.html new file mode 100644 index 000000000..9135508e6 --- /dev/null +++ b/0.10.4/settings.html @@ -0,0 +1 @@ +Rustdoc settings

Rustdoc settings

Back
\ No newline at end of file diff --git a/0.10.4/source-files.js b/0.10.4/source-files.js new file mode 100644 index 000000000..6f5ac469c --- /dev/null +++ b/0.10.4/source-files.js @@ -0,0 +1,4 @@ +var sourcesIndex = JSON.parse('{\ +"chemfiles":["",[],["atom.rs","cell.rs","errors.rs","frame.rs","lib.rs","misc.rs","property.rs","residue.rs","selection.rs","strings.rs","topology.rs","trajectory.rs"]]\ +}'); +createSourceSidebar(); diff --git a/0.10.4/src/chemfiles/atom.rs.html b/0.10.4/src/chemfiles/atom.rs.html new file mode 100644 index 000000000..6909a1ee3 --- /dev/null +++ b/0.10.4/src/chemfiles/atom.rs.html @@ -0,0 +1,1054 @@ +atom.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::marker::PhantomData;
+
+use chemfiles_sys::*;
+
+use crate::errors::{check_not_null, check_success};
+use crate::property::{PropertiesIter, Property, RawProperty};
+use crate::strings;
+
+/// An `Atom` is a particle in the current `Frame`. It stores the following
+/// atomic properties:
+///
+/// - atom name;
+/// - atom type;
+/// - atom mass;
+/// - atom charge.
+///
+/// The atom name is usually an unique identifier (`H1`, `C_a`) while the
+/// atom type will be shared between all particles of the same type: `H`,
+/// `Ow`, `CH3`.
+#[derive(Debug)]
+pub struct Atom {
+    handle: *mut CHFL_ATOM,
+}
+
+/// An analog to a reference to an atom (`&Atom`)
+#[derive(Debug)]
+pub struct AtomRef<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a Atom>,
+}
+
+impl<'a> std::ops::Deref for AtomRef<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an atom (`&mut Atom`)
+#[derive(Debug)]
+pub struct AtomMut<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a mut Atom>,
+}
+
+impl<'a> std::ops::Deref for AtomMut<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+impl<'a> std::ops::DerefMut for AtomMut<'a> {
+    fn deref_mut(&mut self) -> &mut Atom {
+        &mut self.inner
+    }
+}
+
+impl Clone for Atom {
+    fn clone(&self) -> Atom {
+        unsafe {
+            let new_handle = chfl_atom_copy(self.as_ptr());
+            Atom::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Atom {
+    /// Create an owned `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_ATOM) -> Atom {
+        check_not_null(ptr);
+        Atom { handle: ptr }
+    }
+
+    /// Create a borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_ATOM) -> AtomRef<'a> {
+        AtomRef {
+            inner: Atom::from_ptr(ptr as *mut CHFL_ATOM),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a mutably borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_ATOM) -> AtomMut<'a> {
+        AtomMut {
+            inner: Atom::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_ATOM {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_ATOM {
+        self.handle
+    }
+
+    /// Create an atom with the given `name`, and set the atom type to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Atom {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_atom(buffer.as_ptr());
+            Atom::from_ptr(handle)
+        }
+    }
+
+    /// Get the atom mass, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.mass(), 4.002602);
+    /// ```
+    pub fn mass(&self) -> f64 {
+        let mut mass = 0.0;
+        unsafe {
+            check_success(chfl_atom_mass(self.as_ptr(), &mut mass));
+        }
+        return mass;
+    }
+
+    /// Set the atom mass to `mass`, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_mass(34.9);
+    /// assert_eq!(atom.mass(), 34.9);
+    /// ```
+    pub fn set_mass(&mut self, mass: f64) {
+        unsafe {
+            check_success(chfl_atom_set_mass(self.as_mut_ptr(), mass));
+        }
+    }
+
+    /// Get the atom charge, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.charge(), 0.0);
+    /// ```
+    pub fn charge(&self) -> f64 {
+        let mut charge = 0.0;
+        unsafe {
+            check_success(chfl_atom_charge(self.as_ptr(), &mut charge));
+        }
+        return charge;
+    }
+
+    /// Set the atom charge to `charge`, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_charge(-2.0);
+    /// assert_eq!(atom.charge(), -2.0);
+    /// ```
+    pub fn set_charge(&mut self, charge: f64) {
+        unsafe {
+            check_success(chfl_atom_set_charge(self.as_mut_ptr(), charge));
+        }
+    }
+
+    /// Get the atom name.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_atom_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_name).expect("getting name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Get the atom type.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.atomic_type(), "He");
+    /// ```
+    pub fn atomic_type(&self) -> String {
+        let get_type = |ptr, len| unsafe { chfl_atom_type(self.as_ptr(), ptr, len) };
+        let buffer = strings::call_autogrow_buffer(10, get_type).expect("getting type failed");
+        return strings::from_c(buffer.as_ptr());
+    }
+
+    /// Set the atom name to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_name("Zn3");
+    /// assert_eq!(atom.name(), "Zn3");
+    /// ```
+    pub fn set_name<'a>(&mut self, name: impl Into<&'a str>) {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            check_success(chfl_atom_set_name(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Set the atom type to `atomic_type`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_atomic_type("F");
+    /// assert_eq!(atom.atomic_type(), "F");
+    /// ```
+    pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>) {
+        let buffer = strings::to_c(atomic_type.into());
+        unsafe {
+            check_success(chfl_atom_set_type(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Try to get the full name of the atom from the atomic type. For example,
+    /// the full name of "He" is "Helium", and so on. If the name can not be
+    /// found, this function returns the empty string.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("Zn");
+    /// assert_eq!(atom.full_name(), "Zinc");
+    /// ```
+    pub fn full_name(&self) -> String {
+        let get_full_name = |ptr, len| unsafe { chfl_atom_full_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_full_name).expect("getting full name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Try to get the Van der Waals radius of the atom from the atomic type.
+    /// If the radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+    /// assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+    /// ```
+    pub fn vdw_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_vdw_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the covalent radius of the atom from the atomic type. If the
+    /// radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+    /// assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+    /// ```
+    pub fn covalent_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(chfl_atom_covalent_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the atomic number of the atom from the atomic type. If the
+    /// number can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").atomic_number(), 2);
+    /// assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+    /// ```
+    pub fn atomic_number(&self) -> u64 {
+        let mut number = 0;
+        unsafe {
+            check_success(chfl_atom_atomic_number(self.as_ptr(), &mut number));
+        }
+        return number;
+    }
+
+    /// Add a new `property` with the given `name` to this atom.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("a bool", true);
+    /// atom.set("a string", "test");
+    ///
+    /// assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+    /// assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_atom_set_property(
+                self.as_mut_ptr(),
+                buffer.as_ptr(),
+                property.as_ptr(),
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this atom, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(atom.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_atom_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                let property = Property::from_raw(raw);
+                Some(property)
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this atom
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    /// atom.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in atom.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_atom_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![std::ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_atom_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property")),
+        }
+    }
+}
+
+impl Drop for Atom {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+
+        let copy = atom.clone();
+        assert_eq!(copy.name(), "He");
+
+        atom.set_name("Na");
+        assert_eq!(atom.name(), "Na");
+        assert_eq!(copy.name(), "He");
+    }
+
+    #[test]
+    fn mass() {
+        let mut atom = Atom::new("He");
+        approx::assert_ulps_eq!(atom.mass(), 4.002602);
+        atom.set_mass(15.0);
+        assert_eq!(atom.mass(), 15.0);
+    }
+
+    #[test]
+    fn charge() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.charge(), 0.0);
+        atom.set_charge(-1.5);
+        assert_eq!(atom.charge(), -1.5);
+    }
+
+    #[test]
+    fn name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+        atom.set_name("Zn-12");
+        assert_eq!(atom.name(), "Zn-12");
+    }
+
+    #[test]
+    fn atomic_type() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.atomic_type(), "He");
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.atomic_type(), "Zn");
+    }
+
+    #[test]
+    fn full_name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.full_name(), "Helium");
+
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.full_name(), "Zinc");
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.full_name(), "");
+    }
+
+    #[test]
+    fn radii() {
+        let atom = Atom::new("He");
+        approx::assert_ulps_eq!(atom.vdw_radius(), 1.4);
+        approx::assert_ulps_eq!(atom.covalent_radius(), 0.32);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.vdw_radius(), 0.0);
+        assert_eq!(atom.covalent_radius(), 0.0);
+    }
+
+    #[test]
+    fn atomic_number() {
+        let atom = Atom::new("He");
+        assert_eq!(atom.atomic_number(), 2);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.atomic_number(), 0);
+    }
+
+    #[test]
+    fn property() {
+        let mut atom = Atom::new("F");
+
+        atom.set("foo", -22.0);
+        assert_eq!(atom.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(atom.get("bar"), None);
+
+        atom.set("bar", Property::String("here".into()));
+        for (name, property) in atom.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/cell.rs.html b/0.10.4/src/chemfiles/cell.rs.html new file mode 100644 index 000000000..4ac0265d2 --- /dev/null +++ b/0.10.4/src/chemfiles/cell.rs.html @@ -0,0 +1,1072 @@ +cell.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::marker::PhantomData;
+
+use chemfiles_sys::*;
+
+use crate::errors::{check, check_not_null, check_success, Error};
+
+/// Available unit cell shapes.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum CellShape {
+    /// Orthorhombic cell, with the three angles equals to 90°.
+    Orthorhombic,
+    /// Triclinic cell, with any values for the angles.
+    Triclinic,
+    /// Infinite cell, to use when there is no cell.
+    Infinite,
+}
+
+impl From<chfl_cellshape> for CellShape {
+    fn from(celltype: chfl_cellshape) -> CellShape {
+        match celltype {
+            chfl_cellshape::CHFL_CELL_ORTHORHOMBIC => CellShape::Orthorhombic,
+            chfl_cellshape::CHFL_CELL_TRICLINIC => CellShape::Triclinic,
+            chfl_cellshape::CHFL_CELL_INFINITE => CellShape::Infinite,
+        }
+    }
+}
+
+impl From<CellShape> for chfl_cellshape {
+    fn from(celltype: CellShape) -> chfl_cellshape {
+        match celltype {
+            CellShape::Orthorhombic => chfl_cellshape::CHFL_CELL_ORTHORHOMBIC,
+            CellShape::Triclinic => chfl_cellshape::CHFL_CELL_TRICLINIC,
+            CellShape::Infinite => chfl_cellshape::CHFL_CELL_INFINITE,
+        }
+    }
+}
+
+/// An `UnitCell` represent the box containing the atoms, and its periodicity.
+///
+/// An unit cell is fully represented by three lengths (a, b, c); and three
+/// angles (alpha, beta, gamma). The angles are stored in degrees, and the
+/// lengths in Angstroms.
+///
+/// A cell also has a matricial representation, by projecting the three base
+/// vector into an orthonormal base. We choose to represent such matrix as an
+/// upper triangular matrix:
+///
+/// ```text
+/// | a_x   b_x   c_x |
+/// |  0    b_y   c_y |
+/// |  0     0    c_z |
+/// ```
+#[derive(Debug)]
+pub struct UnitCell {
+    handle: *mut CHFL_CELL,
+}
+
+/// An analog to a reference to an unit cell (`&UnitCell`)
+#[derive(Debug)]
+pub struct UnitCellRef<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a UnitCell>,
+}
+
+impl<'a> std::ops::Deref for UnitCellRef<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an unit cell (`&mut UnitCell`)
+#[derive(Debug)]
+pub struct UnitCellMut<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a mut UnitCell>,
+}
+
+impl<'a> std::ops::Deref for UnitCellMut<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+impl<'a> std::ops::DerefMut for UnitCellMut<'a> {
+    fn deref_mut(&mut self) -> &mut UnitCell {
+        &mut self.inner
+    }
+}
+
+impl Clone for UnitCell {
+    fn clone(&self) -> UnitCell {
+        unsafe {
+            let new_handle = chfl_cell_copy(self.as_ptr());
+            UnitCell::from_ptr(new_handle)
+        }
+    }
+}
+
+impl UnitCell {
+    /// Create an owned `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_CELL) -> UnitCell {
+        check_not_null(ptr);
+        UnitCell { handle: ptr }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime.
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_CELL) -> UnitCellRef<'a> {
+        UnitCellRef {
+            inner: UnitCell::from_ptr(ptr as *mut CHFL_CELL),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible for
+    /// setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut CHFL_CELL) -> UnitCellMut<'a> {
+        UnitCellMut {
+            inner: UnitCell::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_CELL {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_CELL {
+        self.handle
+    }
+
+    /// Create an `Orthorhombic` `UnitCell` from the three lengths, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn new(lengths: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), std::ptr::null());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `Infinite` `UnitCell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::infinite();
+    ///
+    /// assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn infinite() -> UnitCell {
+        let mut cell = UnitCell::new([0.0, 0.0, 0.0]);
+        cell.set_shape(CellShape::Infinite).expect("could not set cell shape");
+        return cell;
+    }
+
+    /// Create an `Triclinic` `UnitCell` from the three lengths (in Angstroms)
+    /// and three angles (in degree). `alpha` is the angle between the vectors
+    /// `b` and `c`; `beta` is the between the vectors `a` and `c` and `gamma`
+    /// is the angle between the vectors `a` and `b`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// assert_eq!(cell.angles()[0], 98.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell(lengths.as_ptr(), angles.as_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `UnitCell` from a cell matrix. If `matrix` contains only
+    /// zeros, then an `Infinite` cell is created. If only the diagonal of the
+    /// matrix is non-zero, then the cell is `Orthorhombic`. Else a
+    /// `Triclinic` cell is created. The matrix entries should be in Angstroms.
+    ///
+    /// # Panics
+    ///
+    /// If the matrix has a negative determinant, or more generally is not
+    /// representing a unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::from_matrix([
+    ///     [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+    /// ]);
+    ///
+    /// assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn from_matrix(mut matrix: [[f64; 3]; 3]) -> UnitCell {
+        unsafe {
+            let handle = chfl_cell_from_matrix(matrix.as_mut_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Get the three lengths of the cell, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// ```
+    pub fn lengths(&self) -> [f64; 3] {
+        let mut lengths = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_lengths(self.as_ptr(), lengths.as_mut_ptr()));
+        }
+        return lengths;
+    }
+
+    /// Set the three lengths of the cell, in Angstroms.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is infinite, or if one of the
+    /// lengths is negative.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+    /// assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+    ///
+    /// assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+    /// ```
+    pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error> {
+        unsafe { check(chfl_cell_set_lengths(self.as_mut_ptr(), lengths.as_ptr())) }
+    }
+
+    /// Get the three angles of the cell, in degrees.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([20.0, 20.0, 20.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    ///
+    /// let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// ```
+    pub fn angles(&self) -> [f64; 3] {
+        let mut angles = [0.0; 3];
+        unsafe {
+            check_success(chfl_cell_angles(self.as_ptr(), angles.as_mut_ptr()));
+        }
+        return angles;
+    }
+
+    /// Set the three angles of the cell, in degrees.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is not `Triclinic`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    ///
+    /// cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// ```
+    pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error> {
+        unsafe { check(chfl_cell_set_angles(self.as_mut_ptr(), angles.as_ptr())) }
+    }
+
+    /// Get the unit cell matricial representation.
+    ///
+    /// The unit cell representation is obtained by aligning the a vector along
+    /// the *x* axis and putting the b vector in the *xy* plane. This make the
+    /// matrix an upper triangular matrix:
+    ///
+    /// ```text
+    /// | a_x   b_x   c_x |
+    /// |  0    b_y   c_y |
+    /// |  0     0    c_z |
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let matrix = cell.matrix();
+    ///
+    /// assert_eq!(matrix[0][0], 10.0);
+    /// assert_eq!(matrix[1][1], 20.0);
+    /// assert_eq!(matrix[2][2], 30.0);
+    ///
+    /// assert!(matrix[1][2].abs() < 1e-9);
+    /// ```
+    pub fn matrix(&self) -> [[f64; 3]; 3] {
+        let mut matrix = [[0.0; 3]; 3];
+        unsafe {
+            check_success(chfl_cell_matrix(self.as_ptr(), matrix.as_mut_ptr()));
+        }
+        return matrix;
+    }
+
+    /// Get the shape of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn shape(&self) -> CellShape {
+        let mut shape = chfl_cellshape::CHFL_CELL_INFINITE;
+        unsafe {
+            check_success(chfl_cell_shape(self.as_ptr(), &mut shape));
+        }
+        return CellShape::from(shape);
+    }
+
+    /// Set the shape of the unit cell to `shape`.
+    ///
+    /// # Errors
+    ///
+    /// This can fail if the cell length or angles are incompatible with the
+    /// new shape.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    ///
+    /// cell.set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error> {
+        unsafe { check(chfl_cell_set_shape(self.as_mut_ptr(), shape.into())) }
+    }
+
+    /// Get the volume of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+    /// ```
+    pub fn volume(&self) -> f64 {
+        let mut volume = 0.0;
+        unsafe {
+            check_success(chfl_cell_volume(self.as_ptr(), &mut volume));
+        }
+        return volume;
+    }
+
+    /// Wrap a `vector` in this unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let mut vector = [12.0, 5.2, -45.3];
+    /// cell.wrap(&mut vector);
+    /// assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+    /// ```
+    pub fn wrap(&self, vector: &mut [f64; 3]) {
+        unsafe {
+            check_success(chfl_cell_wrap(self.as_ptr(), vector.as_mut_ptr()));
+        }
+    }
+}
+
+impl Drop for UnitCell {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+
+        let copy = cell.clone();
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+    }
+
+    #[test]
+    fn lengths() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+    }
+
+    #[test]
+    fn angles() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        crate::assert_vector3d_eq(&cell.angles(), &[90.0, 90.0, 90.0], 1e-6);
+
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        cell.set_angles([80.0, 89.0, 100.0]).unwrap();
+
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 89.0, 100.0], 1e-6);
+
+        let cell = UnitCell::triclinic([1., 2., 3.], [80., 90., 100.]);
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 90.0, 100.0], 1e-6);
+    }
+
+    #[test]
+    fn volume() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.volume(), 2.0 * 3.0 * 4.0);
+    }
+
+    #[test]
+    fn wrap() {
+        let cell = UnitCell::new([10.0, 20.0, 30.0]);
+        let mut vector = [12.0, 5.2, -45.3];
+        cell.wrap(&mut vector);
+        crate::assert_vector3d_eq(&vector, &[2.0, 5.2, 14.7], 1e-6);
+    }
+
+    #[test]
+    fn matrix() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+
+        let matrix = cell.matrix();
+        let result = [[2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 4.0]];
+
+        for i in 0..3 {
+            for j in 0..3 {
+                approx::assert_ulps_eq!(matrix[i][j], result[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn from_matrix() {
+        let cell = UnitCell::from_matrix([[10.0, 0.0, 0.0], [0.0, 21.0, 0.0], [0.0, 0.0, 32.0]]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        assert_eq!(cell.lengths(), [10.0, 21.0, 32.0]);
+
+        let result_matrix = [[123.0, 4.08386, 71.7295], [0.0, 233.964, 133.571], [0.0, 0.0, 309.901]];
+        let cell = UnitCell::from_matrix(result_matrix);
+
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+        for i in 0..3 {
+            approx::assert_ulps_eq!(cell.lengths()[i], [123.0, 234.0, 345.0][i], epsilon = 1e-3);
+            approx::assert_ulps_eq!(cell.angles()[i], [67.0, 78.0, 89.0][i], epsilon = 1e-3);
+        }
+
+        let matrix = cell.matrix();
+        for i in 0..3 {
+            for j in 0..3 {
+                approx::assert_ulps_eq!(matrix[i][j], result_matrix[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn shape() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+        let cell = UnitCell::infinite();
+        assert_eq!(cell.shape(), CellShape::Infinite);
+
+        let cell = UnitCell::triclinic([1.0, 2.0, 3.0], [80.0, 90.0, 100.0]);
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+
+        let mut cell = UnitCell::new([10.0, 10.0, 10.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/errors.rs.html b/0.10.4/src/chemfiles/errors.rs.html new file mode 100644 index 000000000..63d73f12e --- /dev/null +++ b/0.10.4/src/chemfiles/errors.rs.html @@ -0,0 +1,454 @@ +errors.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::os::raw::c_char;
+use std::panic::{self, RefUnwindSafe};
+use std::path::Path;
+
+use chemfiles_sys::*;
+
+use crate::strings;
+
+#[derive(Clone, Debug, PartialEq, Eq)]
+/// Error type for Chemfiles.
+pub struct Error {
+    /// The error status code
+    pub status: Status,
+    /// A message describing the error cause
+    pub message: String,
+}
+
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Clone, Debug, PartialEq, Eq)]
+/// Possible causes of error in chemfiles
+pub enum Status {
+    /// No error
+    Success = chfl_status::CHFL_SUCCESS as isize,
+    /// Error in memory allocations
+    MemoryError = chfl_status::CHFL_MEMORY_ERROR as isize,
+    /// Error while reading or writing a file
+    FileError = chfl_status::CHFL_FILE_ERROR as isize,
+    /// Error in file formatting, *i.e.* the file is invalid
+    FormatError = chfl_status::CHFL_FORMAT_ERROR as isize,
+    /// Error in selection string syntax
+    SelectionError = chfl_status::CHFL_SELECTION_ERROR as isize,
+    /// Error in configuration files syntax
+    ConfigurationError = chfl_status::CHFL_CONFIGURATION_ERROR as isize,
+    /// Error for out of bounds indexing
+    OutOfBounds = chfl_status::CHFL_OUT_OF_BOUNDS as isize,
+    /// Error related to properties
+    PropertyError = chfl_status::CHFL_PROPERTY_ERROR as isize,
+    /// Exception in the C++ chemfiles library
+    ChemfilesError = chfl_status::CHFL_GENERIC_ERROR as isize,
+    /// Exception in the C++ standard library
+    StdCppError = chfl_status::CHFL_CXX_ERROR as isize,
+    /// The given path is not valid UTF8
+    // TODO: rename this to UTF8Error in the next breaking release
+    UTF8PathError,
+}
+
+impl From<chfl_status> for Error {
+    fn from(status: chfl_status) -> Error {
+        let status = match status {
+            chfl_status::CHFL_SUCCESS => Status::Success,
+            chfl_status::CHFL_CXX_ERROR => Status::StdCppError,
+            chfl_status::CHFL_GENERIC_ERROR => Status::ChemfilesError,
+            chfl_status::CHFL_MEMORY_ERROR => Status::MemoryError,
+            chfl_status::CHFL_FILE_ERROR => Status::FileError,
+            chfl_status::CHFL_FORMAT_ERROR => Status::FormatError,
+            chfl_status::CHFL_SELECTION_ERROR => Status::SelectionError,
+            chfl_status::CHFL_CONFIGURATION_ERROR => Status::ConfigurationError,
+            chfl_status::CHFL_OUT_OF_BOUNDS => Status::OutOfBounds,
+            chfl_status::CHFL_PROPERTY_ERROR => Status::PropertyError,
+        };
+
+        let message = Error::last_error();
+        Error { status, message }
+    }
+}
+
+impl From<std::str::Utf8Error> for Error {
+    fn from(_: std::str::Utf8Error) -> Self {
+        Error {
+            status: Status::UTF8PathError,
+            message: "failed to convert data to UTF8 string".into(),
+        }
+    }
+}
+
+impl Error {
+    /// Create a new error because the given `path` is invalid UTF-8 data
+    pub(crate) fn utf8_path_error(path: &Path) -> Error {
+        Error {
+            status: Status::UTF8PathError,
+            message: format!("Could not convert '{}' to UTF8", path.display()),
+        }
+    }
+
+    /// Get the last error message from the C++ library.
+    pub fn last_error() -> String {
+        unsafe { strings::from_c(chfl_last_error()) }
+    }
+
+    /// Clear any error from the C++ library
+    pub fn cleanup() {
+        unsafe {
+            check(chfl_clear_errors()).expect("error in chfl_clear_errors. Things went very bad");
+        }
+    }
+}
+
+/// Check return value of a C function, and get the error if needed.
+pub(crate) fn check(status: chfl_status) -> Result<(), Error> {
+    if status == chfl_status::CHFL_SUCCESS {
+        Ok(())
+    } else {
+        Err(Error::from(status))
+    }
+}
+
+/// Check return value of a C function, panic if it failed.
+pub(crate) fn check_success(status: chfl_status) {
+    assert!(
+        status == chfl_status::CHFL_SUCCESS,
+        "unexpected failure: {}",
+        Error::last_error()
+    );
+}
+
+/// Check a pointer for null.
+pub(crate) fn check_not_null<T>(ptr: *const T) {
+    assert!(!ptr.is_null(), "unexpected null pointer: {}", Error::last_error());
+}
+
+pub trait WarningCallback: RefUnwindSafe + Fn(&str) {}
+impl<T> WarningCallback for T where T: RefUnwindSafe + Fn(&str) {}
+
+static mut LOGGING_CALLBACK: Option<*mut dyn WarningCallback<Output = ()>> = None;
+
+extern "C" fn warning_callback(message: *const c_char) {
+    unsafe {
+        let callback = &*LOGGING_CALLBACK.expect("No callback provided, this is an internal bug");
+        // ignore result. If a panic happened, everything is going badly anyway
+        let _result = panic::catch_unwind(|| {
+            callback(&strings::from_c(message));
+        });
+    }
+}
+
+/// Use `callback` for every chemfiles warning. The callback will be passed
+/// the warning message. This will drop any previous warning callback.
+pub fn set_warning_callback<F>(callback: F)
+where
+    F: WarningCallback + 'static,
+{
+    // box callback to ensure it stays accessible
+    let callback = Box::into_raw(Box::new(callback));
+    unsafe {
+        if let Some(previous) = LOGGING_CALLBACK {
+            // drop the previous callback
+            let previous = Box::from_raw(previous);
+            std::mem::drop(previous);
+            // set the LOGGING_CALLBACK to the new one
+            LOGGING_CALLBACK = Some(callback);
+        } else {
+            // set the LOGGING_CALLBACK
+            LOGGING_CALLBACK = Some(callback);
+            // Tell C code to use Rust-provided callback
+            check_success(chfl_set_warning_callback(warning_callback));
+        }
+    }
+}
+
+impl std::fmt::Display for Error {
+    fn fmt(&self, fmt: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
+        write!(fmt, "{}", self.message)
+    }
+}
+
+impl std::error::Error for Error {
+    fn description(&self) -> &str {
+        match self.status {
+            Status::Success => "Success",
+            Status::StdCppError => "Exception from the C++ standard library",
+            Status::ChemfilesError => "Exception from the chemfiles library",
+            Status::MemoryError => "Error in memory allocations",
+            Status::FileError => "Error while reading or writing a file",
+            Status::FormatError => "Error in file formatting, i.e. the file is invalid",
+            Status::SelectionError => "Error in selection string syntax",
+            Status::UTF8PathError => "A string is not valid UTF8",
+            Status::ConfigurationError => "Error in configuration files",
+            Status::OutOfBounds => "Out of bounds indexing",
+            Status::PropertyError => "Error in property",
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use crate::Trajectory;
+
+    #[test]
+    fn errors() {
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+        assert!(Trajectory::open("nope", 'r').is_err());
+        assert_eq!(
+            Error::last_error(),
+            "file at \'nope\' does not have an extension, provide a format name to read it"
+        );
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+    }
+
+    #[test]
+    fn codes() {
+        assert_eq!(Error::from(chfl_status::CHFL_SUCCESS).status, Status::Success);
+        assert_eq!(Error::from(chfl_status::CHFL_CXX_ERROR).status, Status::StdCppError);
+        assert_eq!(
+            Error::from(chfl_status::CHFL_GENERIC_ERROR).status,
+            Status::ChemfilesError
+        );
+        assert_eq!(Error::from(chfl_status::CHFL_MEMORY_ERROR).status, Status::MemoryError);
+        assert_eq!(Error::from(chfl_status::CHFL_FILE_ERROR).status, Status::FileError);
+        assert_eq!(Error::from(chfl_status::CHFL_FORMAT_ERROR).status, Status::FormatError);
+        assert_eq!(
+            Error::from(chfl_status::CHFL_SELECTION_ERROR).status,
+            Status::SelectionError
+        );
+        assert_eq!(Error::from(chfl_status::CHFL_OUT_OF_BOUNDS).status, Status::OutOfBounds);
+        assert_eq!(
+            Error::from(chfl_status::CHFL_PROPERTY_ERROR).status,
+            Status::PropertyError
+        );
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/frame.rs.html b/0.10.4/src/chemfiles/frame.rs.html new file mode 100644 index 000000000..626497764 --- /dev/null +++ b/0.10.4/src/chemfiles/frame.rs.html @@ -0,0 +1,2370 @@ +frame.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use chemfiles_sys::*;
+
+use crate::{Atom, AtomMut, AtomRef};
+use crate::{BondOrder, Residue, Topology, TopologyRef};
+use crate::{UnitCell, UnitCellMut, UnitCellRef};
+
+use crate::errors::{check, check_not_null, check_success, Error};
+use crate::property::{PropertiesIter, Property, RawProperty};
+use crate::strings;
+
+/// A `Frame` contains data from one simulation step: the current unit
+/// cell, the topology, the positions, and the velocities of the particles in
+/// the system. If some information is missing (topology or velocity or unit
+/// cell), the corresponding data is filled with a default value.
+#[derive(Debug)]
+pub struct Frame {
+    handle: *mut CHFL_FRAME,
+}
+
+impl Clone for Frame {
+    fn clone(&self) -> Frame {
+        unsafe {
+            let new_handle = chfl_frame_copy(self.as_ptr());
+            Frame::from_ptr(new_handle)
+        }
+    }
+}
+
+#[derive(Debug)]
+pub struct AtomIter<'a> {
+    frame: &'a Frame,
+    index: usize,
+    size: usize,
+}
+
+impl Frame {
+    /// Create a `Frame` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_FRAME) -> Frame {
+        check_not_null(ptr);
+        Frame { handle: ptr }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_FRAME {
+        self.handle
+    }
+
+    /// Create an empty frame. It will be resized by the library as needed.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    ///
+    /// assert_eq!(frame.size(), 0);
+    /// ```
+    pub fn new() -> Frame {
+        unsafe { Frame::from_ptr(chfl_frame()) }
+    }
+
+    /// Get a reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// let atom = frame.atom(0);
+    /// assert_eq!(atom.name(), "Zn");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64);
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// assert_eq!(frame.atom(0).name(), "Zn");
+    ///
+    /// frame.atom_mut(0).set_name("Fe");
+    /// assert_eq!(frame.atom(0).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_frame(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.size(), 0);
+    ///
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_frame_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize the positions and the velocities in this frame, to make space for
+    /// `natoms` atoms. Previous data is conserved, as well as the presence of
+    /// absence of velocities.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_frame_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` and the corresponding position and optionally velocity
+    /// data to this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+    ///
+    /// frame.add_velocities();
+    /// frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom, position: [f64; 3], velocity: impl Into<Option<[f64; 3]>>) {
+        let velocity = velocity.into();
+        let velocity_ptr = match velocity {
+            Some(ref data) => data.as_ptr(),
+            None => std::ptr::null(),
+        };
+
+        unsafe {
+            check_success(chfl_frame_add_atom(
+                self.as_mut_ptr(),
+                atom.as_ptr(),
+                position.as_ptr(),
+                velocity_ptr,
+            ));
+        }
+    }
+
+    /// Remove the atom at index `i` in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+    /// assert_eq!(frame.size(), 3);
+    ///
+    /// frame.remove(1);
+    /// assert_eq!(frame.size(), 2);
+    /// assert_eq!(frame.atom(1).name(), "Sn");
+    /// ```
+    pub fn remove(&mut self, i: usize) {
+        unsafe {
+            check_success(chfl_frame_remove(self.as_mut_ptr(), i as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    /// assert_eq!(frame.topology().bonds_count(), 3);
+    ///
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+    /// assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(2);
+    ///
+    /// frame.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_frame_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// the frame.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    ///
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+    ///
+    /// frame.remove_bond(2, 4);
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_frame_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a copy of `residue` to this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue id is already in this frame's
+    /// topology, or if the residue contain atoms that are already in another
+    /// residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Residue};
+    /// let mut frame = Frame::new();
+    ///
+    /// let residue = Residue::new("foo");
+    /// frame.add_residue(&residue).unwrap();
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.residues_count(), 1);
+    /// assert_eq!(topology.residue(0).unwrap().name(), "foo");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe { check(chfl_frame_add_residue(self.as_mut_ptr(), residue.as_ptr())) }
+    }
+
+    /// Get the distance between the atoms at indexes `i` and `j` in this frame,
+    /// accounting for periodic boundary conditions. The result is expressed in
+    /// Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+    ///
+    /// assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+    /// ```
+    pub fn distance(&self, i: usize, j: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_distance(self.as_ptr(), i as u64, j as u64, &mut distance));
+        }
+        return distance;
+    }
+
+    /// Get the angle formed by the atoms at indexes `i`, `j` and `k` in this
+    /// frame, accounting for periodic boundary conditions. The result is
+    /// expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+    /// ```
+    pub fn angle(&self, i: usize, j: usize, k: usize) -> f64 {
+        let mut angle = 0.0;
+        unsafe {
+            check_success(chfl_frame_angle(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                &mut angle,
+            ));
+        }
+        return angle;
+    }
+
+    /// Get the dihedral angle formed by the atoms at indexes `i`, `j`, `k` and
+    /// `m` in this frame, accounting for periodic boundary conditions. The
+    /// result is expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+    ///
+    /// assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+    /// ```
+    pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut dihedral = 0.0;
+        unsafe {
+            check_success(chfl_frame_dihedral(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut dihedral,
+            ));
+        }
+        return dihedral;
+    }
+
+    /// Get the out of plane distance formed by the atoms at indexes `i`, `j`,
+    /// `k` and `m` in this frame, accounting for periodic boundary conditions.
+    /// The result is expressed in angstroms.
+    ///
+    /// This is the distance between the atom j and the ikm plane. The j atom
+    /// is the center of the improper dihedral angle formed by i, j, k and m.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+    /// frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+    /// ```
+    pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(chfl_frame_out_of_plane(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get a view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions.len(), 67);
+    /// assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn positions(&self) -> &[[f64; 3]] {
+        let mut ptr = std::ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms,
+            ));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return std::slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// {
+    ///     let positions = frame.positions_mut();
+    ///     assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    ///     positions[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn positions_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = std::ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_positions(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return std::slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Get a view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    ///
+    /// let velocities = frame.velocities().expect("missing velocities");
+    /// assert_eq!(velocities.len(), 67);
+    /// assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn velocities(&self) -> Option<&[[f64; 3]]> {
+        if !self.has_velocities() {
+            return None;
+        }
+
+        let mut ptr = std::ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return Some(std::slice::from_raw_parts(ptr, size));
+        }
+    }
+
+    /// Get a mutable view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    /// {
+    ///     let velocities = frame.velocities_mut().expect("missing velocities");
+    ///     assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    ///     velocities[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let velocities = frame.velocities().expect("missing velocities");
+    /// assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn velocities_mut(&mut self) -> Option<&mut [[f64; 3]]> {
+        if !self.has_velocities() {
+            return None;
+        }
+
+        let mut ptr = std::ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(chfl_frame_velocities(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return Some(std::slice::from_raw_parts_mut(ptr, size));
+        }
+    }
+
+    /// Check if this frame contains velocity data.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn has_velocities(&self) -> bool {
+        let mut res = 0;
+        unsafe {
+            check_success(chfl_frame_has_velocities(self.as_ptr(), &mut res));
+        }
+        return res != 0;
+    }
+
+    /// Add velocity data to this frame. If the frame already have velocities,
+    /// this does nothing.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn add_velocities(&mut self) {
+        unsafe {
+            check_success(chfl_frame_add_velocities(self.as_mut_ptr()));
+        }
+    }
+
+    /// Get a reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let frame = Frame::new();
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn cell(&self) -> UnitCellRef {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW());
+            UnitCell::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// assert_eq!(frame.cell().shape(), CellShape::Infinite);
+    ///
+    /// frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+    /// ```
+    pub fn cell_mut(&mut self) -> UnitCellMut {
+        unsafe {
+            let handle = chfl_cell_from_frame(self.as_mut_ptr());
+            UnitCell::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Set the `UnitCell` of this frame to `cell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, UnitCell, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_frame_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get a reference to the `Topology` of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(42);
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.size(), 42);
+    /// ```
+    pub fn topology(&self) -> TopologyRef {
+        unsafe {
+            let handle = chfl_topology_from_frame(self.as_ptr());
+            Topology::ref_from_ptr(handle)
+        }
+    }
+
+    /// Set the `Topology` of this frame to `topology`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology contains a different number of atoms
+    /// than this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Topology, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.resize(2);
+    ///
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_bond(0, 1);
+    ///
+    /// frame.set_topology(&topology).unwrap();
+    /// assert_eq!(frame.atom(0).name(), "Cl");
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error> {
+        unsafe { check(chfl_frame_set_topology(self.as_mut_ptr(), topology.as_ptr())) }
+    }
+
+    /// Get this frame step, i.e. the frame number in the trajectory
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    /// ```
+    pub fn step(&self) -> usize {
+        let mut step = 0;
+        unsafe {
+            check_success(chfl_frame_step(self.as_ptr(), &mut step));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return step as usize;
+    }
+
+    /// Set this frame step to `step`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    ///
+    /// frame.set_step(10);
+    /// assert_eq!(frame.step(), 10);
+    /// ```
+    pub fn set_step(&mut self, step: usize) {
+        unsafe {
+            check_success(chfl_frame_set_step(self.as_mut_ptr(), step as u64));
+        }
+    }
+
+    /// Guess the bonds, angles and dihedrals in this `frame`.
+    ///
+    /// The bonds are guessed using a distance-based algorithm, and then angles
+    /// and dihedrals are guessed from the bonds.
+    ///
+    /// # Errors
+    ////
+    /// This function can fail if the covalent radius is unknown for some atoms
+    /// in the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    ///
+    /// frame.guess_bonds().unwrap();
+    /// assert_eq!(frame.topology().bonds_count(), 1);
+    /// ```
+    pub fn guess_bonds(&mut self) -> Result<(), Error> {
+        unsafe { check(chfl_frame_guess_bonds(self.as_mut_ptr())) }
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology of the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, Frame};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(1, 2);
+    ///
+    /// assert_eq!(frame.topology().bonds().len(), 2);
+    /// assert_eq!(frame.topology().angles().len(), 1);
+    ///
+    /// frame.clear_bonds();
+    /// assert!(frame.topology().bonds().is_empty());
+    /// assert!(frame.topology().angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_frame_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a new `property` with the given `name` to this frame.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("a string", "hello");
+    /// frame.set("a double", 4.3);
+    ///
+    /// assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_frame_set_property(
+                self.as_mut_ptr(),
+                buffer.as_ptr(),
+                property.as_ptr(),
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(frame.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_frame_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    /// frame.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in frame.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_frame_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![std::ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_frame_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property")),
+        }
+    }
+
+    /// Gets an iterator over atoms
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, AtomRef, Frame};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    ///
+    /// let mut atoms: Vec<AtomRef> = Vec::new();
+    ///
+    /// for atom in frame.iter_atoms() {
+    ///     atoms.push(atom);
+    /// }
+    ///
+    /// assert_eq!(atoms.len(), 2);
+    /// ```
+    pub fn iter_atoms(&self) -> AtomIter<'_> {
+        AtomIter {
+            frame: self,
+            index: 0,
+            size: self.size(),
+        }
+    }
+}
+
+impl Drop for Frame {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl<'a> Iterator for AtomIter<'a> {
+    type Item = AtomRef<'a>;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.size <= self.index {
+            return None;
+        }
+        let atom = self.frame.atom(self.index);
+        self.index += 1;
+        Some(atom)
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+        let copy = frame.clone();
+        assert_eq!(copy.size(), 0);
+
+        frame.resize(42);
+        assert_eq!(frame.size(), 42);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+
+        frame.resize(12);
+        assert_eq!(frame.size(), 12);
+    }
+
+    #[test]
+    fn add_atom() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        let positions = &[[1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        frame.add_velocities();
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], [4.0, 3.0, 2.0]);
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+        assert_eq!(frame.atom(1).name(), "F");
+
+        let positions = &[[1.0, 1.0, 2.0], [1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        let velocities = &[[0.0, 0.0, 0.0], [4.0, 3.0, 2.0]];
+        assert_eq!(frame.velocities().unwrap(), velocities);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_atom() {
+        let mut frame = Frame::new();
+        frame.resize(22);
+        let _atom = frame.atom(23);
+    }
+
+    #[test]
+    fn remove_atom() {
+        let mut frame = Frame::new();
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], None);
+
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        frame.remove(0);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "F");
+    }
+
+    #[test]
+    #[should_panic]
+    fn remove_out_of_bounds() {
+        let mut frame = Frame::new();
+        frame.resize(32);
+
+        frame.remove(100);
+    }
+
+    #[test]
+    fn positions() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        let expected = &[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0], [10.0, 11.0, 12.0]];
+
+        frame.positions_mut().clone_from_slice(expected);
+        assert_eq!(frame.positions(), expected);
+    }
+
+    #[test]
+    fn velocities() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        assert!(!frame.has_velocities());
+        frame.add_velocities();
+        assert!(frame.has_velocities());
+
+        let expected = &[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0], [10.0, 11.0, 12.0]];
+
+        frame.velocities_mut().unwrap().clone_from_slice(expected);
+        assert_eq!(frame.velocities().unwrap(), expected);
+    }
+
+    #[test]
+    fn cell() {
+        let mut frame = Frame::new();
+        frame.set_cell(&UnitCell::new([3.0, 4.0, 5.0]));
+        let cell = frame.cell();
+        assert_eq!(cell.lengths(), [3.0, 4.0, 5.0]);
+    }
+
+    #[test]
+    fn topology() {
+        let mut frame = Frame::new();
+        frame.resize(2);
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Zn"));
+        topology.add_atom(&Atom::new("Ar"));
+
+        assert!(frame.set_topology(&topology).is_ok());
+
+        let topology = frame.topology();
+
+        assert_eq!(topology.atom(0).name(), "Zn");
+        assert_eq!(topology.atom(1).name(), "Ar");
+
+        assert_eq!(frame.atom(0).name(), "Zn");
+        assert_eq!(frame.atom(1).name(), "Ar");
+    }
+
+    #[test]
+    fn bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        assert_eq!(frame.topology().bonds_count(), 0);
+
+        frame.add_bond(0, 1);
+        frame.add_bond(9, 2);
+        frame.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(frame.topology().bonds_count(), 3);
+
+        assert_eq!(frame.topology().bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(frame.topology().bond_orders(), expected);
+
+        assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(frame.topology().bond_order(3, 7), BondOrder::Aromatic);
+
+        frame.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        frame.remove_bond(8, 7);
+        assert_eq!(frame.topology().bonds_count(), 2);
+
+        frame.clear_bonds();
+        assert_eq!(frame.topology().bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn residues() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.topology().residues_count(), 0);
+
+        let residue = &Residue::new("foobar");
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+
+        assert_eq!(frame.topology().residues_count(), 3);
+        assert_eq!(frame.topology().residue(0).unwrap().name(), "foobar");
+    }
+
+    #[test]
+    fn step() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.step(), 0);
+        frame.set_step(42);
+        assert_eq!(frame.step(), 42);
+    }
+
+    #[test]
+    fn property() {
+        let mut frame = Frame::new();
+        frame.set("foo", -22.0);
+        assert_eq!(frame.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(frame.get("bar"), None);
+
+        frame.set("bar", Property::String("here".into()));
+        for (name, property) in frame.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+
+    #[test]
+    fn pbc_geometry() {
+        use std::f64::consts::PI;
+
+        let mut frame = Frame::new();
+        let atom = &Atom::new("");
+
+        frame.add_atom(atom, [1.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 1.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 2.0], None);
+
+        assert_eq!(frame.distance(0, 2), f64::sqrt(2.0));
+        assert_eq!(frame.angle(0, 1, 2), PI / 2.0);
+        assert_eq!(frame.dihedral(0, 1, 2, 3), PI / 2.0);
+        assert_eq!(frame.out_of_plane(1, 4, 0, 2), 2.0);
+    }
+
+    #[test]
+    fn atom_iterator() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("H1"), [1.0, 0.0, 0.0], None);
+        frame.add_atom(&Atom::new("H2"), [0.0, 1.0, 0.0], None);
+        frame.add_atom(&Atom::new("H3"), [0.0, 0.0, 1.0], None);
+        frame.add_atom(&Atom::new("H4"), [1.0, 1.0, 1.0], None);
+
+        let mut items: Vec<(AtomRef, &[f64; 3])> = Vec::new();
+
+        for item in frame.iter_atoms().zip(frame.positions()) {
+            items.push(item);
+        }
+
+        assert_eq!(items[0].0.name(), "H1");
+        assert_eq!(items[2].0.name(), "H3");
+
+        assert_eq!(items[1].1, &[0.0_f64, 1.0_f64, 0.0_f64]);
+        assert_eq!(items[3].1, &[1.0_f64, 1.0_f64, 1.0_f64]);
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/lib.rs.html b/0.10.4/src/chemfiles/lib.rs.html new file mode 100644 index 000000000..8807fa716 --- /dev/null +++ b/0.10.4/src/chemfiles/lib.rs.html @@ -0,0 +1,268 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! Chemfiles is a multi-language library written in modern C++ for reading and
+//! writing from and to molecular trajectory files. These files are created by
+//! your favorite theoretical chemistry program, and contains information about
+//! atomic or residues names and positions. Some format also have additional
+//! information, such as velocities, forces, energy, …
+//!
+//! This crate expose the C API of chemfiles to Rust, and make all the
+//! functionalities accessible. For more information on the C++ library,
+//! please see its [documentation][cxx_doc]. Specifically, the following pages
+//! are worth reading:
+//!
+//! - The [overview][overview] of the classes organization;
+//! - The list of [supported formats][formats];
+//! - The documentation for the [selection language][selections];
+//!
+//! [cxx_doc]: https://chemfiles.org/chemfiles
+//! [overview]: https://chemfiles.org/chemfiles/latest/overview.html
+//! [formats]: https://chemfiles.org/chemfiles/latest/formats.html
+//! [selections]: https://chemfiles.org/chemfiles/latest/selections.html
+
+#![deny(missing_docs)]
+#![warn(trivial_casts, unused_import_braces, variant_size_differences)]
+#![warn(unused_results)]
+// Configuration for clippy lints
+#![warn(clippy::all, clippy::pedantic)]
+#![allow(clippy::needless_return, clippy::module_name_repetitions)]
+#![allow(clippy::must_use_candidate, clippy::wildcard_imports)]
+#![allow(clippy::let_underscore_untyped, clippy::bool_to_int_with_if)]
+// Allow a few more clippy lints in test mode
+#![cfg_attr(test, allow(clippy::float_cmp, clippy::unreadable_literal, clippy::shadow_unrelated))]
+// deny(warnings) in doc tests
+#![doc(test(attr(deny(warnings))))]
+#![doc(test(attr(allow(unused_variables))))]
+
+use chemfiles_sys::{chfl_add_configuration, chfl_version};
+
+mod strings;
+
+mod errors;
+pub use self::errors::set_warning_callback;
+pub use self::errors::{Error, Status};
+
+mod atom;
+pub use self::atom::Atom;
+pub use self::atom::AtomMut;
+pub use self::atom::AtomRef;
+
+mod cell;
+pub use self::cell::CellShape;
+pub use self::cell::UnitCell;
+pub use self::cell::UnitCellMut;
+pub use self::cell::UnitCellRef;
+
+mod residue;
+pub use self::residue::Residue;
+pub use self::residue::ResidueRef;
+
+mod topology;
+pub use self::topology::BondOrder;
+pub use self::topology::Topology;
+pub use self::topology::TopologyRef;
+
+mod frame;
+pub use self::frame::Frame;
+
+mod trajectory;
+pub use self::trajectory::MemoryTrajectoryReader;
+pub use self::trajectory::Trajectory;
+
+mod selection;
+pub use self::selection::{Match, Selection};
+
+mod property;
+pub use self::property::PropertiesIter;
+pub use self::property::Property;
+
+mod misc;
+pub use self::misc::{formats_list, guess_format, FormatMetadata};
+
+/// Get the version of the chemfiles library.
+///
+/// # Example
+/// ```
+/// let version = chemfiles::version();
+/// assert!(version.starts_with("0.10"));
+/// ```
+pub fn version() -> String {
+    unsafe { strings::from_c(chfl_version()) }
+}
+
+/// Read configuration data from the file at `path`.
+///
+/// By default, chemfiles reads configuration from any file named
+/// `.chemfiles.toml` in the current directory or any parent directory. This
+/// function can be used to add data from another configuration file. Data from
+/// the new configuration file will overwrite any existing data.
+///
+/// # Errors
+///
+/// This function will fail if there is no file at `path`, or if the file is
+/// incorrectly formatted.
+///
+/// # Example
+/// ```no_run
+/// chemfiles::add_configuration("local-config.toml").unwrap();
+/// // from now on, the data from "local-config.toml" will be used
+/// ```
+pub fn add_configuration<S>(path: S) -> Result<(), Error>
+where
+    S: AsRef<str>,
+{
+    let buffer = strings::to_c(path.as_ref());
+    unsafe { errors::check(chfl_add_configuration(buffer.as_ptr())) }
+}
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    fn version() {
+        assert!(!crate::version().is_empty());
+        assert!(crate::version().starts_with("0.10"));
+    }
+}
+
+#[cfg(test)]
+fn assert_vector3d_eq(lhs: &[f64; 3], rhs: &[f64; 3], eps: f64) {
+    lhs.iter()
+        .zip(rhs)
+        .for_each(|(l, r)| approx::assert_ulps_eq!(l, r, epsilon = eps));
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/misc.rs.html b/0.10.4/src/chemfiles/misc.rs.html new file mode 100644 index 000000000..0e7171678 --- /dev/null +++ b/0.10.4/src/chemfiles/misc.rs.html @@ -0,0 +1,300 @@ +misc.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2020 Guillaume Fraux -- BSD licensed
+use std::convert::TryInto;
+use std::ffi::CStr;
+use std::path::Path;
+
+use chemfiles_sys::{chfl_format_metadata, chfl_formats_list, chfl_free, chfl_guess_format};
+
+use crate::errors::check_success;
+
+use crate::{errors::check, Error};
+
+/// `FormatMetadata` contains metadata associated with one format.
+#[allow(clippy::struct_excessive_bools)]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct FormatMetadata {
+    /// Name of the format.
+    pub name: &'static str,
+    /// Extension associated with the format.
+    pub extension: Option<&'static str>,
+    /// Extended, user-facing description of the format.
+    pub description: &'static str,
+    /// URL pointing to the format definition/reference.
+    pub reference: &'static str,
+    /// Is reading files in this format implemented?
+    pub read: bool,
+    /// Is writing files in this format implemented?
+    pub write: bool,
+    /// Does this format support in-memory IO?
+    pub memory: bool,
+    /// Does this format support storing atomic positions?
+    pub positions: bool,
+    /// Does this format support storing atomic velocities?
+    pub velocities: bool,
+    /// Does this format support storing unit cell information?
+    pub unit_cell: bool,
+    /// Does this format support storing atom names or types?
+    pub atoms: bool,
+    /// Does this format support storing bonds between atoms?
+    pub bonds: bool,
+    /// Does this format support storing residues?
+    pub residues: bool,
+}
+
+impl FormatMetadata {
+    pub(crate) fn from_raw(raw: &chfl_format_metadata) -> Self {
+        let str_from_ptr = |ptr| unsafe { CStr::from_ptr(ptr).to_str().expect("Invalid Rust str from C") };
+        let extension = if raw.extension.is_null() {
+            None
+        } else {
+            Some(str_from_ptr(raw.extension))
+        };
+        Self {
+            name: str_from_ptr(raw.name),
+            extension,
+            description: str_from_ptr(raw.description),
+            reference: str_from_ptr(raw.reference),
+            read: raw.read,
+            write: raw.write,
+            memory: raw.memory,
+            positions: raw.positions,
+            velocities: raw.velocities,
+            unit_cell: raw.unit_cell,
+            atoms: raw.atoms,
+            bonds: raw.bonds,
+            residues: raw.residues,
+        }
+    }
+}
+
+/// Get the list of formats known by chemfiles, as well as all associated metadata.
+///
+/// # Example
+/// ```
+/// let formats = chemfiles::formats_list();
+/// println!("chemfiles supports {} formats:", formats.len());
+/// for format in &formats {
+///     println!(
+///         "   {:<15} {}",
+///         format.name,
+///         format.extension.as_deref().unwrap_or("")
+///     );
+/// }
+/// ```
+#[must_use]
+pub fn formats_list() -> Vec<FormatMetadata> {
+    let mut formats = std::ptr::null_mut();
+    let mut count: u64 = 0;
+    let formats_slice = unsafe {
+        check_success(chfl_formats_list(&mut formats, &mut count));
+        std::slice::from_raw_parts(formats, count.try_into().expect("failed to convert u64 to usize"))
+    };
+    let formats_vec = formats_slice.iter().map(FormatMetadata::from_raw).collect();
+    unsafe {
+        let _ = chfl_free(formats as *const _);
+    }
+    return formats_vec;
+}
+
+#[allow(clippy::doc_markdown)]
+/// Get the format that chemfiles would use to read a file at the given
+/// ``path``.
+///
+/// The format is mostly guessed from the path extension, chemfiles only tries
+/// to read the file to distinguish between CIF and mmCIF files. Opening the
+/// file using the returned format string might still fail. For example, it will
+/// fail if the file is not actually formatted according to the guessed format;
+/// or the format/compression combination is not supported (e.g. `XTC / GZ` will
+/// not work since the XTC reader does not support compressed files).
+///
+/// The returned format is represented in a way compatible with the various
+/// `Trajectory` constructors, i.e. `"<format name> [/ <compression>]"`, where
+/// compression is optional.
+///
+/// # Errors
+///
+/// This function returns an error if the file format couldn't be guessed.
+///
+/// # Panics
+///
+/// This function panics if the path can't be converted to a Unicode string.
+///
+/// # Examples
+/// ```
+/// let format = chemfiles::guess_format("trajectory.xyz.xz").unwrap();
+/// assert_eq!(format, "XYZ / XZ");
+///
+/// let format = chemfiles::guess_format("trajectory.nc").unwrap();
+/// assert_eq!(format, "Amber NetCDF");
+///
+/// let format = chemfiles::guess_format("trajectory.unknown.format");
+/// assert!(format.is_err());
+/// ```
+pub fn guess_format<P>(path: P) -> Result<String, Error>
+where
+    P: AsRef<Path>,
+{
+    let path = path.as_ref().to_str().expect("couldn't convert path to Unicode");
+    let path = crate::strings::to_c(path);
+    let mut buffer = vec![0; 128];
+    unsafe {
+        check(chfl_guess_format(
+            path.as_ptr(),
+            buffer.as_mut_ptr(),
+            buffer.len() as u64,
+        ))?;
+    }
+    Ok(crate::strings::from_c(buffer.as_ptr()))
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/property.rs.html b/0.10.4/src/chemfiles/property.rs.html new file mode 100644 index 000000000..3c0865f3f --- /dev/null +++ b/0.10.4/src/chemfiles/property.rs.html @@ -0,0 +1,564 @@ +property.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use chemfiles_sys::*;
+
+use crate::errors::{check, check_not_null, check_success, Error};
+use crate::strings;
+
+/// A thin wrapper around `CHFL_PROPERTY`
+#[derive(Debug)]
+pub(crate) struct RawProperty {
+    handle: *mut CHFL_PROPERTY,
+}
+
+impl RawProperty {
+    /// Create a `RawProperty` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    pub unsafe fn from_ptr(ptr: *mut CHFL_PROPERTY) -> RawProperty {
+        check_not_null(ptr);
+        RawProperty { handle: ptr }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    pub fn as_ptr(&self) -> *const CHFL_PROPERTY {
+        self.handle
+    }
+
+    fn double(value: f64) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_double(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn bool(value: bool) -> RawProperty {
+        let value = if value { 1 } else { 0 };
+        unsafe {
+            let handle = chfl_property_bool(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn vector3d(value: [f64; 3]) -> RawProperty {
+        unsafe {
+            let handle = chfl_property_vector3d(value.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn string(value: &str) -> RawProperty {
+        let buffer = strings::to_c(value);
+        unsafe {
+            let handle = chfl_property_string(buffer.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn get_kind(&self) -> chfl_property_kind {
+        let mut kind = chfl_property_kind::CHFL_PROPERTY_BOOL;
+        unsafe {
+            check_success(chfl_property_get_kind(self.as_ptr(), &mut kind));
+        }
+        return kind;
+    }
+
+    fn get_bool(&self) -> Result<bool, Error> {
+        let mut value = 0;
+        unsafe {
+            check(chfl_property_get_bool(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value != 0);
+    }
+
+    fn get_double(&self) -> Result<f64, Error> {
+        let mut value = 0.0;
+        unsafe {
+            check(chfl_property_get_double(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value);
+    }
+
+    fn get_string(&self) -> Result<String, Error> {
+        let get_string = |ptr, len| unsafe { chfl_property_get_string(self.as_ptr(), ptr, len) };
+        let value = strings::call_autogrow_buffer(64, get_string)?;
+        return Ok(strings::from_c(value.as_ptr()));
+    }
+
+    fn get_vector3d(&self) -> Result<[f64; 3], Error> {
+        let mut value = [0.0; 3];
+        unsafe {
+            check(chfl_property_get_vector3d(self.as_ptr(), value.as_mut_ptr()))?;
+        }
+        return Ok(value);
+    }
+}
+
+impl Drop for RawProperty {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+/// A `Property` is a piece of data that can be associated with an `Atom` or a
+/// `Frame`.
+#[derive(Debug, Clone, PartialEq, PartialOrd)]
+pub enum Property {
+    /// Boolean property
+    Bool(bool),
+    /// Floating point property
+    Double(f64),
+    /// String property
+    String(String),
+    /// 3-dimensional vector property
+    Vector3D([f64; 3]),
+}
+
+impl From<bool> for Property {
+    fn from(value: bool) -> Self {
+        Property::Bool(value)
+    }
+}
+
+impl From<f64> for Property {
+    fn from(value: f64) -> Self {
+        Property::Double(value)
+    }
+}
+
+impl From<String> for Property {
+    fn from(value: String) -> Self {
+        Property::String(value)
+    }
+}
+
+impl<'a> From<&'a str> for Property {
+    fn from(value: &'a str) -> Self {
+        Property::String(value.into())
+    }
+}
+
+impl From<[f64; 3]> for Property {
+    fn from(value: [f64; 3]) -> Self {
+        Property::Vector3D(value)
+    }
+}
+
+impl Property {
+    pub(crate) fn as_raw(&self) -> RawProperty {
+        match *self {
+            Property::Bool(value) => RawProperty::bool(value),
+            Property::Double(value) => RawProperty::double(value),
+            Property::String(ref value) => RawProperty::string(value),
+            Property::Vector3D(value) => RawProperty::vector3d(value),
+        }
+    }
+
+    #[allow(clippy::needless_pass_by_value)] // raw property
+    pub(crate) fn from_raw(raw: RawProperty) -> Property {
+        match raw.get_kind() {
+            chfl_property_kind::CHFL_PROPERTY_BOOL => Self::Bool(raw.get_bool().expect("should be a bool")),
+            chfl_property_kind::CHFL_PROPERTY_DOUBLE => Self::Double(raw.get_double().expect("should be a double")),
+            chfl_property_kind::CHFL_PROPERTY_STRING => Self::String(raw.get_string().expect("should be a string")),
+            chfl_property_kind::CHFL_PROPERTY_VECTOR3D => {
+                Property::Vector3D(raw.get_vector3d().expect("should be a vector3d"))
+            }
+        }
+    }
+}
+
+/// An iterator over the properties in an atom/frame/residue
+pub struct PropertiesIter<'a> {
+    pub(crate) names: std::vec::IntoIter<String>,
+    pub(crate) getter: Box<dyn Fn(&str) -> Property + 'a>,
+}
+
+impl<'a> Iterator for PropertiesIter<'a> {
+    type Item = (String, Property);
+    fn next(&mut self) -> Option<Self::Item> {
+        self.names.next().map(|name| {
+            let property = (self.getter)(&name);
+            (name, property)
+        })
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.names.size_hint()
+    }
+
+    fn count(self) -> usize {
+        self.names.count()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    mod raw {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = RawProperty::bool(false);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(property.get_bool(), Ok(false));
+        }
+
+        #[test]
+        fn double() {
+            let property = RawProperty::double(45.0);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(property.get_double(), Ok(45.0));
+        }
+
+        #[test]
+        fn string() {
+            let property = RawProperty::string("test");
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(property.get_string(), Ok("test".into()));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = RawProperty::vector3d([1.2, 3.4, 5.6]);
+            assert_eq!(property.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(property.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+        }
+    }
+
+    mod rust {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = Property::Bool(false);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(raw.get_bool(), Ok(false));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn double() {
+            let property = Property::Double(45.0);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(raw.get_double(), Ok(45.0));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn string() {
+            let property = Property::String("test".into());
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(raw.get_string(), Ok("test".into()));
+
+            assert_eq!(Property::from_raw(raw), property);
+
+            let property = Property::String("long string ".repeat(128));
+            let raw = property.as_raw();
+            assert_eq!(raw.get_string(), Ok("long string ".repeat(128)));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = Property::Vector3D([1.2, 3.4, 5.6]);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(raw.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/residue.rs.html b/0.10.4/src/chemfiles/residue.rs.html new file mode 100644 index 000000000..9de684260 --- /dev/null +++ b/0.10.4/src/chemfiles/residue.rs.html @@ -0,0 +1,814 @@ +residue.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::marker::PhantomData;
+
+use chemfiles_sys::*;
+
+use crate::errors::{check_not_null, check_success};
+use crate::property::{PropertiesIter, Property, RawProperty};
+use crate::strings;
+
+/// A `Residue` is a group of atoms belonging to the same logical unit. They
+/// can be small molecules, amino-acids in a protein, monomers in polymers,
+/// *etc.*
+#[derive(Debug)]
+pub struct Residue {
+    handle: *mut CHFL_RESIDUE,
+}
+
+/// An analog to a reference to a residue (`&Residue`)
+#[derive(Debug)]
+pub struct ResidueRef<'a> {
+    inner: Residue,
+    marker: PhantomData<&'a Residue>,
+}
+
+impl<'a> std::ops::Deref for ResidueRef<'a> {
+    type Target = Residue;
+    fn deref(&self) -> &Residue {
+        &self.inner
+    }
+}
+
+impl Clone for Residue {
+    fn clone(&self) -> Residue {
+        unsafe {
+            let new_handle = chfl_residue_copy(self.as_ptr());
+            Residue::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Residue {
+    /// Create a `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_RESIDUE) -> Residue {
+        check_not_null(ptr);
+        Residue { handle: ptr }
+    }
+
+    /// Create a borrowed `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_RESIDUE) -> ResidueRef<'a> {
+        ResidueRef {
+            inner: Residue::from_ptr(ptr as *mut CHFL_RESIDUE),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Create a new residue with the given `name`
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("ALA");
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), None);
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue(buffer.as_ptr());
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Create a new residue with the given `name` and `id` as identifier.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("ALA", 67);
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), Some(67));
+    /// ```
+    pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = chfl_residue_with_id(buffer.as_ptr(), id);
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Get the number of atoms in this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    ///
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// assert_eq!(residue.size(), 3);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_residue_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the identifier of this residue in the initial topology file.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("", 42);
+    /// assert_eq!(residue.id(), Some(42));
+    /// ```
+    pub fn id(&self) -> Option<i64> {
+        let mut resid = 0;
+        let status = unsafe { chfl_residue_id(self.as_ptr(), &mut resid) };
+
+        if status == chfl_status::CHFL_SUCCESS {
+            return Some(resid);
+        } else if status == chfl_status::CHFL_GENERIC_ERROR {
+            return None;
+        }
+
+        // call check_success to panic in case of error
+        check_success(status);
+        unreachable!();
+    }
+
+    /// Get the name of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("water");
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { chfl_residue_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(64, get_name).expect("getting residue name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Add the atom at index `atom` in this residue.
+    ///
+    /// This will fail if the atom is already in the residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// assert_eq!(residue.contains(56), true);
+    ///
+    /// // Adding the same atom twice is fine
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// ```
+    pub fn add_atom(&mut self, atom: usize) {
+        unsafe {
+            check_success(chfl_residue_add_atom(self.as_mut_ptr(), atom as u64));
+        }
+    }
+
+    /// Check if the atom at index `i` is in this residue
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.contains(56), true);
+    /// ```
+    pub fn contains(&self, atom: usize) -> bool {
+        let mut inside = 0;
+        unsafe {
+            check_success(chfl_residue_contains(self.as_ptr(), atom as u64, &mut inside));
+        }
+        return inside != 0;
+    }
+
+    /// Get the list of atoms of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.atoms(), vec![]);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.atoms(), vec![56]);
+    /// ```
+    pub fn atoms(&self) -> Vec<usize> {
+        let size = self.size();
+        let count = size as u64;
+        let mut indices = vec![u64::max_value(); size];
+        unsafe {
+            check_success(chfl_residue_atoms(self.as_ptr(), indices.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return indices.into_iter().map(|idx| idx as usize).collect();
+    }
+
+    /// Add a new `property` with the given `name` to this residue.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("a string", "hello");
+    /// residue.set("a double", 3.2);
+    ///
+    /// assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(chfl_residue_set_property(
+                self.as_mut_ptr(),
+                buffer.as_ptr(),
+                property.as_ptr(),
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(residue.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = chfl_residue_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    /// residue.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in residue.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_residue_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![std::ptr::null_mut(); size];
+        unsafe {
+            check_success(chfl_residue_list_properties(self.as_ptr(), c_names.as_mut_ptr(), count));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property")),
+        }
+    }
+}
+
+impl Drop for Residue {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        let copy = residue.clone();
+        assert_eq!(copy.size(), 0);
+
+        residue.add_atom(3);
+        residue.add_atom(7);
+        assert_eq!(residue.size(), 2);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn name() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.name(), "A");
+    }
+
+    #[test]
+    fn id() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.id(), None);
+
+        let residue = Residue::with_id("A", 42);
+        assert_eq!(residue.id(), Some(42));
+
+        let residue = Residue::with_id("A", -3);
+        assert_eq!(residue.id(), Some(-3));
+    }
+
+    #[test]
+    fn atoms() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        residue.add_atom(0);
+        residue.add_atom(3);
+        residue.add_atom(45);
+        assert_eq!(residue.size(), 3);
+
+        assert!(residue.contains(3));
+        assert!(!residue.contains(5));
+
+        assert_eq!(residue.atoms(), vec![0, 3, 45]);
+    }
+
+    #[test]
+    fn property() {
+        let mut residue = Residue::new("ALA");
+
+        residue.set("foo", -22.0);
+        assert_eq!(residue.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(residue.get("bar"), None);
+
+        residue.set("bar", Property::String("here".into()));
+        for (name, property) in residue.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/selection.rs.html b/0.10.4/src/chemfiles/selection.rs.html new file mode 100644 index 000000000..e8c461194 --- /dev/null +++ b/0.10.4/src/chemfiles/selection.rs.html @@ -0,0 +1,832 @@ +selection.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use chemfiles_sys::*;
+
+use crate::errors::{check, check_not_null, check_success, Error, Status};
+use crate::frame::Frame;
+use crate::strings;
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+/// A `Match` is a set of atomic indexes matching a given selection. It can
+/// mostly be used like a `&[usize]`.
+pub struct Match {
+    size: usize,
+    atoms: [usize; 4],
+}
+
+#[allow(clippy::len_without_is_empty)]
+impl Match {
+    /// Get the length of the Match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// ```
+    pub fn len(&self) -> usize {
+        self.size
+    }
+
+    /// Create a new match containing the atoms in the `atoms` slice.
+    ///
+    /// # Panics
+    ///
+    /// If the slice contains more than 4 elements, which is the maximal size
+    /// of a match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// assert_eq!(atomic_match[0], 3);
+    /// assert_eq!(atomic_match[1], 4);
+    /// assert_eq!(atomic_match[2], 5);
+    /// ```
+    pub fn new(atoms: &[usize]) -> Match {
+        assert!(atoms.len() <= 4);
+        let size = atoms.len();
+        let mut matches = [usize::max_value(); 4];
+        for (i, atom) in atoms.iter().enumerate() {
+            matches[i] = *atom;
+        }
+        Match { size, atoms: matches }
+    }
+
+    /// Iterate over the atomic indexes in the match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// let mut iter = atomic_match.iter();
+    ///
+    /// assert_eq!(iter.next(), Some(&3));
+    /// assert_eq!(iter.next(), Some(&4));
+    /// assert_eq!(iter.next(), Some(&5));
+    /// assert_eq!(iter.next(), None);
+    /// ```
+    pub fn iter(&self) -> std::slice::Iter<usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+impl std::ops::Index<usize> for Match {
+    type Output = usize;
+    fn index(&self, i: usize) -> &Self::Output {
+        assert!(i < self.len());
+        &self.atoms[i]
+    }
+}
+
+impl<'a> IntoIterator for &'a Match {
+    type Item = &'a usize;
+    type IntoIter = std::slice::Iter<'a, usize>;
+
+    fn into_iter(self) -> Self::IntoIter {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+/// A `Selection` allow to select atoms in a `Frame`, from a selection
+/// language. The selection language is built by combining basic operations.
+/// Each basic operation follows the `<selector>[(<variable>)] <operator>
+/// <value>` structure, where `<operator>` is a comparison operator in
+/// `== != < <= > >=`.
+#[derive(Debug)]
+pub struct Selection {
+    handle: *mut CHFL_SELECTION,
+}
+
+impl Clone for Selection {
+    fn clone(&self) -> Selection {
+        unsafe {
+            let new_handle = chfl_selection_copy(self.as_ptr());
+            Selection::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Drop for Selection {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl Selection {
+    /// Create a `Selection` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_SELECTION) -> Selection {
+        check_not_null(ptr);
+        Selection { handle: ptr }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Create a new selection from the given selection string.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the selection string is invalid.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// ```
+    pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error> {
+        let buffer = strings::to_c(selection.into());
+        unsafe {
+            let handle = chfl_selection(buffer.as_ptr());
+            if handle.is_null() {
+                Err(Error {
+                    status: Status::SelectionError,
+                    message: Error::last_error(),
+                })
+            } else {
+                Ok(Selection::from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the size of the selection, i.e. the number of atoms we are selecting
+    /// together.
+    ///
+    /// This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond'
+    /// context, 3 for the 'three' and 'angles' context and 4 for the 'four'
+    /// and 'dihedral' context.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// assert_eq!(selection.size(), 2);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_selection_size(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the selection string used to create this selection.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("name H").unwrap();
+    /// assert_eq!(selection.string(), "name H");
+    /// ```
+    pub fn string(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_selection_string(self.as_ptr(), ptr, len) };
+        let selection = strings::call_autogrow_buffer(1024, get_string).expect("failed to get selection string");
+        return strings::from_c(selection.as_ptr());
+    }
+
+    /// Evaluate a selection for a given frame, and return the corresponding
+    /// matches.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// let matches = selection.evaluate(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    ///
+    /// assert_eq!(matches[0].len(), 2);
+    /// assert_eq!(matches[0][0], 0);
+    /// assert_eq!(matches[0][1], 1);
+    ///
+    /// assert_eq!(matches[1].len(), 2);
+    /// assert_eq!(matches[1][0], 2);
+    /// assert_eq!(matches[1][1], 1);
+    /// ```
+    pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match> {
+        #![allow(clippy::cast_possible_truncation)]
+        let mut count = 0;
+        unsafe {
+            check(chfl_selection_evaluate(self.as_mut_ptr(), frame.as_ptr(), &mut count))
+                .expect("failed to evaluate selection");
+        }
+
+        let size = count as usize;
+        let mut chfl_matches = vec![chfl_match { size: 0, atoms: [0; 4] }; size];
+        unsafe {
+            check(chfl_selection_matches(self.handle, chfl_matches.as_mut_ptr(), count))
+                .expect("failed to extract matches");
+        }
+
+        return chfl_matches
+            .into_iter()
+            .map(|chfl_match| Match {
+                size: chfl_match.size as usize,
+                atoms: [
+                    chfl_match.atoms[0] as usize,
+                    chfl_match.atoms[1] as usize,
+                    chfl_match.atoms[2] as usize,
+                    chfl_match.atoms[3] as usize,
+                ],
+            })
+            .collect();
+    }
+
+    /// Evaluates a selection of size 1 on a given `frame`. This function
+    /// returns the list of atomic indexes in the frame matching this selection.
+    ///
+    /// # Panics
+    ///
+    /// If the selection size is not 1
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("name H").unwrap();
+    /// let matches = selection.list(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    /// assert_eq!(matches[0], 0);
+    /// assert_eq!(matches[1], 2);
+    /// ```
+    pub fn list(&mut self, frame: &Frame) -> Vec<usize> {
+        assert!(
+            self.size() == 1,
+            "can not call `Selection::list` on a multiple selection"
+        );
+        return self.evaluate(frame).into_iter().map(|m| m[0]).collect();
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::{Atom, Topology};
+
+    #[test]
+    fn clone() {
+        let selection = Selection::new("name H").unwrap();
+
+        let copy = selection.clone();
+        assert_eq!(selection.size(), 1);
+        assert_eq!(copy.size(), 1);
+    }
+
+    fn testing_frame() -> Frame {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("H"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("H"));
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(2, 3);
+
+        let mut frame = Frame::new();
+        frame.resize(4);
+        frame.set_topology(&topology).unwrap();
+        return frame;
+    }
+
+    mod matches {
+        use super::*;
+
+        #[test]
+        fn index() {
+            let m = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+            assert_eq!(m[2], 3);
+            assert_eq!(m[3], 4);
+
+            let m = Match::new(&[1, 2]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+        }
+
+        #[test]
+        fn iter() {
+            let match_ = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(match_.iter().copied().collect::<Vec<usize>>(), vec![1, 2, 3, 4]);
+
+            let v = vec![1, 2, 3, 4];
+            for (i, &m) in match_.iter().enumerate() {
+                assert_eq!(v[i], m);
+            }
+        }
+
+        #[test]
+        #[should_panic]
+        fn out_of_bound() {
+            let m = Match::new(&[1, 2]);
+            let _ = m[2];
+        }
+
+        #[test]
+        #[should_panic]
+        fn too_big() {
+            let _ = Match::new(&[1, 2, 3, 5, 4]);
+        }
+    }
+
+    #[test]
+    fn size() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.size(), 1);
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 3);
+
+        let selection = Selection::new("four: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 4);
+    }
+
+    #[test]
+    fn string() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.string(), "name H");
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.string(), "angles: name(#1) H");
+    }
+
+    #[test]
+    fn evaluate() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.evaluate(&frame);
+        assert_eq!(res, &[Match::new(&[0]), Match::new(&[3])]);
+
+        let mut selection = Selection::new("angles: all").unwrap();
+        let res = selection.evaluate(&frame);
+        for m in &[Match::new(&[0, 1, 2]), Match::new(&[1, 2, 3])] {
+            assert!(res.iter().any(|r| r == m));
+        }
+    }
+
+    #[test]
+    fn list() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.list(&frame);
+        assert_eq!(res, vec![0, 3]);
+    }
+
+    #[test]
+    #[should_panic = "can not call `Selection::list` on a multiple selection"]
+    fn list_on_size_1_selection() {
+        let frame = testing_frame();
+        let mut selection = Selection::new("pairs: name(#1) H").unwrap();
+        let _list = selection.list(&frame);
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/strings.rs.html b/0.10.4/src/chemfiles/strings.rs.html new file mode 100644 index 000000000..b67d019a8 --- /dev/null +++ b/0.10.4/src/chemfiles/strings.rs.html @@ -0,0 +1,122 @@ +strings.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! String conversions between C and Rust
+use std::ffi::{CStr, CString};
+use std::os::raw::c_char;
+
+use crate::errors::{check, Error};
+
+use chemfiles_sys::chfl_status;
+
+/// Create a Rust string from a C string. Clones all characters in `buffer`.
+pub fn from_c(buffer: *const c_char) -> String {
+    unsafe {
+        let rust_str = CStr::from_ptr(buffer).to_str().expect("Invalid Rust string from C");
+        return String::from(rust_str);
+    }
+}
+
+/// Create a C string from a Rust string.
+pub fn to_c<S>(string: S) -> CString
+where
+    S: Into<Vec<u8>>,
+{
+    CString::new(string).expect("Invalid C string from Rust")
+}
+
+/// Check if a string buffer was big enough when passed to a C function
+fn buffer_was_big_enough(buffer: &[c_char]) -> bool {
+    let len = buffer.len();
+    if len < 2 {
+        false
+    } else {
+        // The C code should always set the last element to 0
+        debug_assert_eq!(buffer[len - 1], 0);
+        buffer[len - 2] == 0
+    }
+}
+
+/// Call `callback` C function with a string buffer and it length, using
+/// `initial` as the buffer initial size. If the buffer was filled and the
+/// result truncated by the C library, grow the buffer and try again until we
+/// get all the data. Then return the filled buffer to the caller.
+pub fn call_autogrow_buffer<F>(initial: usize, callback: F) -> Result<Vec<c_char>, Error>
+where
+    F: Fn(*mut c_char, u64) -> chfl_status,
+{
+    let mut size = initial;
+    let mut buffer = vec![0; size];
+    check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+
+    while !buffer_was_big_enough(&buffer) {
+        // Grow the buffer and retry
+        size *= 2;
+        buffer.resize(size, 0);
+        check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+    }
+
+    Ok(buffer)
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/topology.rs.html b/0.10.4/src/chemfiles/topology.rs.html new file mode 100644 index 000000000..587b93ffe --- /dev/null +++ b/0.10.4/src/chemfiles/topology.rs.html @@ -0,0 +1,1980 @@ +topology.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::marker::PhantomData;
+use std::ops::{Deref, Drop};
+
+use chemfiles_sys::*;
+
+use crate::errors::{check, check_not_null, check_success, Error};
+use crate::{Atom, AtomMut, AtomRef};
+use crate::{Residue, ResidueRef};
+
+/// Possible bond order associated with bonds
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+pub enum BondOrder {
+    /// Unknown or unspecified bond order
+    Unknown = chfl_bond_order::CHFL_BOND_UNKNOWN as isize,
+    /// Single bond
+    Single = chfl_bond_order::CHFL_BOND_SINGLE as isize,
+    /// Double bond
+    Double = chfl_bond_order::CHFL_BOND_DOUBLE as isize,
+    /// Triple bond
+    Triple = chfl_bond_order::CHFL_BOND_TRIPLE as isize,
+    /// Quadruple bond (present in some metals)
+    Quadruple = chfl_bond_order::CHFL_BOND_QUADRUPLE as isize,
+    /// Quintuplet bond (present in some metals)
+    Quintuplet = chfl_bond_order::CHFL_BOND_QUINTUPLET as isize,
+    /// Amide bond (required by some file formats)
+    Amide = chfl_bond_order::CHFL_BOND_AMIDE as isize,
+    /// Aromatic bond (required by some file formats)
+    Aromatic = chfl_bond_order::CHFL_BOND_AROMATIC as isize,
+}
+
+impl BondOrder {
+    pub(crate) fn as_raw(self) -> chfl_bond_order {
+        match self {
+            BondOrder::Unknown => chfl_bond_order::CHFL_BOND_UNKNOWN,
+            BondOrder::Single => chfl_bond_order::CHFL_BOND_SINGLE,
+            BondOrder::Double => chfl_bond_order::CHFL_BOND_DOUBLE,
+            BondOrder::Triple => chfl_bond_order::CHFL_BOND_TRIPLE,
+            BondOrder::Quadruple => chfl_bond_order::CHFL_BOND_QUADRUPLE,
+            BondOrder::Quintuplet => chfl_bond_order::CHFL_BOND_QUINTUPLET,
+            BondOrder::Amide => chfl_bond_order::CHFL_BOND_AMIDE,
+            BondOrder::Aromatic => chfl_bond_order::CHFL_BOND_AROMATIC,
+        }
+    }
+}
+
+impl From<chfl_bond_order> for BondOrder {
+    fn from(order: chfl_bond_order) -> BondOrder {
+        match order {
+            chfl_bond_order::CHFL_BOND_UNKNOWN => BondOrder::Unknown,
+            chfl_bond_order::CHFL_BOND_SINGLE => BondOrder::Single,
+            chfl_bond_order::CHFL_BOND_DOUBLE => BondOrder::Double,
+            chfl_bond_order::CHFL_BOND_TRIPLE => BondOrder::Triple,
+            chfl_bond_order::CHFL_BOND_QUADRUPLE => BondOrder::Quadruple,
+            chfl_bond_order::CHFL_BOND_QUINTUPLET => BondOrder::Quintuplet,
+            chfl_bond_order::CHFL_BOND_AMIDE => BondOrder::Amide,
+            chfl_bond_order::CHFL_BOND_AROMATIC => BondOrder::Aromatic,
+        }
+    }
+}
+
+/// A `Topology` contains the definition of all the atoms in the system, and
+/// the liaisons between the atoms (bonds, angles, dihedrals, ...). It will
+/// also contain all the residues information if it is available.
+#[derive(Debug)]
+pub struct Topology {
+    handle: *mut CHFL_TOPOLOGY,
+}
+
+/// An analog to a reference to a topology (`&Topology`)
+#[derive(Debug)]
+pub struct TopologyRef<'a> {
+    inner: Topology,
+    marker: PhantomData<&'a Topology>,
+}
+
+impl<'a> Deref for TopologyRef<'a> {
+    type Target = Topology;
+    fn deref(&self) -> &Topology {
+        &self.inner
+    }
+}
+
+impl Clone for Topology {
+    fn clone(&self) -> Topology {
+        unsafe {
+            let new_handle = chfl_topology_copy(self.as_ptr());
+            Topology::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Topology {
+    /// Create a `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TOPOLOGY) -> Topology {
+        check_not_null(ptr);
+        Topology { handle: ptr }
+    }
+
+    /// Create a borrowed `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const CHFL_TOPOLOGY) -> TopologyRef<'a> {
+        TopologyRef {
+            inner: Topology::from_ptr(ptr as *mut CHFL_TOPOLOGY),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Create a new empty topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    /// ```
+    pub fn new() -> Topology {
+        unsafe { Topology::from_ptr(chfl_topology()) }
+    }
+
+    /// Get a reference of the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// let atom = topology.atom(4);
+    /// assert_eq!(atom.name(), "");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = chfl_atom_from_topology(self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64);
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// assert_eq!(topology.atom(4).name(), "");
+    ///
+    /// topology.atom_mut(4).set_name("Fe");
+    /// assert_eq!(topology.atom(4).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = chfl_atom_from_topology(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(chfl_topology_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize this topology to hold `natoms` atoms, inserting dummy atoms if
+    /// the new size if bigger than the old one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(chfl_topology_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` at the end of this topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Atom};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Mg"));
+    ///
+    /// let atom = topology.atom(0);
+    /// assert_eq!(atom.name(), "Mg");
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom) {
+        unsafe {
+            check_success(chfl_topology_add_atom(self.as_mut_ptr(), atom.as_ptr()));
+        }
+    }
+
+    /// Remove an `Atom` from this topology by `index`. This modify all the
+    /// other atoms indexes.
+    ///
+    /// # Panics
+    ///
+    /// If the `index` is out of bounds
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(9);
+    /// assert_eq!(topology.size(), 9);
+    ///
+    /// topology.remove(7);
+    /// assert_eq!(topology.size(), 8);
+    /// ```
+    pub fn remove(&mut self, index: usize) {
+        unsafe {
+            check_success(chfl_topology_remove(self.as_mut_ptr(), index as u64));
+        }
+    }
+
+    /// Get the number of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds_count(), 3);
+    /// ```
+    pub fn bonds_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_bonds_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.angles_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles_count(), 2);
+    /// ```
+    pub fn angles_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_angles_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.dihedrals_count(), 1);
+    /// ```
+    pub fn dihedrals_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_dihedrals_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    /// assert_eq!(topology.impropers_count(), 1);
+    /// ```
+    pub fn impropers_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_impropers_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the list of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+    /// ```
+    pub fn bonds(&self) -> Vec<[usize; 2]> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![[u64::max_value(); 2]; size];
+        unsafe {
+            check_success(chfl_topology_bonds(self.as_ptr(), bonds.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return bonds
+            .into_iter()
+            .map(|bond| [bond[0] as usize, bond[1] as usize])
+            .collect();
+    }
+
+    /// Get the list of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+    /// ```
+    pub fn angles(&self) -> Vec<[usize; 3]> {
+        let size = self.angles_count();
+        let count = size as u64;
+        let mut angles = vec![[u64::max_value(); 3]; size];
+        unsafe {
+            check_success(chfl_topology_angles(self.as_ptr(), angles.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return angles
+            .into_iter()
+            .map(|angle| [angle[0] as usize, angle[1] as usize, angle[2] as usize])
+            .collect();
+    }
+
+    /// Get the list of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    ///
+    /// assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+    /// ```
+    pub fn dihedrals(&self) -> Vec<[usize; 4]> {
+        let size = self.dihedrals_count();
+        let count = size as u64;
+        let mut dihedrals = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_dihedrals(self.as_ptr(), dihedrals.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return dihedrals
+            .into_iter()
+            .map(|dihedral| {
+                [
+                    dihedral[0] as usize,
+                    dihedral[1] as usize,
+                    dihedral[2] as usize,
+                    dihedral[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Get the list of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    ///
+    /// assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+    /// ```
+    pub fn impropers(&self) -> Vec<[usize; 4]> {
+        let size = self.impropers_count();
+        let count = size as u64;
+        let mut impropers = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(chfl_topology_impropers(self.as_ptr(), impropers.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return impropers
+            .into_iter()
+            .map(|improper| {
+                [
+                    improper[0] as usize,
+                    improper[1] as usize,
+                    improper[2] as usize,
+                    improper[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    /// assert_eq!(topology.angles().len(), 1);
+    ///
+    /// topology.clear_bonds();
+    /// assert!(topology.bonds().is_empty());
+    /// assert!(topology.angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(chfl_topology_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(chfl_topology_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Get the bond order for the bond between the atoms at indexes `i` and
+    /// `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn bond_order(&self, i: usize, j: usize) -> BondOrder {
+        let mut order = chfl_bond_order::CHFL_BOND_UNKNOWN;
+        unsafe {
+            check_success(chfl_topology_bond_order(self.as_ptr(), i as u64, j as u64, &mut order));
+        }
+        return order.into();
+    }
+
+    /// Get the bond order for all the bonds in the topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(3);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// topology.add_bond_with_order(0, 2, BondOrder::Single);
+    ///
+    /// assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+    /// ```
+    pub fn bond_orders(&self) -> Vec<BondOrder> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![BondOrder::Unknown; size];
+        unsafe {
+            check_success(chfl_topology_bond_orders(
+                self.as_ptr(),
+                // Casting BondOrder to chfl_bond_order is safe, as they are
+                // both `repr(C)` enums with the same values.
+                bonds.as_mut_ptr().cast(),
+                count,
+            ));
+        }
+        return bonds;
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// this topology.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// topology.remove_bond(0, 1);
+    /// assert_eq!(topology.bonds_count(), 1);
+    ///
+    /// // Removing a bond that does not exists is fine
+    /// topology.remove_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 1);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(chfl_topology_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Get a reference to the residue at index `index` from this topology.
+    ///
+    /// The residue index in the topology is not always the same as the residue
+    /// `id`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn residue(&self, index: usize) -> Option<ResidueRef> {
+        unsafe {
+            let handle = chfl_residue_from_topology(self.as_ptr(), index as u64);
+            if handle.is_null() {
+                None
+            } else {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get a copy of the residue containing the atom at index `index` in this
+    /// topology, if any.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.resize(8);
+    ///
+    /// let mut residue = Residue::new("water");
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// topology.add_residue(&residue).unwrap();
+    ///
+    /// let residue = topology.residue_for_atom(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    ///
+    /// assert!(topology.residue_for_atom(6).is_none());
+    /// ```
+    pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef> {
+        let handle = unsafe { chfl_residue_for_atom(self.as_ptr(), index as u64) };
+        if handle.is_null() {
+            None
+        } else {
+            unsafe { Some(Residue::ref_from_ptr(handle)) }
+        }
+    }
+
+    /// Get the number of residues in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.residues_count(), 0);
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    /// assert_eq!(topology.residues_count(), 2);
+    /// ```
+    pub fn residues_count(&self) -> u64 {
+        let mut count = 0;
+        unsafe {
+            check_success(chfl_topology_residues_count(self.as_ptr(), &mut count));
+        }
+        return count;
+    }
+
+    /// Add a residue to this topology.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue `id` is not already in the topology,
+    /// or if the residue contains atoms that are already in another residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe { check(chfl_topology_add_residue(self.as_mut_ptr(), residue.as_ptr())) }
+    }
+
+    /// Check if the two residues `first` and `second` from the `topology` are
+    /// linked together, *i.e.* if there is a bond between one atom in the
+    /// first residue and one atom in the second one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    ///
+    /// let first = topology.residue(0).unwrap();
+    /// let second = topology.residue(1).unwrap();
+    /// assert_eq!(topology.are_linked(&first, &second), false);
+    /// ```
+    pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool {
+        let mut linked = 0;
+        unsafe {
+            check_success(chfl_topology_residues_linked(
+                self.as_ptr(),
+                first.as_ptr(),
+                second.as_ptr(),
+                &mut linked,
+            ));
+        }
+        return linked != 0;
+    }
+}
+
+impl Drop for Topology {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        let copy = topology.clone();
+        assert_eq!(copy.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+
+        topology.remove(7);
+        assert_eq!(topology.size(), 9);
+
+        topology.add_atom(&Atom::new("Hg"));
+        assert_eq!(topology.size(), 10);
+    }
+
+    #[test]
+    fn atoms() {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(3).name(), "Fe");
+    }
+
+    #[test]
+    fn remove() {
+        let mut topology = Topology::new();
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "W");
+
+        topology.remove(1);
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "Fe");
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove() {
+        let mut topology = Topology::new();
+        topology.resize(18);
+        topology.remove(33);
+    }
+
+    #[test]
+    fn bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.bonds_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(9, 2);
+        topology.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(topology.bonds_count(), 3);
+
+        assert_eq!(topology.bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(topology.bond_orders(), expected);
+
+        assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(topology.bond_order(3, 7), BondOrder::Aromatic);
+
+        topology.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        topology.remove_bond(8, 7);
+        assert_eq!(topology.bonds_count(), 2);
+
+        topology.clear_bonds();
+        assert_eq!(topology.bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn angles() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.angles_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 7);
+        topology.add_bond(3, 5);
+        assert_eq!(topology.angles_count(), 2);
+
+        assert_eq!(topology.angles(), vec![[0, 1, 2], [5, 3, 7]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.angles_count(), 0);
+    }
+
+    #[test]
+    fn dihedrals() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.dihedrals_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 2);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(7, 10);
+        assert_eq!(topology.dihedrals_count(), 2);
+
+        assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3], [5, 4, 7, 10]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.dihedrals_count(), 0);
+    }
+
+    #[test]
+    fn impropers() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.impropers_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(0, 2);
+        topology.add_bond(0, 3);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(4, 8);
+        assert_eq!(topology.impropers_count(), 2);
+
+        assert_eq!(topology.impropers(), vec![[1, 0, 2, 3], [5, 4, 7, 8]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.impropers_count(), 0);
+    }
+
+    #[test]
+    fn residues() {
+        let mut topology = Topology::new();
+        topology.resize(4);
+        assert_eq!(topology.residues_count(), 0);
+
+        let mut residue = Residue::new("Foo");
+        residue.add_atom(0);
+        residue.add_atom(2);
+
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 1);
+
+        assert_eq!(topology.residue(0).unwrap().name(), "Foo");
+        {
+            let residue = topology.residue_for_atom(2).unwrap();
+            assert_eq!(residue.name(), "Foo");
+        }
+
+        let mut residue = Residue::new("Bar");
+        residue.add_atom(3);
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 2);
+
+        let first = topology.residue(0).unwrap();
+        let second = topology.residue(0).unwrap();
+        assert!(topology.are_linked(&first, &second));
+
+        // missing residue
+        assert!(topology.residue_for_atom(1).is_none());
+        // out of bounds
+        assert!(topology.residue_for_atom(67).is_none());
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/src/chemfiles/trajectory.rs.html b/0.10.4/src/chemfiles/trajectory.rs.html new file mode 100644 index 000000000..90a15f538 --- /dev/null +++ b/0.10.4/src/chemfiles/trajectory.rs.html @@ -0,0 +1,1266 @@ +trajectory.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::convert::TryInto;
+use std::os::raw::c_char;
+use std::path::Path;
+
+use chemfiles_sys::*;
+
+use crate::errors::{check, check_success, Error, Status};
+use crate::strings;
+use crate::{Frame, Topology, UnitCell};
+
+/// The `Trajectory` type is the main entry point when using chemfiles. A
+/// `Trajectory` behave a bit like a file, allowing to read and/or write
+/// `Frame`.
+#[derive(Debug)]
+pub struct Trajectory {
+    handle: *mut CHFL_TRAJECTORY,
+}
+
+impl Drop for Trajectory {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = chfl_trajectory_close(self.as_ptr());
+        }
+    }
+}
+
+impl Trajectory {
+    /// Create a `Trajectory` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut CHFL_TRAJECTORY) -> Result<Trajectory, Error> {
+        if ptr.is_null() {
+            Err(Error {
+                status: Status::FileError,
+                message: Error::last_error(),
+            })
+        } else {
+            Ok(Trajectory { handle: ptr })
+        }
+    }
+
+    /// Get the underlying C pointer as a pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Open the file at the given `path` in the given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// ```
+    pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path
+            .as_ref()
+            .to_str()
+            .ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_open(path.as_ptr(), mode as c_char);
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Open the file at the given `path` using a specific file `format` and the
+    /// given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// Specifying a format is needed when the file format does not match the
+    /// extension, or when there is not standard extension for this format. If
+    /// `format` is an empty string, the format will be guessed from the
+    /// extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+    /// ```
+    pub fn open_with_format<'a, P, S>(filename: P, mode: char, format: S) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let filename = filename
+            .as_ref()
+            .to_str()
+            .ok_or_else(|| Error::utf8_path_error(filename.as_ref()))?;
+
+        let filename = strings::to_c(filename);
+        let format = strings::to_c(format.into());
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = chfl_trajectory_with_format(filename.as_ptr(), mode as c_char, format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Write to a memory buffer as though it was a formatted file.
+    ///
+    /// The `format` parameter should follow the same rules as in the main
+    /// `Trajectory` constructor, except that compression specification
+    /// is not supported.
+    ///
+    /// The `memory_buffer` function can be used to retrieve the data written
+    /// to memory of the `Trajectory`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the format do not support in-memory writers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Trajectory;
+    /// let trajectory_memory = Trajectory::memory_writer("SMI");
+    ///
+    /// // Binary formats typically do not support this feature
+    /// assert!(Trajectory::memory_writer("XTC").is_err());
+    /// ```
+    pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>
+    where
+        S: Into<&'a str>,
+    {
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = chfl_trajectory_memory_writer(format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read the next step of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of atom
+    /// in the next step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read(&mut frame).unwrap();
+    /// ```
+    pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error> {
+        unsafe { check(chfl_trajectory_read(self.as_mut_ptr(), frame.as_mut_ptr())) }
+    }
+
+    /// Read a specific `step` of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of
+    /// atom at this step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read_step(10, &mut frame).unwrap();
+    /// ```
+    pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(chfl_trajectory_read_step(
+                self.as_mut_ptr(),
+                step as u64,
+                frame.as_mut_ptr(),
+            ))
+        }
+    }
+
+    /// Write a `frame` to this trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.write(&mut frame).unwrap();
+    /// ```
+    pub fn write(&mut self, frame: &Frame) -> Result<(), Error> {
+        unsafe { check(chfl_trajectory_write(self.as_mut_ptr(), frame.as_ptr())) }
+    }
+
+    /// Set the `topology` associated with this trajectory. This topology will
+    /// be used when reading and writing the files, replacing any topology in
+    /// the frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Atom, Topology};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_atom(&Atom::new("O"));
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    ///
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_topology(&topology);
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) {
+        unsafe {
+            check_success(chfl_trajectory_set_topology(self.as_mut_ptr(), topology.as_ptr()));
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in `format`;
+    /// and extracting the topology of this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_file("topology.pdb").unwrap();
+    /// ```
+    pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path
+            .as_ref()
+            .to_str()
+            .ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(
+                self.as_mut_ptr(),
+                path.as_ptr(),
+                std::ptr::null(),
+            ))
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in
+    /// `format`; and extracting the topology of this frame.
+    ///
+    /// If `format` is an empty string, the format will be guessed from the
+    /// `path` extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+    /// ```
+    pub fn set_topology_with_format<'a, P, S>(&mut self, path: P, format: S) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let path = path
+            .as_ref()
+            .to_str()
+            .ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let format = strings::to_c(format.into());
+        let path = strings::to_c(path);
+        unsafe {
+            check(chfl_trajectory_topology_file(
+                self.as_mut_ptr(),
+                path.as_ptr(),
+                format.as_ptr(),
+            ))
+        }
+    }
+
+    /// Set the unit `cell` associated with a trajectory. This cell will be
+    /// used when reading and writing the files, replacing any unit cell in the
+    /// frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, UnitCell};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(chfl_trajectory_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get the number of steps (the number of frames) in a trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// println!("This trajectory contains {} steps", trajectory.nsteps());
+    /// ```
+    // FIXME should this take &self instead? The file can be modified by this
+    // function, but the format should reset the state.
+    pub fn nsteps(&mut self) -> usize {
+        let mut res = 0;
+        unsafe {
+            check(chfl_trajectory_nsteps(self.as_mut_ptr(), &mut res))
+                .expect("failed to get the number of steps in this trajectory");
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return res as usize;
+    }
+
+    /// Obtain the memory buffer written to by the trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This fails if the trajectory was not opened with
+    /// `Trajectory::memory_writer`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, BondOrder, Frame, Trajectory};
+    /// let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+    ///
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_bond_with_order(0, 1, BondOrder::Single);
+    ///
+    /// trajectory_memory.write(&frame).unwrap();
+    ///
+    /// let result = trajectory_memory.memory_buffer();
+    /// assert_eq!(result.unwrap(), "CC\n");
+    /// ```
+    #[allow(clippy::cast_possible_truncation)]
+    pub fn memory_buffer(&self) -> Result<&str, Error> {
+        let mut ptr: *const c_char = std::ptr::null();
+        let mut count: u64 = 0;
+        let buffer = unsafe {
+            check(chfl_trajectory_memory_buffer(self.as_ptr(), &mut ptr, &mut count))?;
+            std::slice::from_raw_parts(ptr.cast(), count.try_into().expect("failed to convert u64 to usize"))
+        };
+
+        let string = std::str::from_utf8(buffer)?;
+        Ok(string)
+    }
+
+    /// Get file path for this trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// assert_eq!(trajectory.path(), "water.xyz");
+    /// ```
+    pub fn path(&self) -> String {
+        let get_string = |ptr, len| unsafe { chfl_trajectory_path(self.as_ptr(), ptr, len) };
+        let path = strings::call_autogrow_buffer(1024, get_string).expect("failed to get path string");
+        return strings::from_c(path.as_ptr());
+    }
+}
+
+/// `MemoryTrajectoryReader` is a handle for a `Trajectory` in memory.
+pub struct MemoryTrajectoryReader<'data> {
+    inner: Trajectory,
+    phantom: std::marker::PhantomData<&'data [u8]>,
+}
+
+impl<'data> MemoryTrajectoryReader<'data> {
+    /// Read a memory buffer as though it was a formatted file.
+    ///
+    /// The memory buffer used to store the file is given using the `data`
+    /// argument. The `format` parameter is required and should follow the same
+    /// rules as in the main `Trajectory` constructor.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or if the format do not support in-memory readers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{MemoryTrajectoryReader, Frame};
+    /// let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+    /// let mut trajectory = MemoryTrajectoryReader::new(aromatics.as_bytes(), "SMI").unwrap();
+    /// let mut frame = Frame::new();
+    /// trajectory.read(&mut frame).unwrap();
+    /// assert_eq!(frame.size(), 6);
+    /// ```
+    pub fn new<Data, Format>(data: Data, format: Format) -> Result<MemoryTrajectoryReader<'data>, Error>
+    where
+        Data: Into<&'data [u8]>,
+        Format: AsRef<str>,
+    {
+        let data = data.into();
+        let format = strings::to_c(format.as_ref());
+        let trajectory = unsafe {
+            let handle = chfl_trajectory_memory_reader(data.as_ptr().cast(), data.len() as u64, format.as_ptr());
+            Trajectory::from_ptr(handle)
+        };
+        Ok(MemoryTrajectoryReader {
+            inner: trajectory?,
+            phantom: std::marker::PhantomData,
+        })
+    }
+}
+
+impl<'a> std::ops::Deref for MemoryTrajectoryReader<'a> {
+    type Target = Trajectory;
+
+    #[inline]
+    fn deref(&self) -> &Self::Target {
+        &self.inner
+    }
+}
+
+impl<'a> std::ops::DerefMut for MemoryTrajectoryReader<'a> {
+    #[inline]
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.inner
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use std::io::Read;
+    use std::path::Path;
+
+    use approx::assert_ulps_eq;
+
+    use crate::{Atom, CellShape, Frame, Topology, UnitCell};
+
+    #[test]
+    fn read() {
+        let root = Path::new(file!()).parent().unwrap().join("..");
+        let filename = root.join("data").join("water.xyz");
+        let mut file = Trajectory::open(filename.to_str().unwrap(), 'r').unwrap();
+
+        if cfg!(target_family = "unix") {
+            assert_eq!(file.path(), "src/../data/water.xyz");
+        } else if cfg!(target_family = "windows") {
+            assert_eq!(file.path(), "src\\..\\data\\water.xyz");
+        } else {
+            panic!("please add test for this OS!");
+        }
+
+        assert_eq!(file.nsteps(), 100);
+
+        let mut frame = Frame::new();
+        assert!(file.read(&mut frame).is_ok());
+
+        assert_eq!(frame.size(), 297);
+        assert_ulps_eq!(frame.positions()[0][0], 0.417219);
+        assert_ulps_eq!(frame.positions()[0][1], 8.303366);
+        assert_ulps_eq!(frame.positions()[0][2], 11.737172);
+        assert_ulps_eq!(frame.positions()[124][0], 5.099554);
+        assert_ulps_eq!(frame.positions()[124][1], -0.045104);
+        assert_ulps_eq!(frame.positions()[124][2], 14.153846);
+
+        assert_eq!(frame.atom(0).name(), "O");
+
+        file.set_cell(&UnitCell::new([30.0, 30.0, 30.0]));
+        assert!(file.read_step(41, &mut frame).is_ok());
+        let cell = frame.cell().clone();
+        assert_eq!(cell.lengths(), [30.0, 30.0, 30.0]);
+
+        assert_ulps_eq!(frame.positions()[0][0], 0.761277);
+        assert_ulps_eq!(frame.positions()[0][1], 8.106125);
+        assert_ulps_eq!(frame.positions()[0][2], 10.622949);
+        assert_ulps_eq!(frame.positions()[124][0], 5.13242);
+        assert_ulps_eq!(frame.positions()[124][1], 0.079862);
+        assert_ulps_eq!(frame.positions()[124][2], 14.194161);
+
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 0);
+        }
+
+        assert!(frame.guess_bonds().is_ok());
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 180);
+            assert_eq!(topology.angles_count(), 84);
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("Cs");
+        for _ in 0..297 {
+            topology.add_atom(&atom);
+        }
+
+        file.set_topology(&topology);
+        assert!(file.read_step(10, &mut frame).is_ok());
+        assert_eq!(frame.atom(42).name(), "Cs");
+
+        let filename = root.join("data").join("topology.xyz");
+        assert!(file.set_topology_file(filename.to_str().unwrap()).is_ok());
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.atom(100).name(), "Rd");
+
+        let filename = root.join("data").join("helium.xyz.but.not.really");
+        let filename = filename.to_str().unwrap();
+        let mut file = Trajectory::open_with_format(filename, 'r', "XYZ").unwrap();
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.size(), 125);
+    }
+
+    fn write_file<P>(path: P)
+    where
+        P: AsRef<Path>,
+    {
+        let mut file = Trajectory::open(path, 'w').unwrap();
+        let mut frame = Frame::new();
+        frame.resize(4);
+
+        for position in frame.positions_mut() {
+            *position = [1.0, 2.0, 3.0];
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("X");
+        for _ in 0..4 {
+            topology.add_atom(&atom);
+        }
+        frame.set_topology(&topology).unwrap();
+        assert!(file.write(&frame).is_ok());
+    }
+
+    #[test]
+    fn write() {
+        let filename = "test-tmp.xyz";
+        write_file(filename);
+
+        let expected_content = "4
+Properties=species:S:1:pos:R:3
+X 1 2 3
+X 1 2 3
+X 1 2 3
+X 1 2 3"
+            .lines()
+            .collect::<Vec<_>>();
+
+        let mut file = std::fs::File::open(filename).unwrap();
+        let mut content = String::new();
+        let _ = file.read_to_string(&mut content).unwrap();
+
+        assert_eq!(expected_content, content.lines().collect::<Vec<_>>());
+        std::fs::remove_file(filename).unwrap();
+    }
+
+    #[test]
+    fn memory() {
+        // formats in decreasing order of their memory buffer length to check null termination
+        for format in &["CSSR", "GRO", "XYZ"] {
+            let mut frame_write = Frame::new();
+            frame_write.add_atom(&Atom::new("H"), [1.5, 3.0, -10.0], None);
+            frame_write.add_atom(&Atom::new("O"), [2.3, -1.4, 50.0], None);
+            frame_write.add_atom(&Atom::new("H"), [-1.5, 10.0, 0.0], None);
+            let cell = UnitCell::new([10.0, 11.0, 12.5]);
+
+            let mut trajectory_write = Trajectory::memory_writer(*format).unwrap();
+            trajectory_write.set_cell(&cell);
+            trajectory_write.write(&frame_write).unwrap();
+
+            let buffer = trajectory_write.memory_buffer().unwrap();
+            let mut trajectory_read = MemoryTrajectoryReader::new(buffer.as_bytes(), *format).unwrap();
+            let mut frame_read = Frame::new();
+            trajectory_read.read(&mut frame_read).unwrap();
+
+            assert_eq!(trajectory_read.nsteps(), 1);
+            assert_eq!(frame_read.cell().shape(), CellShape::Orthorhombic);
+            assert_eq!(frame_read.size(), 3);
+            assert_eq!(frame_read.atom(1).name(), "O");
+            crate::assert_vector3d_eq(&frame_read.positions()[2], &[-1.5, 10.0, 0.0], 1e-4);
+        }
+    }
+}
+
+
\ No newline at end of file diff --git a/0.10.4/static.files/COPYRIGHT-002d5dd09d9a4f50.txt b/0.10.4/static.files/COPYRIGHT-002d5dd09d9a4f50.txt new file mode 100644 index 000000000..34e48134c --- /dev/null +++ b/0.10.4/static.files/COPYRIGHT-002d5dd09d9a4f50.txt @@ -0,0 +1,46 @@ +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. diff --git a/0.10.4/static.files/FiraSans-LICENSE-1761dca11ffc8f19.txt b/0.10.4/static.files/FiraSans-LICENSE-1761dca11ffc8f19.txt new file mode 100644 index 000000000..ff9afab06 --- /dev/null +++ b/0.10.4/static.files/FiraSans-LICENSE-1761dca11ffc8f19.txt @@ -0,0 +1,94 @@ +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.4/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 b/0.10.4/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 new file mode 100644 index 000000000..7a1e5fc54 Binary files /dev/null and b/0.10.4/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 differ diff --git a/0.10.4/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 b/0.10.4/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 new file mode 100644 index 000000000..e766e06cc Binary files /dev/null and b/0.10.4/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 differ diff --git a/0.10.4/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt b/0.10.4/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/0.10.4/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/0.10.4/static.files/LICENSE-MIT-65090b722b3f6c56.txt b/0.10.4/static.files/LICENSE-MIT-65090b722b3f6c56.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/0.10.4/static.files/LICENSE-MIT-65090b722b3f6c56.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/0.10.4/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 b/0.10.4/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 new file mode 100644 index 000000000..1866ad4bc Binary files /dev/null and b/0.10.4/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 differ diff --git a/0.10.4/static.files/NanumBarunGothic-LICENSE-2fe9ce67ec95245d.txt b/0.10.4/static.files/NanumBarunGothic-LICENSE-2fe9ce67ec95245d.txt new file mode 100644 index 000000000..0bf46682b --- /dev/null +++ b/0.10.4/static.files/NanumBarunGothic-LICENSE-2fe9ce67ec95245d.txt @@ -0,0 +1,99 @@ +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.4/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 b/0.10.4/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 new file mode 100644 index 000000000..462c34efc Binary files /dev/null and b/0.10.4/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 differ diff --git a/0.10.4/static.files/SourceCodePro-LICENSE-f554967dca0cf1dd.txt b/0.10.4/static.files/SourceCodePro-LICENSE-f554967dca0cf1dd.txt new file mode 100644 index 000000000..07542572e --- /dev/null +++ b/0.10.4/static.files/SourceCodePro-LICENSE-f554967dca0cf1dd.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.4/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 b/0.10.4/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 new file mode 100644 index 000000000..10b558e0b Binary files /dev/null and b/0.10.4/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 differ diff --git a/0.10.4/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 b/0.10.4/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 new file mode 100644 index 000000000..5ec64eef0 Binary files /dev/null and b/0.10.4/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 differ diff --git a/0.10.4/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 b/0.10.4/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 new file mode 100644 index 000000000..181a07f63 Binary files /dev/null and b/0.10.4/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 differ diff --git a/0.10.4/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 b/0.10.4/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 new file mode 100644 index 000000000..2ae08a7be Binary files /dev/null and b/0.10.4/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 differ diff --git a/0.10.4/static.files/SourceSerif4-LICENSE-971e190366a5901b.md b/0.10.4/static.files/SourceSerif4-LICENSE-971e190366a5901b.md new file mode 100644 index 000000000..5871e1f3d --- /dev/null +++ b/0.10.4/static.files/SourceSerif4-LICENSE-971e190366a5901b.md @@ -0,0 +1,93 @@ +Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.10.4/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 b/0.10.4/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 new file mode 100644 index 000000000..0263fc304 Binary files /dev/null and b/0.10.4/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 differ diff --git a/0.10.4/static.files/ayu-be46fdc453a55015.css b/0.10.4/static.files/ayu-be46fdc453a55015.css new file mode 100644 index 000000000..1cad9034c --- /dev/null +++ b/0.10.4/static.files/ayu-be46fdc453a55015.css @@ -0,0 +1 @@ + :root{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--settings-button-color:#fff;--settings-button-border-focus:#e0e0e0;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;--sidebar-link-color:#53b1db;--sidebar-current-link-background-color:transparent;--search-result-link-focus-background-color:#3c3c3c;--search-result-border-color:#aaa3;--search-color:#fff;--search-error-code-background-color:#4f4c4c;--search-results-alias-color:#c5c5c5;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:none;--search-tab-button-not-selected-background:transparent !important;--search-tab-button-selected-border-top-color:none;--search-tab-button-selected-background:#141920 !important;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ff7733;--code-highlight-kw-2-color:#ff7733;--code-highlight-lifetime-color:#ff7733;--code-highlight-prelude-color:#69f2df;--code-highlight-prelude-val-color:#ff7733;--code-highlight-number-color:#b8cc52;--code-highlight-string-color:#b8cc52;--code-highlight-literal-color:#ff7733;--code-highlight-attribute-color:#e6e1cf;--code-highlight-self-color:#36a3d9;--code-highlight-macro-color:#a37acc;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#788797;--code-highlight-doc-comment-color:#a1ac88;--src-line-numbers-span-color:#5c6773;--src-line-number-highlighted-background-color:rgba(255,236,164,0.06);--test-arrow-color:#788797;--test-arrow-background-color:rgba(57,175,215,0.09);--test-arrow-hover-color:#c5c5c5;--test-arrow-hover-background-color:rgba(57,175,215,0.368);--target-background-color:rgba(255,236,164,0.06);--target-border-color:rgba(255,180,76,0.85);--kbd-color:#c5c5c5;--kbd-background:#314559;--kbd-box-shadow-color:#5c6773;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);--crate-search-div-hover-filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);--crate-search-hover-border:#e0e0e0;--source-sidebar-background-selected:#14191f;--source-sidebar-background-hover:#14191f;--table-alt-row-background-color:#191f26;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:rgb(91,59,1);--scrape-example-code-line-highlight-focus:rgb(124,75,15);--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(15,20,25,1);--scrape-example-code-wrapper-background-end:rgba(15,20,25,0);}h1,h2,h3,h4,h1 a,.sidebar h2 a,.sidebar h3 a,#source-sidebar>.title{color:#fff;}h4{border:none;}.docblock code{color:#ffb454;}.docblock a>code{color:#39AFD7 !important;}.code-header,.docblock pre>code,pre,pre>code,.item-info code,.rustdoc.source .example-wrap{color:#e6e1cf;}.sidebar .current,.sidebar a:hover,#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus,#source-sidebar div.files>a.selected{color:#ffb44c;}.sidebar-elems .location{color:#ff7733;}.src-line-numbers .line-highlighted{color:#708090;padding-right:7px;border-right:1px solid #ffb44c;}.search-results a:hover,.search-results a:focus{color:#fff !important;background-color:#3c3c3c;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}#search-tabs>button.selected{border-bottom:1px solid #ffb44c !important;border-top:none;}#search-tabs>button:not(.selected){border:none;background-color:transparent !important;}#search-tabs>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#settings-menu>a img{filter:invert(100);} \ No newline at end of file diff --git a/0.10.4/static.files/clipboard-7571035ce49a181d.svg b/0.10.4/static.files/clipboard-7571035ce49a181d.svg new file mode 100644 index 000000000..8adbd9963 --- /dev/null +++ b/0.10.4/static.files/clipboard-7571035ce49a181d.svg @@ -0,0 +1 @@ + diff --git a/0.10.4/static.files/dark-cf923f49f397b216.css b/0.10.4/static.files/dark-cf923f49f397b216.css new file mode 100644 index 000000000..70f9f1184 --- /dev/null +++ b/0.10.4/static.files/dark-cf923f49f397b216.css @@ -0,0 +1 @@ +:root{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--source-sidebar-background-selected:#333;--source-sidebar-background-hover:#444;--table-alt-row-background-color:#2A2A2A;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:rgb(91,59,1);--scrape-example-code-line-highlight-focus:rgb(124,75,15);--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);} \ No newline at end of file diff --git a/0.10.4/static.files/favicon-16x16-8b506e7a72182f1c.png b/0.10.4/static.files/favicon-16x16-8b506e7a72182f1c.png new file mode 100644 index 000000000..ea4b45cae Binary files /dev/null and b/0.10.4/static.files/favicon-16x16-8b506e7a72182f1c.png differ diff --git a/0.10.4/static.files/favicon-2c020d218678b618.svg b/0.10.4/static.files/favicon-2c020d218678b618.svg new file mode 100644 index 000000000..8b34b5119 --- /dev/null +++ b/0.10.4/static.files/favicon-2c020d218678b618.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/0.10.4/static.files/favicon-32x32-422f7d1d52889060.png b/0.10.4/static.files/favicon-32x32-422f7d1d52889060.png new file mode 100644 index 000000000..69b8613ce Binary files /dev/null and b/0.10.4/static.files/favicon-32x32-422f7d1d52889060.png differ diff --git a/0.10.4/static.files/light-db279b6232be9c13.css b/0.10.4/static.files/light-db279b6232be9c13.css new file mode 100644 index 000000000..f0080dbe6 --- /dev/null +++ b/0.10.4/static.files/light-db279b6232be9c13.css @@ -0,0 +1 @@ +:root{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#F5F5F5;--sidebar-background-color-hover:#E0E0E0;--code-block-background-color:#F5F5F5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#ffffff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--source-sidebar-background-selected:#fff;--source-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#F5F5F5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);} \ No newline at end of file diff --git a/0.10.4/static.files/main-98a684e84ae5b08b.js b/0.10.4/static.files/main-98a684e84ae5b08b.js new file mode 100644 index 000000000..1a1db3b07 --- /dev/null +++ b/0.10.4/static.files/main-98a684e84ae5b08b.js @@ -0,0 +1,8 @@ +"use strict";function getVar(name){const el=document.getElementById("rustdoc-vars");if(el){return el.attributes["data-"+name].value}else{return null}}function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function elemIsInParent(elem,parent){while(elem&&elem!==document.body){if(elem===parent){return true}elem=elem.parentElement}return false}function blurHandler(event,parentElem,hideCallback){if(!elemIsInParent(document.activeElement,parentElem)&&!elemIsInParent(event.relatedTarget,parentElem)){hideCallback()}}window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");function setMobileTopbar(){const mobileLocationTitle=document.querySelector(".mobile-topbar h2");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileLocationTitle&&locationTitle){mobileLocationTitle.innerHTML=locationTitle.innerHTML}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function loadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="stylesheet";document.getElementsByTagName("head")[0].appendChild(link)}(function(){const isHelpPage=window.location.pathname.endsWith("/help.html");function loadScript(url){const script=document.createElement("script");script.src=url;document.head.append(script)}getSettingsButton().onclick=event=>{if(event.ctrlKey||event.altKey||event.metaKey){return}window.hideAllModals(false);addClass(getSettingsButton(),"rotate");event.preventDefault();loadCss(getVar("static-root-path")+getVar("settings-css"));loadScript(getVar("static-root-path")+getVar("settings-js"))};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},hideResults:()=>{switchDisplayedElement(null);document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(getVar("static-root-path")+getVar("search-js"));loadScript(resourcePath("search-index",".js"))}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){searchState.setLoadingSearch();loadSearch()}},setLoadingSearch:()=>{const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search)},};function getPageId(){if(window.location.hash){const tmp=window.location.hash.replace(/^#/,"");if(tmp.length>0){return tmp}}return null}const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}if(savedHash!==window.location.hash){savedHash=window.location.hash;if(savedHash.length===0){return}expandSection(savedHash.slice(1))}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();switchDisplayedElement(null);if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}ev.preventDefault();searchState.defocus();window.hideAllModals(true)}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"&&document.activeElement.type!=="radio"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":ev.preventDefault();searchState.focus();break;case"+":ev.preventDefault();expandAllDocs();break;case"-":ev.preventDefault();collapseAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const h3=document.createElement("h3");h3.innerHTML=`${longty}`;const ul=document.createElement("ul");ul.className="block "+shortty;for(const name of filtered){let path;if(shortty==="mod"){path=name+"/index.html"}else{path=shortty+"."+name+".html"}const current_page=document.location.href.split("/").pop();const link=document.createElement("a");link.href=path;if(path===current_page){link.className="current"}link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebar.appendChild(h3);sidebar.appendChild(ul)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("union","unions","Unions");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Definitions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector(".main-heading h1 > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=script?script.getAttribute("data-ignore-extern-crates"):"";for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.indexOf(lib)!==-1){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const h3=document.createElement("h3");h3.innerHTML="Crates";const ul=document.createElement("ul");ul.className="block crate";for(const crate of window.ALL_CRATES){const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";if(window.rootPath!=="./"&&crate===window.currentCrate){link.className="current"}link.textContent=crate;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(h3);sidebarElems.appendChild(ul)}function expandAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hasClass(e,"type-contents-toggle")&&!hasClass(e,"more-examples-toggle")){e.open=true}});innerToggle.title="collapse all docs";innerToggle.children[0].innerText="\u2212"}function collapseAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});innerToggle.title="expand all docs";innerToggle.children[0].innerText="+"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}if(hasClass(innerToggle,"will-expand")){expandAllDocs()}else{collapseAllDocs()}}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}});const pageId=getPageId();if(pageId!==null){expandSection(pageId)}}());window.rustdoc_add_line_numbers_to_examples=()=>{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");if(line_numbers.length>0){return}const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");for(const node of line_numbers){parent.removeChild(node)}})};if(getSettingValue("line-numbers")==="true"){window.rustdoc_add_line_numbers_to_examples()}let oldSidebarScrollPosition=null;window.rustdocMobileScrollLock=function(){const mobile_topbar=document.querySelector(".mobile-topbar");if(window.innerWidth<=window.RUSTDOC_MOBILE_BREAKPOINT){oldSidebarScrollPosition=window.scrollY;document.body.style.width=`${document.body.offsetWidth}px`;document.body.style.position="fixed";document.body.style.top=`-${oldSidebarScrollPosition}px`;if(mobile_topbar){mobile_topbar.style.top=`${oldSidebarScrollPosition}px`;mobile_topbar.style.position="relative"}}else{oldSidebarScrollPosition=null}};window.rustdocMobileScrollUnlock=function(){const mobile_topbar=document.querySelector(".mobile-topbar");if(oldSidebarScrollPosition!==null){document.body.style.width="";document.body.style.position="";document.body.style.top="";if(mobile_topbar){mobile_topbar.style.top="";mobile_topbar.style.position=""}window.scrollTo(0,oldSidebarScrollPosition);oldSidebarScrollPosition=null}};function showSidebar(){window.hideAllModals(false);window.rustdocMobileScrollLock();const sidebar=document.getElementsByClassName("sidebar")[0];addClass(sidebar,"shown")}function hideSidebar(){window.rustdocMobileScrollUnlock();const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}window.addEventListener("resize",()=>{if(window.innerWidth>window.RUSTDOC_MOBILE_BREAKPOINT&&oldSidebarScrollPosition!==null){hideSidebar()}if(window.CURRENT_TOOLTIP_ELEMENT){const base=window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE;const force_visible=base.TOOLTIP_FORCE_VISIBLE;hideTooltip(false);if(force_visible){showTooltip(base);base.TOOLTIP_FORCE_VISIBLE=true}}});const mainElem=document.getElementById(MAIN_ID);if(mainElem){mainElem.addEventListener("click",hideSidebar)}onEachLazy(document.querySelectorAll("a[href^='#']"),el=>{el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})});onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});function showTooltip(e){const notable_ty=e.getAttribute("data-notable-ty");if(!window.NOTABLE_TRAITS&¬able_ty){const data=document.getElementById("notable-traits-data");if(data){window.NOTABLE_TRAITS=JSON.parse(data.innerText)}else{throw new Error("showTooltip() called with notable without any notable traits!")}}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE===e){return}window.hideAllModals(false);const wrapper=document.createElement("div");if(notable_ty){wrapper.innerHTML="
"+window.NOTABLE_TRAITS[notable_ty]+"
"}else if(e.getAttribute("title")!==undefined){const titleContent=document.createElement("div");titleContent.className="content";titleContent.appendChild(document.createTextNode(e.getAttribute("title")));wrapper.appendChild(titleContent)}wrapper.className="tooltip popover";const focusCatcher=document.createElement("div");focusCatcher.setAttribute("tabindex","0");focusCatcher.onfocus=hideTooltip;wrapper.appendChild(focusCatcher);const pos=e.getBoundingClientRect();wrapper.style.top=(pos.top+window.scrollY+pos.height)+"px";wrapper.style.left=0;wrapper.style.right="auto";wrapper.style.visibility="hidden";const body=document.getElementsByTagName("body")[0];body.appendChild(wrapper);const wrapperPos=wrapper.getBoundingClientRect();const finalPos=pos.left+window.scrollX-wrapperPos.width+24;if(finalPos>0){wrapper.style.left=finalPos+"px"}else{wrapper.style.setProperty("--popover-arrow-offset",(wrapperPos.right-pos.right+4)+"px")}wrapper.style.visibility="";window.CURRENT_TOOLTIP_ELEMENT=wrapper;window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE=e;wrapper.onpointerleave=function(ev){if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!elemIsInParent(event.relatedTarget,e)){hideTooltip(true)}}}function tooltipBlurHandler(event){if(window.CURRENT_TOOLTIP_ELEMENT&&!elemIsInParent(document.activeElement,window.CURRENT_TOOLTIP_ELEMENT)&&!elemIsInParent(event.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT)&&!elemIsInParent(document.activeElement,window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)&&!elemIsInParent(event.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)){setTimeout(()=>hideTooltip(false),0)}}function hideTooltip(focus){if(window.CURRENT_TOOLTIP_ELEMENT){if(window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE){if(focus){window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.focus()}window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE=false}const body=document.getElementsByTagName("body")[0];body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);window.CURRENT_TOOLTIP_ELEMENT=null}}onEachLazy(document.getElementsByClassName("tooltip"),e=>{e.onclick=function(){this.TOOLTIP_FORCE_VISIBLE=this.TOOLTIP_FORCE_VISIBLE?false:true;if(window.CURRENT_TOOLTIP_ELEMENT&&!this.TOOLTIP_FORCE_VISIBLE){hideTooltip(true)}else{showTooltip(this);window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex","0");window.CURRENT_TOOLTIP_ELEMENT.focus();window.CURRENT_TOOLTIP_ELEMENT.onblur=tooltipBlurHandler}return false};e.onpointerenter=function(ev){if(ev.pointerType!=="mouse"){return}showTooltip(this)};e.onpointerleave=function(ev){if(ev.pointerType!=="mouse"){return}if(!this.TOOLTIP_FORCE_VISIBLE&&!elemIsInParent(ev.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT)){hideTooltip(true)}}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar()}else{hideSidebar()}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");book_info.className="top";book_info.innerHTML="You can find more information in \ + the rustdoc book.";const shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=["Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + -> vec)","Search multiple things at once by splitting your query with comma (e.g., \ + str,u8 or String,struct:Vec,test)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);const container=document.createElement("div");if(!isHelpPage){container.className="popover"}container.id="help";container.style.display="none";const side_by_side=document.createElement("div");side_by_side.className="side-by-side";side_by_side.appendChild(div_shortcuts);side_by_side.appendChild(div_infos);container.appendChild(book_info);container.appendChild(side_by_side);container.appendChild(rustdoc_version);if(isHelpPage){const help_section=document.createElement("section");help_section.appendChild(container);document.getElementById("main-content").appendChild(help_section);container.style.display="block"}else{const help_button=getHelpButton();help_button.appendChild(container);container.onblur=helpBlurHandler;help_button.onblur=helpBlurHandler;help_button.children[0].onblur=helpBlurHandler}return container}window.hideAllModals=function(switchFocus){hideSidebar();window.hidePopoverMenus();hideTooltip(switchFocus)};window.hidePopoverMenus=function(){onEachLazy(document.querySelectorAll(".search-form .popover"),elem=>{elem.style.display="none"})};function getHelpMenu(buildNeeded){let menu=getHelpButton().querySelector(".popover");if(!menu&&buildNeeded){menu=buildHelpMenu()}return menu}function showHelp(){getHelpButton().querySelector("a").focus();const menu=getHelpMenu(true);if(menu.style.display==="none"){window.hideAllModals();menu.style.display=""}}if(isHelpPage){showHelp();document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault()})}else{document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault();const menu=getHelpMenu(true);const shouldShowHelp=menu.style.display==="none";if(shouldShowHelp){showHelp()}else{window.hidePopoverMenus()}})}setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){let reset_button_timeout=null;const but=document.getElementById("copy-path");if(!but){return}but.onclick=()=>{const parent=but.parentElement;const path=[];onEach(parent.childNodes,child=>{if(child.tagName==="A"){path.push(child.textContent)}});const el=document.createElement("textarea");el.value=path.join("::");el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);but.children[0].style.display="none";let tmp;if(but.childNodes.length<2){tmp=document.createTextNode("✓");but.appendChild(tmp)}else{onEachLazy(but.childNodes,e=>{if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent="✓"}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent="";reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/0.10.4/static.files/normalize-76eba96aa4d2e634.css b/0.10.4/static.files/normalize-76eba96aa4d2e634.css new file mode 100644 index 000000000..469959f13 --- /dev/null +++ b/0.10.4/static.files/normalize-76eba96aa4d2e634.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/0.10.4/static.files/noscript-13285aec31fa243e.css b/0.10.4/static.files/noscript-13285aec31fa243e.css new file mode 100644 index 000000000..c32e0cb13 --- /dev/null +++ b/0.10.4/static.files/noscript-13285aec31fa243e.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path{display:none;}nav.sub{display:none;}.source .sidebar{display:none;}.notable-traits{display:none;} \ No newline at end of file diff --git a/0.10.4/static.files/rust-logo-151179464ae7ed46.svg b/0.10.4/static.files/rust-logo-151179464ae7ed46.svg new file mode 100644 index 000000000..62424d8ff --- /dev/null +++ b/0.10.4/static.files/rust-logo-151179464ae7ed46.svg @@ -0,0 +1,61 @@ + + + diff --git a/0.10.4/static.files/rustdoc-c4dbdcde0fbd8430.css b/0.10.4/static.files/rustdoc-c4dbdcde0fbd8430.css new file mode 100644 index 000000000..afd98f0e4 --- /dev/null +++ b/0.10.4/static.files/rustdoc-c4dbdcde0fbd8430.css @@ -0,0 +1,8 @@ + @font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{box-sizing:border-box;}html{content:"";}@media (prefers-color-scheme:light){html{content:"light";}}@media (prefers-color-scheme:dark){html{content:"dark";}}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:25px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}.docblock>h2:first-child,.docblock>h3:first-child,.docblock>h4:first-child,.docblock>h5:first-child,.docblock>h6:first-child{margin-top:0;}.main-heading h1{margin:0;padding:0;flex-grow:1;overflow-wrap:break-word;overflow-wrap:anywhere;}.main-heading{display:flex;flex-wrap:wrap;padding-bottom:6px;margin-bottom:15px;}.content h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h1,h2{line-height:1.25;padding-top:3px;padding-bottom:9px;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;margin:0;padding:0;white-space:pre-wrap;}#crate-search,h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,.search-input,.search-results .result-name,.item-name>a,.out-of-band,span.since,a.srclink,#help-button>a,summary.hideme,.scraped-example-list,ul.all-items{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,pre.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,h1 a,.search-results a,.stab,.result-name .primitive>i,.result-name .keyword>i{color:var(--main-color);}.content span.enum,.content a.enum,.content span.struct,.content a.struct,.content span.union,.content a.union,.content span.primitive,.content a.primitive,.content span.type,.content a.type,.content span.foreigntype,.content a.foreigntype{color:var(--type-link-color);}.content span.trait,.content a.trait,.content span.traitalias,.content a.traitalias{color:var(--trait-link-color);}.content span.associatedtype,.content a.associatedtype,.content span.constant,.content a.constant,.content span.static,.content a.static{color:var(--assoc-item-link-color);}.content span.fn,.content a.fn,.content span.method,.content a.method,.content span.tymethod,.content a.tymethod{color:var(--function-link-color);}.content span.attr,.content a.attr,.content span.derive,.content a.derive,.content span.macro,.content a.macro{color:var(--macro-link-color);}.content span.mod,.content a.mod{color:var(--mod-link-color);}.content span.keyword,.content a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);text-decoration:none;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p{margin:0 0 .75em 0;}p:last-child{margin:0;}button{padding:1px 6px;cursor:pointer;}button#toggle-all-docs{padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.source main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}details:not(.toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;line-height:1.5;}pre.item-decl{overflow-x:auto;}.item-decl .type-contents-toggle{contain:initial;}.source .content pre{padding:20px;}.rustdoc.source .example-wrap>pre.src-line-numbers{padding:20px 0 20px 4px;}img{max-width:100%;}.sub-logo-container,.logo-container{line-height:0;display:block;}.sub-logo-container{margin-right:32px;}.sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.rust-logo{filter:var(--rust-logo-filter);}.sidebar{font-size:0.875rem;flex:0 0 200px;overflow-y:scroll;position:sticky;height:100vh;top:0;left:0;}.rustdoc.source .sidebar{flex-basis:50px;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;}.sidebar,.mobile-topbar,.sidebar-menu-toggle,#src-sidebar-toggle,#source-sidebar{background-color:var(--sidebar-background-color);}#src-sidebar-toggle>button:hover,#src-sidebar-toggle>button:focus{background-color:var(--sidebar-background-color-hover);}.source .sidebar>*:not(#src-sidebar-toggle){visibility:hidden;}.source-sidebar-expanded .source .sidebar{overflow-y:auto;flex-basis:300px;}.source-sidebar-expanded .source .sidebar>*:not(#src-sidebar-toggle){visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.sidebar .logo-container{margin-top:10px;margin-bottom:10px;text-align:center;}.version{overflow-wrap:break-word;}.logo-container>img{height:100px;width:100px;}ul.block,.block li{padding:0;margin:0;list-style:none;}.sidebar-elems a,.sidebar>h2 a{display:block;padding:0.25rem;margin-left:-0.25rem;}.sidebar h2{overflow-wrap:anywhere;padding:0;margin:0.7rem 0;}.sidebar h3{font-size:1.125rem;padding:0;margin:0;}.sidebar-elems,.sidebar>h2{padding-left:24px;}.sidebar a{color:var(--sidebar-link-color);}.sidebar .current,.sidebar a:hover:not(.logo-container){background-color:var(--sidebar-current-link-background-color);}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.mobile-topbar{display:none;}.rustdoc .example-wrap{display:flex;position:relative;margin-bottom:10px;}.rustdoc .example-wrap:last-child{margin-bottom:0px;}.rustdoc .example-wrap>pre{margin:0;flex-grow:1;overflow:auto hidden;}.rustdoc .example-wrap>pre.example-line-numbers,.rustdoc .example-wrap>pre.src-line-numbers{flex-grow:0;min-width:fit-content;overflow:initial;text-align:right;-webkit-user-select:none;user-select:none;padding:14px 8px;color:var(--src-line-numbers-span-color);}.rustdoc .example-wrap>pre.src-line-numbers{padding:14px 0;}.src-line-numbers a,.src-line-numbers span{color:var(--src-line-numbers-span-color);padding:0 8px;}.src-line-numbers :target{background-color:transparent;border-right:none;padding:0 8px;}.src-line-numbers .line-highlighted{background-color:var(--src-line-number-highlighted-background-color);}.search-loading{text-align:center;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock :not(pre)>code,.docblock-short code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.out-of-band{flex-grow:0;font-size:1.125rem;}.docblock code,.docblock-short code,pre,.rustdoc.source .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}.docblock table{margin:.5em 0;border-collapse:collapse;}.docblock table td,.docblock table th{padding:.5em;border:1px solid var(--border-color);}.docblock table tbody tr:nth-child(2n){background:var(--table-alt-row-background-color);}.method .where,.fn .where,.where.fmt-newline{display:block;white-space:pre-wrap;font-size:0.875rem;}.item-info{display:block;margin-left:24px;}.item-info code{font-size:0.875rem;}#main-content>.item-info{margin-left:0;}nav.sub{flex-grow:1;flex-flow:row nowrap;margin:4px 0 25px 0;display:flex;align-items:center;}.search-form{position:relative;display:flex;height:34px;flex-grow:1;}.source nav.sub{margin:0 0 15px 0;}.small-section-header{display:block;position:relative;}.small-section-header:hover>.anchor,.impl:hover>.anchor,.trait-impl:hover>.anchor,.variant:hover>.anchor{display:initial;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.main-heading a:hover,.example-wrap>pre.rust a:hover,.all-items a:hover,.docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.item-info a{text-decoration:underline;}.crate.block a.current{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;padding:0;margin:0;}.item-table>li{display:table-row;}.item-table>li>div{display:table-cell;}.item-table>li>.item-name{padding-right:1.25rem;}.search-results-title{margin-top:0;white-space:nowrap;display:flex;align-items:baseline;}#crate-search-div{position:relative;min-width:5em;}#crate-search{min-width:115px;padding:0 23px 0 4px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);color:inherit;line-height:1.5;font-weight:500;}#crate-search:hover,#crate-search:focus{border-color:var(--crate-search-hover-border);}@-moz-document url-prefix(){#crate-search{padding-left:0px;padding-right:19px;}}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url('data:image/svg+xml, \ + ');filter:var(--crate-search-div-filter);}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:var(--crate-search-div-hover-filter);}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;flex-grow:1;background-color:var(--button-background-color);color:var(--search-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;}.search-results.active{display:block;}.search-results>a{display:flex;margin-left:2px;margin-right:2px;border-bottom:1px solid var(--search-result-border-color);gap:1em;}.search-results>a>div{flex:1;}.search-results>a>div.desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.search-results a:hover,.search-results a:focus{background-color:var(--search-result-link-focus-background-color);}.search-results .result-name span.alias{color:var(--search-results-alias-color);}.search-results .result-name span.grey{color:var(--search-results-grey-color);}.popover{position:absolute;top:100%;right:0;z-index:2;margin-top:7px;border-radius:3px;border:1px solid var(--border-color);background-color:var(--main-background-color);color:var(--main-color);--popover-arrow-offset:11px;}.popover::before{content:'';position:absolute;right:var(--popover-arrow-offset);border:solid var(--border-color);border-width:1px 1px 0 0;background-color:var(--main-background-color);padding:4px;transform:rotate(-45deg);top:-5px;}#help.popover{max-width:600px;--popover-arrow-offset:48px;}#help dt{float:left;clear:left;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{min-height:36px;display:flex;padding:3px;margin-bottom:5px;}.item-name .stab{margin-left:0.3125em;}.stab{padding:0 2px;font-size:0.875rem;font-weight:normal;color:var(--main-color);background-color:var(--stab-background-color);width:fit-content;align-items:center;white-space:pre-wrap;border-radius:3px;display:inline-flex;vertical-align:text-bottom;}.stab.portability>code{background:none;color:var(--stab-code-color);}.stab .emoji{font-size:1.25rem;margin-right:0.3rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;float:right;}.rightside:not(a),.out-of-band{color:var(--right-side-color);}pre.rust{tab-size:4;-moz-tab-size:4;}pre.rust .kw{color:var(--code-highlight-kw-color);}pre.rust .kw-2{color:var(--code-highlight-kw-2-color);}pre.rust .lifetime{color:var(--code-highlight-lifetime-color);}pre.rust .prelude-ty{color:var(--code-highlight-prelude-color);}pre.rust .prelude-val{color:var(--code-highlight-prelude-val-color);}pre.rust .string{color:var(--code-highlight-string-color);}pre.rust .number{color:var(--code-highlight-number-color);}pre.rust .bool-val{color:var(--code-highlight-literal-color);}pre.rust .self{color:var(--code-highlight-self-color);}pre.rust .attr{color:var(--code-highlight-attribute-color);}pre.rust .macro,pre.rust .macro-nonterminal{color:var(--code-highlight-macro-color);}pre.rust .question-mark{font-weight:bold;color:var(--code-highlight-question-mark-color);}pre.rust .comment{color:var(--code-highlight-comment-color);}pre.rust .doccomment{color:var(--code-highlight-doc-comment-color);}.rustdoc.source .example-wrap pre.rust a{background:var(--codeblock-link-background);}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;left:-25px;top:5px;margin:0;line-height:1;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}a.test-arrow{visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;color:var(--test-arrow-color);background-color:var(--test-arrow-background-color);}a.test-arrow:hover{color:var(--test-arrow-hover-color);background-color:var(--test-arrow-hover-background-color);}.example-wrap:hover .test-arrow{visibility:visible;}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;display:block;}.out-of-band>span.since{font-size:1.25rem;}.sub-variant h4{font-size:1rem;font-weight:400;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}:target{padding-right:3px;background-color:var(--target-background-color);border-right:3px solid var(--target-border-color);}.code-header a.tooltip{color:inherit;margin-right:15px;position:relative;}a.tooltip:hover::after{position:absolute;top:calc(100% - 10px);left:-15px;right:-15px;height:20px;content:"\00a0";}.popover.tooltip .content{margin:0.25em 0.5em;}.popover.tooltip .content pre,.popover.tooltip .content code{background:transparent;margin:0;padding:0;font-size:1.25rem;white-space:pre-wrap;}.popover.tooltip .content>h3:first-child{margin:0 0 5px 0;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#search-tabs{display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#search-tabs button{text-align:center;font-size:1.125rem;border:0;border-top:2px solid;flex:1;line-height:1.5;color:inherit;}#search-tabs button:not(.selected){background-color:var(--search-tab-button-not-selected-background);border-top-color:var(--search-tab-button-not-selected-border-top-color);}#search-tabs button:hover,#search-tabs button.selected{background-color:var(--search-tab-button-selected-background);border-top-color:var(--search-tab-button-selected-border-top-color);}#search-tabs .count{font-size:1rem;color:var(--search-tab-title-count-color);}#search .error code{border-radius:3px;background-color:var(--search-error-code-background-color);}#src-sidebar-toggle{position:sticky;top:0;left:0;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:stretch;align-items:stretch;z-index:10;}#source-sidebar{width:100%;overflow:auto;}#source-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid var(--border-color);margin-bottom:6px;}#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:var(--source-sidebar-background-hover);}#source-sidebar div.files>a.selected{background-color:var(--source-sidebar-background-selected);}#src-sidebar-toggle>button{font-size:inherit;font-weight:bold;background:none;color:inherit;text-align:center;border:none;outline:none;flex:1 1;-webkit-appearance:none;opacity:1;}#settings-menu,#help-button{margin-left:4px;display:flex;}#settings-menu>a,#help-button>a{display:flex;align-items:center;justify-content:center;background-color:var(--button-background-color);border:1px solid var(--border-color);border-radius:2px;color:var(--settings-button-color);font-size:20px;width:33px;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>a:hover,#help-button>a:focus{border-color:var(--settings-button-border-focus);}#copy-path{color:var(--copy-path-button-color);background:var(--main-background-color);height:34px;margin-left:10px;padding:0;padding-left:2px;border:0;width:33px;}#copy-path>img{filter:var(--copy-path-img-filter);}#copy-path:hover>img{filter:var(--copy-path-img-hover-filter);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;color:var(--kbd-color);background-color:var(--kbd-background);box-shadow:inset 0 -1px 0 var(--kbd-box-shadow-color);}ul.all-items>li{list-style:none;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 -4px;padding:0 0 0 4px;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.toggle{contain:layout;position:relative;}details.toggle>summary.hideme{cursor:pointer;font-size:1rem;}details.toggle>summary{list-style:none;outline:none;}details.toggle>summary::-webkit-details-marker,details.toggle>summary::marker{display:none;}details.toggle>summary.hideme>span{margin-left:9px;}details.toggle>summary::before{background:url('data:image/svg+xml,') no-repeat top left;content:"";cursor:pointer;width:16px;height:16px;display:inline-block;vertical-align:middle;opacity:.5;filter:var(--toggle-filter);}details.toggle>summary.hideme>span,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.toggle>summary.hideme::after{content:"";}details.toggle>summary:focus::before,details.toggle>summary:hover::before{opacity:1;}details.toggle>summary:focus-visible::before{outline:1px dotted #000;outline-offset:1px;}details.non-exhaustive{margin-bottom:8px;}details.toggle>summary.hideme::before{position:relative;}details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.toggle[open] >summary.hideme{position:absolute;}details.toggle[open] >summary.hideme>span{display:none;}details.toggle[open] >summary::before{background:url('data:image/svg+xml,') no-repeat top left;}details.toggle[open] >summary::after{content:"Collapse";}.docblock summary>*{display:inline-block;}.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{display:block;}main{padding-left:15px;padding-top:0px;}.main-heading{flex-direction:column;}.out-of-band{text-align:left;margin-left:initial;padding:initial;}.out-of-band .since::before{content:"Since ";}.sidebar .logo-container,.sidebar .location{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;z-index:11;height:calc(100vh - 45px);width:200px;}.source main,.rustdoc.source .sidebar{top:0;padding:0;height:100vh;border:0;}.sidebar.shown,.source-sidebar-expanded .source .sidebar,.rustdoc:not(.source) .sidebar:focus-within{left:0;}.mobile-topbar h2{padding-bottom:0;margin:auto 0.5em auto auto;overflow:hidden;font-size:24px;}.mobile-topbar h2 a{display:block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin:5px 0 5px 20px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;color:var(--main-color);}.sidebar-elems{margin-top:1em;}.anchor{display:none !important;}#search-tabs .count{display:block;}#main-content>details.toggle>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}#src-sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;border:1px solid;border-left:0;}.source-sidebar-expanded #src-sidebar-toggle{left:unset;top:unset;width:unset;border-top-right-radius:unset;border-bottom-right-radius:unset;position:sticky;border:0;border-bottom:1px solid;}#copy-path,#help-button{display:none;}.item-table,.item-row,.item-table>li,.item-table>li>div,.search-results>a,.search-results>a>div{display:block;}.search-results>a{padding:5px 0px;}.search-results>a>div.desc,.item-table>li>div.desc{padding-left:2em;}.source-sidebar-expanded .source .sidebar{max-width:100vw;width:100vw;}details.toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>details.toggle:not(.top-doc)>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}.impl-items>.item-info{margin-left:34px;}.source nav.sub{margin:0;padding:8px;}}@media (min-width:701px){.scraped-example-title{position:absolute;z-index:10;background:var(--main-background-color);bottom:8px;right:5px;padding:2px 4px;box-shadow:0 0 4px var(--main-background-color);}}@media print{nav.sidebar,nav.sub,.out-of-band,a.srclink,#copy-path,details.toggle[open] >summary::before,details.toggle>summary::before,details.toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}nav.sub{flex-direction:column;}.search-form{align-self:stretch;}.sub-logo-container>img{height:35px;width:35px;}}.variant,.implementors-toggle>summary,.impl,#implementors-list>.docblock,.impl-items>section,.impl-items>.toggle>summary,.methods>section,.methods>.toggle>summary{margin-bottom:0.75em;}.variants>.docblock,.implementors-toggle>.docblock,.impl-items>.toggle[open]:not(:last-child),.methods>.toggle[open]:not(:last-child),.implementors-toggle[open]:not(:last-child){margin-bottom:2em;}#trait-implementations-list .impl-items>.toggle:not(:last-child),#synthetic-implementations-list .impl-items>.toggle:not(:last-child),#blanket-implementations-list .impl-items>.toggle:not(:last-child){margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;border:1px solid var(--scrape-example-help-border-color);border-radius:50px;color:var(--scrape-example-help-color);}.scraped-example-list .scrape-help:hover{border-color:var(--scrape-example-help-hover-border-color);color:var(--scrape-example-help-hover-color);}.scraped-example{position:relative;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:calc(1.5em * 5 + 10px);}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;padding-bottom:0;max-height:calc(1.5em * 5 + 10px);}.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre{max-height:calc(1.5em * 10 + 10px);}.scraped-example .code-wrapper .next,.scraped-example .code-wrapper .prev,.scraped-example .code-wrapper .expand{color:var(--main-color);position:absolute;top:0.25em;z-index:1;padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.scraped-example .code-wrapper .prev{right:2.25em;}.scraped-example .code-wrapper .next{right:1.25em;}.scraped-example .code-wrapper .expand{right:0.25em;}.scraped-example:not(.expanded) .code-wrapper::before,.scraped-example:not(.expanded) .code-wrapper::after{content:" ";width:100%;height:5px;position:absolute;z-index:1;}.scraped-example:not(.expanded) .code-wrapper::before{top:0;background:linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded) .code-wrapper::after{bottom:0;background:linear-gradient(to top,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example .code-wrapper .example-wrap{width:100%;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .example-wrap .rust span.highlight{background:var(--scrape-example-code-line-highlight);}.scraped-example .example-wrap .rust span.highlight.focus{background:var(--scrape-example-code-line-highlight-focus);}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;cursor:pointer;}.more-scraped-examples{margin-left:25px;position:relative;}.toggle-line{position:absolute;top:5px;bottom:0;right:calc(100% + 10px);padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;background:var(--scrape-example-toggle-line-background);}.toggle-line:hover .toggle-line-inner{background:var(--scrape-example-toggle-line-hover-background);}.more-scraped-examples .scraped-example,.example-links{margin-top:20px;}.more-scraped-examples .scraped-example:first-child{margin-top:5px;}.example-links ul{margin-bottom:0;} \ No newline at end of file diff --git a/0.10.4/static.files/scrape-examples-ef1e698c1d417c0c.js b/0.10.4/static.files/scrape-examples-ef1e698c1d417c0c.js new file mode 100644 index 000000000..ba830e374 --- /dev/null +++ b/0.10.4/static.files/scrape-examples-ef1e698c1d417c0c.js @@ -0,0 +1 @@ +"use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelector(".src-line-numbers");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines.children[line].offsetTop}else{const wrapper=elt.querySelector(".code-wrapper");const halfHeight=wrapper.offsetHeight/2;const offsetTop=lines.children[loc[0]].offsetTop;const lastLine=lines.children[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight}lines.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset)}function updateScrapedExample(example,isHidden){const locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");if(locs.length>1){const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title};example.querySelector(".prev").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length})});example.querySelector(".next").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length})})}const expandButton=example.querySelector(".expand");if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");scrollToLoc(example,locs[0][0],isHidden)}else{addClass(example,"expanded")}})}scrollToLoc(example,locs[0][0],isHidden)}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>updateScrapedExample(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false})});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>updateScrapedExample(el,true))})},{once:true})})})() \ No newline at end of file diff --git a/0.10.4/static.files/search-8a59a8356673ec1f.js b/0.10.4/static.files/search-8a59a8356673ec1f.js new file mode 100644 index 000000000..c8963b3b5 --- /dev/null +++ b/0.10.4/static.files/search-8a59a8356673ec1f.js @@ -0,0 +1 @@ +"use strict";(function(){const itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias",];const TY_PRIMITIVE=itemTypes.indexOf("primitive");const TY_KEYWORD=itemTypes.indexOf("keyword");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";function hasOwnPropertyRustdoc(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("search-tabs").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb}else if(nb!==0){printTab(0)}}const levenshtein_row2=[];function levenshtein(s1,s2){if(s1===s2){return 0}const s1_len=s1.length,s2_len=s2.length;if(s1_len&&s2_len){let i1=0,i2=0,a,b,c,c2;const row=levenshtein_row2;while(i1-".indexOf(c)!==-1}function isStopCharacter(c){return isWhitespace(c)||isEndCharacter(c)}function isErrorCharacter(c){return"()".indexOf(c)!==-1}function itemTypeFromName(typename){const index=itemTypes.findIndex(i=>i===typename);if(index<0){throw["Unknown type filter ",typename]}return index}function getStringElem(query,parserState,isInGenerics){if(isInGenerics){throw["Unexpected ","\""," in generics"]}else if(query.literalSearch){throw["Cannot have more than one literal search element"]}else if(parserState.totalElems-parserState.genericsElems>0){throw["Cannot use literal search when there is more than one element"]}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw["Unclosed ","\""]}else if(parserState.userQuery[end]!=="\""){throw["Unexpected ",parserState.userQuery[end]," in a string element"]}else if(start===end){throw["Cannot have empty string element"]}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","||isWhitespaceCharacter(c)}function isWhitespaceCharacter(c){return c===" "||c==="\t"}function createQueryElement(query,parserState,name,generics,isInGenerics){if(name==="*"||(name.length===0&&generics.length===0)){return}if(query.literalSearch&&parserState.totalElems-parserState.genericsElems>0){throw["You cannot have more than one element if you use quotes"]}const pathSegments=name.split("::");if(pathSegments.length>1){for(let i=0,len=pathSegments.length;i=end){throw["Found generics without a path"]}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}if(start>=end&&generics.length===0){return}elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;while(parserState.pos"){extra="<"}else if(endChar===""){extra="->"}else{extra=endChar}throw["Unexpected ",c," after ",extra]}if(!foundStopChar){if(endChar!==""){throw["Expected ",",",", "," "," or ",endChar,", found ",c,]}throw["Expected ",","," or "," ",", found ",c,]}const posBefore=parserState.pos;getNextElem(query,parserState,elems,endChar===">");if(endChar!==""){if(parserState.pos>=parserState.length){throw["Unclosed ","<"]}const c2=parserState.userQuery[parserState.pos];if(!isSeparatorCharacter(c2)&&c2!==endChar){throw["Expected ",endChar,", found ",c2]}}if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}if(parserState.pos>=parserState.length&&endChar!==""){throw["Unclosed ","<"]}parserState.pos+=1}function checkExtraTypeFilterCharacters(parserState){const query=parserState.userQuery;for(let pos=0;pos"){if(isReturnArrow(parserState)){break}throw["Unexpected ",c," (did you mean ","->","?)"]}throw["Unexpected ",c]}else if(c===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw["Unexpected ",":"]}if(query.elems.length===0){throw["Expected type filter before ",":"]}else if(query.elems.length!==1||parserState.totalElems!==1){throw["Unexpected ",":"]}else if(query.literalSearch){throw["You cannot use quotes on type filter"]}checkExtraTypeFilterCharacters(parserState);parserState.typeFilter=query.elems.pop().name;parserState.pos+=1;parserState.totalElems=0;query.literalSearch=false;foundStopChar=true;continue}if(!foundStopChar){if(parserState.typeFilter!==null){throw["Expected ",",",", "," "," or ","->",", found ",c,]}throw["Expected ",",",", "," ",", ",":"," or ","->",", found ",c,]}const before=query.elems.length;getNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}while(parserState.pos"]}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),typeFilter:NO_TYPE_FILTER,elems:[],returned:[],foundElems:0,literalSearch:false,error:null,}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return null}function parseQuery(userQuery){userQuery=userQuery.trim();const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);if(parserState.typeFilter!==null){let typeFilter=parserState.typeFilter;if(typeFilter==="const"){typeFilter="constant"}query.typeFilter=itemTypeFromName(typeFilter)}}catch(err){query=newParsedQuery(userQuery);query.error=err;query.typeFilter=-1;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,searchWords,filterCrates,currentCrate){const results_others={},results_in_args={},results_returned={};function transformResults(results){const duplicates={};const out=[];for(const result of results){if(result.id>-1){const obj=searchIndex[result.id];obj.lev=result.lev;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates[obj.fullPath]){continue}duplicates[obj.fullPath]=true;obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){const userQuery=parsedQuery.userQuery;const ar=[];for(const entry in results){if(hasOwnPropertyRustdoc(results,entry)){const result=results[entry];result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};ar.push(result)}}results=ar;if(results.length===0){return[]}results.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.path_lev;b=bbb.path_lev;if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}a=(aaa.lev);b=(bbb.lev);if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});let nameSplit=null;if(parsedQuery.elems.length===1){const hasPath=typeof parsedQuery.elems[0].path==="undefined";nameSplit=hasPath?null:parsedQuery.elems[0].path}for(const result of results){if(result.dontValidate){continue}const name=result.item.name.toLowerCase(),path=result.item.path.toLowerCase(),parent=result.item.parent;if(!isType&&!validateResult(name,path,nameSplit,parent)){result.id=-1}}return transformResults(results)}function checkGenerics(row,elem,defaultLev,maxLevDistance){if(row.generics.length===0){return elem.generics.length===0?defaultLev:maxLevDistance+1}else if(row.generics.length>0&&row.generics[0].name===null){return checkGenerics(row.generics[0],elem,defaultLev,maxLevDistance)}let elem_name;if(elem.generics.length>0&&row.generics.length>=elem.generics.length){const elems=Object.create(null);for(const entry of row.generics){elem_name=entry.name;if(elem_name===""){if(checkGenerics(entry,elem,maxLevDistance+1,maxLevDistance)!==0){return maxLevDistance+1}continue}if(elems[elem_name]===undefined){elems[elem_name]=0}elems[elem_name]+=1}for(const generic of elem.generics){let match=null;if(elems[generic.name]){match=generic.name}else{for(elem_name in elems){if(!hasOwnPropertyRustdoc(elems,elem_name)){continue}if(elem_name===generic){match=elem_name;break}}}if(match===null){return maxLevDistance+1}elems[match]-=1;if(elems[match]===0){delete elems[match]}}return 0}return maxLevDistance+1}function checkIfInGenerics(row,elem,maxLevDistance){let lev=maxLevDistance+1;for(const entry of row.generics){lev=Math.min(checkType(entry,elem,true,maxLevDistance),lev);if(lev===0){break}}return lev}function checkType(row,elem,literalSearch,maxLevDistance){if(row.name===null){if(row.generics.length>0){return checkIfInGenerics(row,elem,maxLevDistance)}return maxLevDistance+1}let lev=levenshtein(row.name,elem.name);if(literalSearch){if(lev!==0){if(elem.generics.length===0){const checkGeneric=row.generics.length>0;if(checkGeneric&&row.generics.findIndex(tmp_elem=>tmp_elem.name===elem.name)!==-1){return 0}}return maxLevDistance+1}else if(elem.generics.length>0){return checkGenerics(row,elem,maxLevDistance+1,maxLevDistance)}return 0}else if(row.generics.length>0){if(elem.generics.length===0){if(lev===0){return 0}lev=Math.min(lev,checkIfInGenerics(row,elem,maxLevDistance));return lev}else if(lev>maxLevDistance){return checkIfInGenerics(row,elem,maxLevDistance)}else{const tmp_lev=checkGenerics(row,elem,lev,maxLevDistance);if(tmp_lev>maxLevDistance){return maxLevDistance+1}return(tmp_lev+lev)/2}}else if(elem.generics.length>0){return maxLevDistance+1}return lev}function findArg(row,elem,typeFilter,maxLevDistance){let lev=maxLevDistance+1;if(row&&row.type&&row.type.inputs&&row.type.inputs.length>0){for(const input of row.type.inputs){if(!typePassesFilter(typeFilter,input.ty)){continue}lev=Math.min(lev,checkType(input,elem,parsedQuery.literalSearch,maxLevDistance));if(lev===0){return 0}}}return parsedQuery.literalSearch?maxLevDistance+1:lev}function checkReturned(row,elem,typeFilter,maxLevDistance){let lev=maxLevDistance+1;if(row&&row.type&&row.type.output.length>0){const ret=row.type.output;for(const ret_ty of ret){if(!typePassesFilter(typeFilter,ret_ty.ty)){continue}lev=Math.min(lev,checkType(ret_ty,elem,parsedQuery.literalSearch,maxLevDistance));if(lev===0){return 0}}}return parsedQuery.literalSearch?maxLevDistance+1:lev}function checkPath(contains,ty,maxLevDistance){if(contains.length===0){return 0}let ret_lev=maxLevDistance+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;if(clength>length){return maxLevDistance+1}for(let i=0;ilength){break}let lev_total=0;let aborted=false;for(let x=0;xmaxLevDistance){aborted=true;break}lev_total+=lev}if(!aborted){ret_lev=Math.min(ret_lev,Math.round(lev_total/clength))}}return ret_lev}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES[filterCrates]&&ALIASES[filterCrates][lowerQuery]){const query_aliases=ALIASES[filterCrates][lowerQuery];for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{Object.keys(ALIASES).forEach(crate=>{if(ALIASES[crate][lowerQuery]){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=ALIASES[crate][lowerQuery];for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}})}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,lev,path_lev,maxLevDistance){const inBounds=lev<=maxLevDistance||index!==-1;if(lev===0||(!parsedQuery.literalSearch&&inBounds)){if(results[fullId]!==undefined){const result=results[fullId];if(result.dontValidate||result.lev<=lev){return}}results[fullId]={id:id,index:index,dontValidate:parsedQuery.literalSearch,lev:lev,path_lev:path_lev,}}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned,maxLevDistance){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let lev,index=-1,path_lev=0;const fullId=row.id;const searchWord=searchWords[pos];const in_args=findArg(row,elem,parsedQuery.typeFilter,maxLevDistance);const returned=checkReturned(row,elem,parsedQuery.typeFilter,maxLevDistance);addIntoResults(results_in_args,fullId,pos,-1,in_args,0,maxLevDistance);addIntoResults(results_returned,fullId,pos,-1,returned,0,maxLevDistance);if(!typePassesFilter(parsedQuery.typeFilter,row.ty)){return}const row_index=row.normalizedName.indexOf(elem.pathLast);const word_index=searchWord.indexOf(elem.pathLast);if(row_index===-1){index=word_index}else if(word_index===-1){index=row_index}else if(word_index1){path_lev=checkPath(elem.pathWithoutLast,row,maxLevDistance);if(path_lev>maxLevDistance){return}}if(parsedQuery.literalSearch){if(searchWord===elem.name){addIntoResults(results_others,fullId,pos,index,0,path_lev)}return}lev=levenshtein(searchWord,elem.pathLast);if(index===-1&&lev+path_lev>maxLevDistance){return}addIntoResults(results_others,fullId,pos,index,lev,path_lev,maxLevDistance)}function handleArgs(row,pos,results,maxLevDistance){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let totalLev=0;let nbLev=0;function checkArgs(elems,callback){for(const elem of elems){const lev=callback(row,elem,NO_TYPE_FILTER,maxLevDistance);if(lev<=1){nbLev+=1;totalLev+=lev}else{return false}}return true}if(!checkArgs(parsedQuery.elems,findArg)){return}if(!checkArgs(parsedQuery.returned,checkReturned)){return}if(nbLev===0){return}const lev=Math.round(totalLev/nbLev);addIntoResults(results,row.id,pos,0,lev,0,maxLevDistance)}function innerRunQuery(){let elem,i,nSearchWords,in_returned,row;let queryLen=0;for(const elem of parsedQuery.elems){queryLen+=elem.name.length}for(const elem of parsedQuery.returned){queryLen+=elem.name.length}const maxLevDistance=Math.floor(queryLen/3);if(parsedQuery.foundElems===1){if(parsedQuery.elems.length===1){elem=parsedQuery.elems[0];for(i=0,nSearchWords=searchWords.length;i0){for(i=0,nSearchWords=searchWords.length;i-1||path.indexOf(key)>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(key)>-1)||levenshtein(name,key)<=maxLevDistance)){return false}}return true}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#search-tabs button").item(searchState.currentTab);searchState.focusedByTab[searchState.currentTab]=null;if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor="#"+type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){let extraClass="";if(display===true){extraClass=" active"}const output=document.createElement("div");let length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];length+=1;let extra="";if(type==="primitive"){extra=" (primitive type)"}else if(type==="keyword"){extra=" (keyword)"}const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const resultName=document.createElement("div");resultName.className="result-name";if(item.is_alias){const alias=document.createElement("span");alias.className="alias";const bold=document.createElement("b");bold.innerText=item.alias;alias.appendChild(bold);alias.insertAdjacentHTML("beforeend"," - see ");resultName.appendChild(alias)}resultName.insertAdjacentHTML("beforeend",item.displayPath+""+name+extra+"");link.appendChild(resultName);const description=document.createElement("div");description.className="desc";description.insertAdjacentHTML("beforeend",item.desc);link.appendChild(description);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true"&&(!search.firstChild||search.firstChild.innerText!==searchState.loadingText))){const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";const crates_list=Object.keys(rawSearchIndex);if(crates_list.length>1){crates=" in 
"}let output=`

Results${crates}

`;if(results.query.error!==null){const error=results.query.error;error.forEach((value,index)=>{value=value.split("<").join("<").split(">").join(">");if(index%2!==0){error[index]=`${value}`}else{error[index]=value}});output+=`

Query parser error: "${error.join("")}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("search-tabs").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function search(e,forced){if(e){e.preventDefault()}const query=parseQuery(searchState.input.value.trim());let filterCrates=getFilterCrates();if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}searchState.setLoadingSearch();const params=searchState.getQueryStringParams();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";if(browserSupportsHistoryApi()){const newURL=buildUrl(query.original,filterCrates);if(!history.state&&!params.search){history.pushState(null,"",newURL)}else{history.replaceState(null,"",newURL)}}showResults(execQuery(query,searchWords,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;return types.map(type=>{let pathIndex,generics;if(typeof type==="number"){pathIndex=type;generics=[]}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths)}return{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:generics,}})}function buildFunctionSearchType(functionSearchType,lowercasePaths){const INPUTS_DATA=0;const OUTPUT_DATA=1;if(functionSearchType===0){return null}let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){const pathIndex=functionSearchType[INPUTS_DATA];inputs=[{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:[],}]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){const pathIndex=functionSearchType[OUTPUT_DATA];output=[{name:pathIndex===0?null:lowercasePaths[pathIndex-1].name,ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:[],}]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths)}}else{output=[]}return{inputs,output,}}function buildIndex(rawSearchIndex){searchIndex=[];const searchWords=[];const charA="A".charCodeAt(0);let currentIndex=0;let id=0;for(const crate in rawSearchIndex){if(!hasOwnPropertyRustdoc(rawSearchIndex,crate)){continue}let crateSize=0;const crateCorpus=rawSearchIndex[crate];searchWords.push(crate);const crateRow={crate:crate,ty:1,name:crate,path:"",desc:crateCorpus.doc,parent:undefined,type:null,id:id,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),};id+=1;searchIndex.push(crateRow);currentIndex+=1;const itemTypes=crateCorpus.t;const itemNames=crateCorpus.n;const itemPaths=crateCorpus.q;const itemDescs=crateCorpus.d;const itemParentIdxs=crateCorpus.i;const itemFunctionSearchTypes=crateCorpus.f;const paths=crateCorpus.p;const aliases=crateCorpus.a;const lowercasePaths=[];let len=paths.length;for(let i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:buildFunctionSearchType(itemFunctionSearchTypes[i],lowercasePaths),id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){ALIASES[crate]=Object.create(null);for(const alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}if(!hasOwnPropertyRustdoc(ALIASES[crate],alias_name)){ALIASES[crate][alias_name]=[]}for(const local_alias of aliases[alias_name]){ALIASES[crate][alias_name].push(local_alias+currentIndex)}}}currentIndex+=crateSize}return searchWords}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){if(browserSupportsHistoryApi()){history.replaceState(null,window.currentCrate+" - Rust",getNakedUrl()+window.location.hash)}searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="all crates"){const params=searchState.getQueryStringParams();const query=searchState.input.value.trim();if(!history.state&&!params.search){history.pushState(null,"",buildUrl(query,null))}else{history.replaceState(null,"",buildUrl(query,null))}}currentResults=null;search(undefined,true)}const searchWords=buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}return searchWords}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch({})}})() \ No newline at end of file diff --git a/0.10.4/static.files/settings-0bcba95ff279c1db.css b/0.10.4/static.files/settings-0bcba95ff279c1db.css new file mode 100644 index 000000000..907d42065 --- /dev/null +++ b/0.10.4/static.files/settings-0bcba95ff279c1db.css @@ -0,0 +1,3 @@ +.setting-line{margin:1.2em 0.6em;position:relative;}.setting-radio input,.setting-check input{margin-right:0.3em;height:1.2rem;width:1.2rem;color:inherit;border:1px solid currentColor;outline:none;-webkit-appearance:none;cursor:pointer;}.setting-radio input{border-radius:50%;}.setting-check input:checked{content:url('data:image/svg+xml,\ + \ + ');}.setting-radio span,.setting-check span{padding-bottom:1px;}.setting-radio{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:inline-flex;align-items:center;cursor:pointer;}.setting-radio+.setting-radio{margin-left:0.5em;}.setting-check{margin-right:20px;display:flex;align-items:center;cursor:pointer;}.setting-radio input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-check input:checked{background-color:var(--settings-input-color);}.setting-radio input:focus,.setting-check input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-radio input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-radio input:hover,.setting-check input:hover{border-color:var(--settings-input-color) !important;} \ No newline at end of file diff --git a/0.10.4/static.files/settings-f0c5c39777a9a2f6.js b/0.10.4/static.files/settings-f0c5c39777a9a2f6.js new file mode 100644 index 000000000..9f78bb917 --- /dev/null +++ b/0.10.4/static.files/settings-f0c5c39777a9a2f6.js @@ -0,0 +1,17 @@ +"use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function changeSetting(settingName,value){if(settingName==="theme"){const useSystem=value==="system preference"?"true":"false";updateLocalStorage("use-system-theme",useSystem)}updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":updateTheme();updateLightAndDark();break;case"line-numbers":if(value===true){window.rustdoc_add_line_numbers_to_examples()}else{window.rustdoc_remove_line_numbers_from_examples()}break}}function handleKey(ev){if(ev.ctrlKey||ev.altKey||ev.metaKey){return}switch(getVirtualKey(ev)){case"Enter":case"Return":case"Space":ev.target.checked=!ev.target.checked;ev.preventDefault();break}}function showLightAndDark(){removeClass(document.getElementById("preferred-light-theme"),"hidden");removeClass(document.getElementById("preferred-dark-theme"),"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme"),"hidden");addClass(document.getElementById("preferred-dark-theme"),"hidden")}function updateLightAndDark(){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||(useSystem===null&&getSettingValue("theme")===null)){showLightAndDark()}else{hideLightAndDark()}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.querySelectorAll("input[type=\"checkbox\"]"),toggle=>{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=function(){changeSetting(this.id,this.checked)};toggle.onkeyup=handleKey;toggle.onkeyrelease=handleKey});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){if(useSystem!=="false"){settingValue="system preference"}else{settingValue="light"}}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",ev=>{changeSetting(ev.target.name,ev.target.value)})})}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ +
+
${setting_name}
+
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ + `});output+=`\ +
+
`}else{const checked=setting["default"]===true?" checked":"";output+=`\ +
\ + \ +
`}}return output}function buildSettingsPage(){const theme_names=getVar("themes").split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover"}el.innerHTML=innerHTML;if(isSettingsPage){document.getElementById(MAIN_ID).appendChild(el)}else{el.setAttribute("tabindex","-1");getSettingsButton().appendChild(el)}return el}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display=""}function settingsBlurHandler(event){blurHandler(event,getSettingsButton(),window.hidePopoverMenus)}if(isSettingsPage){getSettingsButton().onclick=function(event){event.preventDefault()}}else{const settingsButton=getSettingsButton();const settingsMenu=document.getElementById("settings");settingsButton.onclick=function(event){if(elemIsInParent(event.target,settingsMenu)){return}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals();if(shouldDisplaySettings){displaySettings()}};settingsButton.onblur=settingsBlurHandler;settingsButton.querySelector("a").onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler});settingsMenu.onblur=settingsBlurHandler}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings()}removeClass(getSettingsButton(),"rotate")},0)})() \ No newline at end of file diff --git a/0.10.4/static.files/source-script-1b95b7cca98b26e5.js b/0.10.4/static.files/source-script-1b95b7cca98b26e5.js new file mode 100644 index 000000000..73a9fcd43 --- /dev/null +++ b/0.10.4/static.files/source-script-1b95b7cca98b26e5.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=document.getElementById("rustdoc-vars").attributes["data-root-path"].value;const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;function closeSidebarIfMobile(){if(window.innerWidth"){window.rustdocMobileScrollLock();addClass(document.documentElement,"source-sidebar-expanded");child.innerText="<";updateLocalStorage("source-sidebar-show","true")}else{window.rustdocMobileScrollUnlock();removeClass(document.documentElement,"source-sidebar-expanded");child.innerText=">";updateLocalStorage("source-sidebar-show","false")}}function createSidebarToggle(){const sidebarToggle=document.createElement("div");sidebarToggle.id="src-sidebar-toggle";const inner=document.createElement("button");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}inner.onclick=toggleSidebar;sidebarToggle.appendChild(inner);return sidebarToggle}function createSourceSidebar(){const container=document.querySelector("nav.sidebar");const sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);const sidebar=document.createElement("div");sidebar.id="source-sidebar";let hasFoundFile=false;const title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(key=>{sourcesIndex[key][NAME_OFFSET]=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",hasFoundFile)});container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}const lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSourceLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("a"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSourceHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSourceLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",()=>{const match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSourceLines(match)}});onEachLazy(document.getElementsByClassName("src-line-numbers"),el=>{el.addEventListener("click",handleSourceHighlight)});highlightSourceLines();window.createSourceSidebar=createSourceSidebar})() \ No newline at end of file diff --git a/0.10.4/static.files/storage-3891ce972e3a2bf8.js b/0.10.4/static.files/storage-3891ce972e3a2bf8.js new file mode 100644 index 000000000..d64fa5ef6 --- /dev/null +++ b/0.10.4/static.files/storage-3891ce972e3a2bf8.js @@ -0,0 +1 @@ +"use strict";const darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");window.mainTheme=document.getElementById("mainThemeStyle");window.RUSTDOC_MOBILE_BREAKPOINT=700;const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");if(settingsElement===null){return null}const dataset=settingsElement.dataset;if(dataset===undefined){return null}return dataset})();function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current!==null){return current}if(settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def}}return null}const localStoredTheme=getSettingValue("theme");const savedHref=[];function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(!elem||!elem.classList){return}elem.classList.add(className)}function removeClass(elem,className){if(!elem||!elem.classList){return}elem.classList.remove(className)}function onEach(arr,func,reversed){if(arr&&arr.length>0&&func){if(reversed){const length=arr.length;for(let i=length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(const elem of arr){if(func(elem)){return true}}}}return false}function onEachLazy(lazyArray,func,reversed){return onEach(Array.prototype.slice.call(lazyArray),func,reversed)}function updateLocalStorage(name,value){try{window.localStorage.setItem("rustdoc-"+name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name)}catch(e){return null}}function switchTheme(styleElem,mainStyleElem,newThemeName,saveTheme){if(saveTheme){updateLocalStorage("theme",newThemeName)}if(savedHref.length===0){onEachLazy(document.getElementsByTagName("link"),el=>{savedHref.push(el.href)})}const newHref=savedHref.find(url=>{const m=url.match(/static\.files\/(.*)-[a-f0-9]{16}\.css$/);if(m&&m[1]===newThemeName){return true}const m2=url.match(/\/([^/]*)\.css$/);if(m2&&m2[1].startsWith(newThemeName)){return true}});if(newHref&&newHref!==styleElem.href){styleElem.href=newHref}}const updateTheme=(function(){function updateTheme(){const use=(theme,saveTheme)=>{switchTheme(window.currentTheme,window.mainTheme,theme,saveTheme)};if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";if(isDarkMode()){use(darkTheme,true)}else{use(lightTheme,true)}}else{use(getSettingValue("theme"),false)}}let isDarkMode;if(window.matchMedia){const mql=window.matchMedia("(prefers-color-scheme: dark)");isDarkMode=()=>mql.matches;if(mql.addEventListener){mql.addEventListener("change",updateTheme)}else{mql.addListener(updateTheme)}}else{const cssContent=getComputedStyle(document.documentElement).getPropertyValue("content");const cssColorScheme=cssContent||"\"light\"";isDarkMode=()=>(cssColorScheme==="\"dark\"")}return updateTheme})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"source-sidebar-expanded")}window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0)}}) \ No newline at end of file diff --git a/0.10.4/static.files/wheel-7b819b6101059cd0.svg b/0.10.4/static.files/wheel-7b819b6101059cd0.svg new file mode 100644 index 000000000..83c07f63d --- /dev/null +++ b/0.10.4/static.files/wheel-7b819b6101059cd0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.10.40/.lock b/0.10.40/.lock new file mode 100644 index 000000000..e69de29bb diff --git a/0.10.40/chemfiles/all.html b/0.10.40/chemfiles/all.html new file mode 100644 index 000000000..8676b8776 --- /dev/null +++ b/0.10.40/chemfiles/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/0.10.40/chemfiles/atom/struct.Atom.html b/0.10.40/chemfiles/atom/struct.Atom.html new file mode 100644 index 000000000..591fac7c9 --- /dev/null +++ b/0.10.40/chemfiles/atom/struct.Atom.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Atom.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/atom/struct.AtomMut.html b/0.10.40/chemfiles/atom/struct.AtomMut.html new file mode 100644 index 000000000..2843d6f36 --- /dev/null +++ b/0.10.40/chemfiles/atom/struct.AtomMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomMut.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/atom/struct.AtomRef.html b/0.10.40/chemfiles/atom/struct.AtomRef.html new file mode 100644 index 000000000..fc21ff8b9 --- /dev/null +++ b/0.10.40/chemfiles/atom/struct.AtomRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.AtomRef.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/cell/enum.CellShape.html b/0.10.40/chemfiles/cell/enum.CellShape.html new file mode 100644 index 000000000..9d3d95dbc --- /dev/null +++ b/0.10.40/chemfiles/cell/enum.CellShape.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.CellShape.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/cell/struct.UnitCell.html b/0.10.40/chemfiles/cell/struct.UnitCell.html new file mode 100644 index 000000000..c199c7635 --- /dev/null +++ b/0.10.40/chemfiles/cell/struct.UnitCell.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCell.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/cell/struct.UnitCellMut.html b/0.10.40/chemfiles/cell/struct.UnitCellMut.html new file mode 100644 index 000000000..a07e76605 --- /dev/null +++ b/0.10.40/chemfiles/cell/struct.UnitCellMut.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellMut.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/cell/struct.UnitCellRef.html b/0.10.40/chemfiles/cell/struct.UnitCellRef.html new file mode 100644 index 000000000..7455c76ac --- /dev/null +++ b/0.10.40/chemfiles/cell/struct.UnitCellRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.UnitCellRef.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/enum.BondOrder.html b/0.10.40/chemfiles/enum.BondOrder.html new file mode 100644 index 000000000..855f77d9c --- /dev/null +++ b/0.10.40/chemfiles/enum.BondOrder.html @@ -0,0 +1,37 @@ +BondOrder in chemfiles - Rust

Enum chemfiles::BondOrder

source ·
#[repr(C)]
#[non_exhaustive]
pub enum BondOrder { + Unknown, + Single, + Double, + Triple, + Quadruple, + Quintuplet, + Amide, + Aromatic, +}
Expand description

Possible bond order associated with bonds

+

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Unknown

Unknown or unspecified bond order

+
§

Single

Single bond

+
§

Double

Double bond

+
§

Triple

Triple bond

+
§

Quadruple

Quadruple bond (present in some metals)

+
§

Quintuplet

Quintuplet bond (present in some metals)

+
§

Amide

Amide bond (required by some file formats)

+
§

Aromatic

Aromatic bond (required by some file formats)

+

Trait Implementations§

source§

impl Clone for BondOrder

source§

fn clone(&self) -> BondOrder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BondOrder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<chfl_bond_order> for BondOrder

source§

fn from(order: chfl_bond_order) -> BondOrder

Converts to this type from the input type.
source§

impl Ord for BondOrder

source§

fn cmp(&self, other: &BondOrder) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<BondOrder> for BondOrder

source§

fn eq(&self, other: &BondOrder) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<BondOrder> for BondOrder

source§

fn partial_cmp(&self, other: &BondOrder) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Copy for BondOrder

source§

impl Eq for BondOrder

source§

impl StructuralEq for BondOrder

source§

impl StructuralPartialEq for BondOrder

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/enum.CellShape.html b/0.10.40/chemfiles/enum.CellShape.html new file mode 100644 index 000000000..6d5e3bff6 --- /dev/null +++ b/0.10.40/chemfiles/enum.CellShape.html @@ -0,0 +1,22 @@ +CellShape in chemfiles - Rust

Enum chemfiles::CellShape

source ·
pub enum CellShape {
+    Orthorhombic,
+    Triclinic,
+    Infinite,
+}
Expand description

Available unit cell shapes.

+

Variants§

§

Orthorhombic

Orthorhombic cell, with the three angles equals to 90°.

+
§

Triclinic

Triclinic cell, with any values for the angles.

+
§

Infinite

Infinite cell, to use when there is no cell.

+

Trait Implementations§

source§

impl Clone for CellShape

source§

fn clone(&self) -> CellShape

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CellShape

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<CellShape> for chfl_cellshape

source§

fn from(celltype: CellShape) -> chfl_cellshape

Converts to this type from the input type.
source§

impl From<chfl_cellshape> for CellShape

source§

fn from(celltype: chfl_cellshape) -> CellShape

Converts to this type from the input type.
source§

impl PartialEq<CellShape> for CellShape

source§

fn eq(&self, other: &CellShape) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for CellShape

source§

impl StructuralEq for CellShape

source§

impl StructuralPartialEq for CellShape

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/enum.Property.html b/0.10.40/chemfiles/enum.Property.html new file mode 100644 index 000000000..f3748f5f8 --- /dev/null +++ b/0.10.40/chemfiles/enum.Property.html @@ -0,0 +1,27 @@ +Property in chemfiles - Rust

Enum chemfiles::Property

source ·
pub enum Property {
+    Bool(bool),
+    Double(f64),
+    String(String),
+    Vector3D([f64; 3]),
+}
Expand description

A Property is a piece of data that can be associated with an Atom or a +Frame.

+

Variants§

§

Bool(bool)

Boolean property

+
§

Double(f64)

Floating point property

+
§

String(String)

String property

+
§

Vector3D([f64; 3])

3-dimensional vector property

+

Trait Implementations§

source§

impl Clone for Property

source§

fn clone(&self) -> Property

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Property

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a str> for Property

source§

fn from(value: &'a str) -> Self

Converts to this type from the input type.
source§

impl From<[f64; 3]> for Property

source§

fn from(value: [f64; 3]) -> Self

Converts to this type from the input type.
source§

impl From<String> for Property

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<bool> for Property

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Property

source§

fn from(value: f64) -> Self

Converts to this type from the input type.
source§

impl PartialEq<Property> for Property

source§

fn eq(&self, other: &Property) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Property> for Property

source§

fn partial_cmp(&self, other: &Property) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl StructuralPartialEq for Property

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/enum.Status.html b/0.10.40/chemfiles/enum.Status.html new file mode 100644 index 000000000..9b7278857 --- /dev/null +++ b/0.10.40/chemfiles/enum.Status.html @@ -0,0 +1,38 @@ +Status in chemfiles - Rust

Enum chemfiles::Status

source ·
#[repr(C)]
#[non_exhaustive]
pub enum Status { + Success, + MemoryError, + FileError, + FormatError, + SelectionError, + ConfigurationError, + OutOfBounds, + PropertyError, + ChemfilesError, + StdCppError, + UTF8PathError, +}
Expand description

Possible causes of error in chemfiles

+

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Success

No error

+
§

MemoryError

Error in memory allocations

+
§

FileError

Error while reading or writing a file

+
§

FormatError

Error in file formatting, i.e. the file is invalid

+
§

SelectionError

Error in selection string syntax

+
§

ConfigurationError

Error in configuration files syntax

+
§

OutOfBounds

Error for out of bounds indexing

+
§

PropertyError

Error related to properties

+
§

ChemfilesError

Exception in the C++ chemfiles library

+
§

StdCppError

Exception in the C++ standard library

+
§

UTF8PathError

The given path is not valid UTF8

+

Trait Implementations§

source§

impl Clone for Status

source§

fn clone(&self) -> Status

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Status

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<Status> for Status

source§

fn eq(&self, other: &Status) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Status

source§

impl StructuralEq for Status

source§

impl StructuralPartialEq for Status

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/errors/enum.Status.html b/0.10.40/chemfiles/errors/enum.Status.html new file mode 100644 index 000000000..6aa83fd28 --- /dev/null +++ b/0.10.40/chemfiles/errors/enum.Status.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Status.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/errors/fn.set_warning_callback.html b/0.10.40/chemfiles/errors/fn.set_warning_callback.html new file mode 100644 index 000000000..97bc2a1ba --- /dev/null +++ b/0.10.40/chemfiles/errors/fn.set_warning_callback.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.set_warning_callback.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/errors/struct.Error.html b/0.10.40/chemfiles/errors/struct.Error.html new file mode 100644 index 000000000..34339c749 --- /dev/null +++ b/0.10.40/chemfiles/errors/struct.Error.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Error.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/fn.add_configuration.html b/0.10.40/chemfiles/fn.add_configuration.html new file mode 100644 index 000000000..25eb931db --- /dev/null +++ b/0.10.40/chemfiles/fn.add_configuration.html @@ -0,0 +1,13 @@ +add_configuration in chemfiles - Rust
pub fn add_configuration<S>(path: S) -> Result<(), Error>where
+    S: AsRef<str>,
Expand description

Read configuration data from the file at path.

+

By default, chemfiles reads configuration from any file named +.chemfiles.toml in the current directory or any parent directory. This +function can be used to add data from another configuration file. Data from +the new configuration file will overwrite any existing data.

+

Errors

+

This function will fail if there is no file at path, or if the file is +incorrectly formatted.

+

Example

+
chemfiles::add_configuration("local-config.toml").unwrap();
+// from now on, the data from "local-config.toml" will be used
+
\ No newline at end of file diff --git a/0.10.40/chemfiles/fn.formats_list.html b/0.10.40/chemfiles/fn.formats_list.html new file mode 100644 index 000000000..c16d371fa --- /dev/null +++ b/0.10.40/chemfiles/fn.formats_list.html @@ -0,0 +1,12 @@ +formats_list in chemfiles - Rust

Function chemfiles::formats_list

source ·
pub fn formats_list() -> Vec<FormatMetadata>
Expand description

Get the list of formats known by chemfiles, as well as all associated metadata.

+

Example

+
let formats = chemfiles::formats_list();
+println!("chemfiles supports {} formats:", formats.len());
+for format in &formats {
+    println!(
+        "   {:<15} {}",
+        format.name,
+        format.extension.as_deref().unwrap_or("")
+    );
+}
+
\ No newline at end of file diff --git a/0.10.40/chemfiles/fn.guess_format.html b/0.10.40/chemfiles/fn.guess_format.html new file mode 100644 index 000000000..1979a398b --- /dev/null +++ b/0.10.40/chemfiles/fn.guess_format.html @@ -0,0 +1,26 @@ +guess_format in chemfiles - Rust

Function chemfiles::guess_format

source ·
pub fn guess_format<P>(path: P) -> Result<String, Error>where
+    P: AsRef<Path>,
Expand description

Get the format that chemfiles would use to read a file at the given +path.

+

The format is mostly guessed from the path extension, chemfiles only tries +to read the file to distinguish between CIF and mmCIF files. Opening the +file using the returned format string might still fail. For example, it will +fail if the file is not actually formatted according to the guessed format; +or the format/compression combination is not supported (e.g. XTC / GZ will +not work since the XTC reader does not support compressed files).

+

The returned format is represented in a way compatible with the various +Trajectory constructors, i.e. "<format name> [/ <compression>]", where +compression is optional.

+

Errors

+

This function returns an error if the file format couldn’t be guessed.

+

Panics

+

This function panics if the path can’t be converted to a Unicode string.

+

Examples

+
let format = chemfiles::guess_format("trajectory.xyz.xz").unwrap();
+assert_eq!(format, "XYZ / XZ");
+
+let format = chemfiles::guess_format("trajectory.nc").unwrap();
+assert_eq!(format, "Amber NetCDF");
+
+let format = chemfiles::guess_format("trajectory.unknown.format");
+assert!(format.is_err());
+
\ No newline at end of file diff --git a/0.10.40/chemfiles/fn.set_warning_callback.html b/0.10.40/chemfiles/fn.set_warning_callback.html new file mode 100644 index 000000000..161fb1431 --- /dev/null +++ b/0.10.40/chemfiles/fn.set_warning_callback.html @@ -0,0 +1,4 @@ +set_warning_callback in chemfiles - Rust
pub fn set_warning_callback<F>(callback: F)where
+    F: WarningCallback + 'static,
Expand description

Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.

+
\ No newline at end of file diff --git a/0.10.40/chemfiles/fn.version.html b/0.10.40/chemfiles/fn.version.html new file mode 100644 index 000000000..e1c983d28 --- /dev/null +++ b/0.10.40/chemfiles/fn.version.html @@ -0,0 +1,5 @@ +version in chemfiles - Rust

Function chemfiles::version

source ·
pub fn version() -> String
Expand description

Get the version of the chemfiles library.

+

Example

+
let version = chemfiles::version();
+assert!(version.starts_with("0.10"));
+
\ No newline at end of file diff --git a/0.10.40/chemfiles/frame/struct.Frame.html b/0.10.40/chemfiles/frame/struct.Frame.html new file mode 100644 index 000000000..32b972752 --- /dev/null +++ b/0.10.40/chemfiles/frame/struct.Frame.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Frame.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/index.html b/0.10.40/chemfiles/index.html new file mode 100644 index 000000000..6631a2144 --- /dev/null +++ b/0.10.40/chemfiles/index.html @@ -0,0 +1,32 @@ +chemfiles - Rust

Crate chemfiles

source ·
Expand description

Chemfiles is a multi-language library written in modern C++ for reading and +writing from and to molecular trajectory files. These files are created by +your favorite theoretical chemistry program, and contains information about +atomic or residues names and positions. Some format also have additional +information, such as velocities, forces, energy, …

+

This crate expose the C API of chemfiles to Rust, and make all the +functionalities accessible. For more information on the C++ library, +please see its documentation. Specifically, the following pages +are worth reading:

+ +

Structs

  • An Atom is a particle in the current Frame. It stores the following +atomic properties:
  • An analog to a mutable reference to an atom (&mut Atom)
  • An analog to a reference to an atom (&Atom)
  • Error type for Chemfiles.
  • FormatMetadata contains metadata associated with one format.
  • A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.
  • A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].
  • MemoryTrajectoryReader is a handle for a Trajectory in memory.
  • An iterator over the properties in an atom/frame/residue
  • A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.
  • An analog to a reference to a residue (&Residue)
  • A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.
  • A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.
  • An analog to a reference to a topology (&Topology)
  • The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.
  • An UnitCell represent the box containing the atoms, and its periodicity.
  • An analog to a mutable reference to an unit cell (&mut UnitCell)
  • An analog to a reference to an unit cell (&UnitCell)

Enums

  • Possible bond order associated with bonds
  • Available unit cell shapes.
  • A Property is a piece of data that can be associated with an Atom or a +Frame.
  • Possible causes of error in chemfiles

Functions

  • Read configuration data from the file at path.
  • Get the list of formats known by chemfiles, as well as all associated metadata.
  • Get the format that chemfiles would use to read a file at the given +path.
  • Use callback for every chemfiles warning. The callback will be passed +the warning message. This will drop any previous warning callback.
  • Get the version of the chemfiles library.
\ No newline at end of file diff --git a/0.10.40/chemfiles/misc/fn.formats_list.html b/0.10.40/chemfiles/misc/fn.formats_list.html new file mode 100644 index 000000000..481646355 --- /dev/null +++ b/0.10.40/chemfiles/misc/fn.formats_list.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.formats_list.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/misc/fn.guess_format.html b/0.10.40/chemfiles/misc/fn.guess_format.html new file mode 100644 index 000000000..681a66ce5 --- /dev/null +++ b/0.10.40/chemfiles/misc/fn.guess_format.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/fn.guess_format.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/misc/struct.FormatMetadata.html b/0.10.40/chemfiles/misc/struct.FormatMetadata.html new file mode 100644 index 000000000..10fda814b --- /dev/null +++ b/0.10.40/chemfiles/misc/struct.FormatMetadata.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.FormatMetadata.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/property/enum.Property.html b/0.10.40/chemfiles/property/enum.Property.html new file mode 100644 index 000000000..87bfc97da --- /dev/null +++ b/0.10.40/chemfiles/property/enum.Property.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.Property.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/property/struct.PropertiesIter.html b/0.10.40/chemfiles/property/struct.PropertiesIter.html new file mode 100644 index 000000000..2faef8a54 --- /dev/null +++ b/0.10.40/chemfiles/property/struct.PropertiesIter.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.PropertiesIter.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/residue/struct.Residue.html b/0.10.40/chemfiles/residue/struct.Residue.html new file mode 100644 index 000000000..e8f25ad8a --- /dev/null +++ b/0.10.40/chemfiles/residue/struct.Residue.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Residue.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/residue/struct.ResidueRef.html b/0.10.40/chemfiles/residue/struct.ResidueRef.html new file mode 100644 index 000000000..9d26d5daa --- /dev/null +++ b/0.10.40/chemfiles/residue/struct.ResidueRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.ResidueRef.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/selection/struct.Match.html b/0.10.40/chemfiles/selection/struct.Match.html new file mode 100644 index 000000000..3c7b0b709 --- /dev/null +++ b/0.10.40/chemfiles/selection/struct.Match.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Match.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/selection/struct.Selection.html b/0.10.40/chemfiles/selection/struct.Selection.html new file mode 100644 index 000000000..8ed2b5d77 --- /dev/null +++ b/0.10.40/chemfiles/selection/struct.Selection.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Selection.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/sidebar-items.js b/0.10.40/chemfiles/sidebar-items.js new file mode 100644 index 000000000..99ded65b4 --- /dev/null +++ b/0.10.40/chemfiles/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["BondOrder","CellShape","Property","Status"],"fn":["add_configuration","formats_list","guess_format","set_warning_callback","version"],"struct":["Atom","AtomMut","AtomRef","Error","FormatMetadata","Frame","Match","MemoryTrajectoryReader","PropertiesIter","Residue","ResidueRef","Selection","Topology","TopologyRef","Trajectory","UnitCell","UnitCellMut","UnitCellRef"]}; \ No newline at end of file diff --git a/0.10.40/chemfiles/struct.Atom.html b/0.10.40/chemfiles/struct.Atom.html new file mode 100644 index 000000000..158223a93 --- /dev/null +++ b/0.10.40/chemfiles/struct.Atom.html @@ -0,0 +1,118 @@ +Atom in chemfiles - Rust

Struct chemfiles::Atom

source ·
pub struct Atom { /* private fields */ }
Expand description

An Atom is a particle in the current Frame. It stores the following +atomic properties:

+
    +
  • atom name;
  • +
  • atom type;
  • +
  • atom mass;
  • +
  • atom charge.
  • +
+

The atom name is usually an unique identifier (H1, C_a) while the +atom type will be shared between all particles of the same type: H, +Ow, CH3.

+

Implementations§

source§

impl Atom

source

pub fn new<'a>(name: impl Into<&'a str>) -> Atom

Create an atom with the given name, and set the atom type to name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+
source

pub fn mass(&self) -> f64

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+
source

pub fn set_mass(&mut self, mass: f64)

Set the atom mass to mass, in atomic mass units.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+
source

pub fn charge(&self) -> f64

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+
source

pub fn set_charge(&mut self, charge: f64)

Set the atom charge to charge, in number of the electron charge e.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+
source

pub fn name(&self) -> String

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+
source

pub fn atomic_type(&self) -> String

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+
source

pub fn set_name<'a>(&mut self, name: impl Into<&'a str>)

Set the atom name to name.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+
source

pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>)

Set the atom type to atomic_type.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+
source

pub fn full_name(&self) -> String

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+
source

pub fn vdw_radius(&self) -> f64

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+
source

pub fn covalent_radius(&self) -> f64

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+
source

pub fn atomic_number(&self) -> u64

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+
source

pub fn set(&mut self, name: &str, property: impl Into<Property>)

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl Clone for Atom

source§

fn clone(&self) -> Atom

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Atom

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Atom

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Atom

§

impl !Send for Atom

§

impl !Sync for Atom

§

impl Unpin for Atom

§

impl UnwindSafe for Atom

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.AtomMut.html b/0.10.40/chemfiles/struct.AtomMut.html new file mode 100644 index 000000000..4cb6e665f --- /dev/null +++ b/0.10.40/chemfiles/struct.AtomMut.html @@ -0,0 +1,103 @@ +AtomMut in chemfiles - Rust

Struct chemfiles::AtomMut

source ·
pub struct AtomMut<'a> { /* private fields */ }
Expand description

An analog to a mutable reference to an atom (&mut Atom)

+

Methods from Deref<Target = Atom>§

source

pub fn mass(&self) -> f64

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+
source

pub fn set_mass(&mut self, mass: f64)

Set the atom mass to mass, in atomic mass units.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_mass(34.9);
+assert_eq!(atom.mass(), 34.9);
+
source

pub fn charge(&self) -> f64

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+
source

pub fn set_charge(&mut self, charge: f64)

Set the atom charge to charge, in number of the electron charge e.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_charge(-2.0);
+assert_eq!(atom.charge(), -2.0);
+
source

pub fn name(&self) -> String

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+
source

pub fn atomic_type(&self) -> String

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+
source

pub fn set_name<'a>(&mut self, name: impl Into<&'a str>)

Set the atom name to name.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_name("Zn3");
+assert_eq!(atom.name(), "Zn3");
+
source

pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>)

Set the atom type to atomic_type.

+
Example
+
let mut atom = Atom::new("He");
+
+atom.set_atomic_type("F");
+assert_eq!(atom.atomic_type(), "F");
+
source

pub fn full_name(&self) -> String

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+
source

pub fn vdw_radius(&self) -> f64

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+
source

pub fn covalent_radius(&self) -> f64

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+
source

pub fn atomic_number(&self) -> u64

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+
source

pub fn set(&mut self, name: &str, property: impl Into<Property>)

Add a new property with the given name to this atom.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("a bool", true);
+atom.set("a string", "test");
+
+assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl<'a> Debug for AtomMut<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for AtomMut<'a>

§

type Target = Atom

The resulting type after dereferencing.
source§

fn deref(&self) -> &Atom

Dereferences the value.
source§

impl<'a> DerefMut for AtomMut<'a>

source§

fn deref_mut(&mut self) -> &mut Atom

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for AtomMut<'a>

§

impl<'a> !Send for AtomMut<'a>

§

impl<'a> !Sync for AtomMut<'a>

§

impl<'a> Unpin for AtomMut<'a>

§

impl<'a> !UnwindSafe for AtomMut<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.AtomRef.html b/0.10.40/chemfiles/struct.AtomRef.html new file mode 100644 index 000000000..915aeaf70 --- /dev/null +++ b/0.10.40/chemfiles/struct.AtomRef.html @@ -0,0 +1,69 @@ +AtomRef in chemfiles - Rust

Struct chemfiles::AtomRef

source ·
pub struct AtomRef<'a> { /* private fields */ }
Expand description

An analog to a reference to an atom (&Atom)

+

Methods from Deref<Target = Atom>§

source

pub fn mass(&self) -> f64

Get the atom mass, in atomic mass units.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.mass(), 4.002602);
+
source

pub fn charge(&self) -> f64

Get the atom charge, in number of the electron charge e.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.charge(), 0.0);
+
source

pub fn name(&self) -> String

Get the atom name.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.name(), "He");
+
source

pub fn atomic_type(&self) -> String

Get the atom type.

+
Example
+
let atom = Atom::new("He");
+assert_eq!(atom.atomic_type(), "He");
+
source

pub fn full_name(&self) -> String

Try to get the full name of the atom from the atomic type. For example, +the full name of “He” is “Helium”, and so on. If the name can not be +found, this function returns the empty string.

+
Example
+
let atom = Atom::new("Zn");
+assert_eq!(atom.full_name(), "Zinc");
+
source

pub fn vdw_radius(&self) -> f64

Try to get the Van der Waals radius of the atom from the atomic type. +If the radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+
source

pub fn covalent_radius(&self) -> f64

Try to get the covalent radius of the atom from the atomic type. If the +radius can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+
source

pub fn atomic_number(&self) -> u64

Try to get the atomic number of the atom from the atomic type. If the +number can not be found, returns 0.

+
Example
+
assert_eq!(Atom::new("He").atomic_number(), 2);
+assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this atom, if it exist.

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+
+assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(atom.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this atom

+
Examples
+
let mut atom = Atom::new("He");
+atom.set("foo", Property::Double(22.2));
+atom.set("bar", Property::Bool(false));
+
+for (name, property) in atom.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl<'a> Debug for AtomRef<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for AtomRef<'a>

§

type Target = Atom

The resulting type after dereferencing.
source§

fn deref(&self) -> &Atom

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for AtomRef<'a>

§

impl<'a> !Send for AtomRef<'a>

§

impl<'a> !Sync for AtomRef<'a>

§

impl<'a> Unpin for AtomRef<'a>

§

impl<'a> UnwindSafe for AtomRef<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.Error.html b/0.10.40/chemfiles/struct.Error.html new file mode 100644 index 000000000..9a52d5c4d --- /dev/null +++ b/0.10.40/chemfiles/struct.Error.html @@ -0,0 +1,25 @@ +Error in chemfiles - Rust

Struct chemfiles::Error

source ·
pub struct Error {
+    pub status: Status,
+    pub message: String,
+}
Expand description

Error type for Chemfiles.

+

Fields§

§status: Status

The error status code

+
§message: String

A message describing the error cause

+

Implementations§

source§

impl Error

source

pub fn last_error() -> String

Get the last error message from the C++ library.

+
source

pub fn cleanup()

Clear any error from the C++ library

+

Trait Implementations§

source§

impl Clone for Error

source§

fn clone(&self) -> Error

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Error

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Error for Error

source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<Utf8Error> for Error

source§

fn from(_: Utf8Error) -> Self

Converts to this type from the input type.
source§

impl From<chfl_status> for Error

source§

fn from(status: chfl_status) -> Error

Converts to this type from the input type.
source§

impl PartialEq<Error> for Error

source§

fn eq(&self, other: &Error) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Error

source§

impl StructuralEq for Error

source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<E> Provider for Ewhere + E: Error + ?Sized,

source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to +provide by using demand. Read more
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.FormatMetadata.html b/0.10.40/chemfiles/struct.FormatMetadata.html new file mode 100644 index 000000000..f3e2f8efa --- /dev/null +++ b/0.10.40/chemfiles/struct.FormatMetadata.html @@ -0,0 +1,42 @@ +FormatMetadata in chemfiles - Rust
pub struct FormatMetadata {
Show 13 fields + pub name: &'static str, + pub extension: Option<&'static str>, + pub description: &'static str, + pub reference: &'static str, + pub read: bool, + pub write: bool, + pub memory: bool, + pub positions: bool, + pub velocities: bool, + pub unit_cell: bool, + pub atoms: bool, + pub bonds: bool, + pub residues: bool, +
}
Expand description

FormatMetadata contains metadata associated with one format.

+

Fields§

§name: &'static str

Name of the format.

+
§extension: Option<&'static str>

Extension associated with the format.

+
§description: &'static str

Extended, user-facing description of the format.

+
§reference: &'static str

URL pointing to the format definition/reference.

+
§read: bool

Is reading files in this format implemented?

+
§write: bool

Is writing files in this format implemented?

+
§memory: bool

Does this format support in-memory IO?

+
§positions: bool

Does this format support storing atomic positions?

+
§velocities: bool

Does this format support storing atomic velocities?

+
§unit_cell: bool

Does this format support storing unit cell information?

+
§atoms: bool

Does this format support storing atom names or types?

+
§bonds: bool

Does this format support storing bonds between atoms?

+
§residues: bool

Does this format support storing residues?

+

Trait Implementations§

source§

impl Clone for FormatMetadata

source§

fn clone(&self) -> FormatMetadata

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FormatMetadata

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<FormatMetadata> for FormatMetadata

source§

fn eq(&self, other: &FormatMetadata) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for FormatMetadata

source§

impl StructuralEq for FormatMetadata

source§

impl StructuralPartialEq for FormatMetadata

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.Frame.html b/0.10.40/chemfiles/struct.Frame.html new file mode 100644 index 000000000..6320ab586 --- /dev/null +++ b/0.10.40/chemfiles/struct.Frame.html @@ -0,0 +1,365 @@ +Frame in chemfiles - Rust

Struct chemfiles::Frame

source ·
pub struct Frame { /* private fields */ }
Expand description

A Frame contains data from one simulation step: the current unit +cell, the topology, the positions, and the velocities of the particles in +the system. If some information is missing (topology or velocity or unit +cell), the corresponding data is filled with a default value.

+

Implementations§

source§

impl Frame

source

pub fn new() -> Frame

Create an empty frame. It will be resized by the library as needed.

+
Example
+
let frame = Frame::new();
+
+assert_eq!(frame.size(), 0);
+
source

pub fn atom(&self, index: usize) -> AtomRef<'_>

Get a reference to the atom at the given index in this frame.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+let atom = frame.atom(0);
+assert_eq!(atom.name(), "Zn");
+
source

pub fn atom_mut(&mut self, index: usize) -> AtomMut<'_>

Get a mutable reference to the atom at the given index in this frame.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+
+assert_eq!(frame.atom(0).name(), "Zn");
+
+frame.atom_mut(0).set_name("Fe");
+assert_eq!(frame.atom(0).name(), "Fe");
+
source

pub fn size(&self) -> usize

Get the current number of atoms in this frame.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.size(), 0);
+
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+
source

pub fn resize(&mut self, natoms: usize)

Resize the positions and the velocities in this frame, to make space for +natoms atoms. Previous data is conserved, as well as the presence of +absence of velocities.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+assert_eq!(frame.size(), 67);
+
source

pub fn add_atom( + &mut self, + atom: &Atom, + position: [f64; 3], + velocity: impl Into<Option<[f64; 3]>> +)

Add an Atom and the corresponding position and optionally velocity +data to this frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+
+frame.add_velocities();
+frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+
source

pub fn remove(&mut self, i: usize)

Remove the atom at index i in this frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+assert_eq!(frame.size(), 3);
+
+frame.remove(1);
+assert_eq!(frame.size(), 2);
+assert_eq!(frame.atom(1).name(), "Sn");
+
source

pub fn add_bond(&mut self, i: usize, j: usize)

Add a bond between the atoms at indexes i and j in the frame.

+

The bond order is set to BondOrder::Unknown.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+assert_eq!(frame.topology().bonds_count(), 3);
+
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+
source

pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder)

Add a bond between the atoms at indexes i and j in the frame +with the given bond order.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.topology().bonds_count(), 0);
+frame.resize(2);
+
+frame.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+
source

pub fn remove_bond(&mut self, i: usize, j: usize)

Remove any existing bond between the atoms at indexes i and j in +the frame.

+

This function does nothing if there is no bond between i and j.

+
Example
+
let mut frame = Frame::new();
+frame.resize(5);
+
+frame.add_bond(0, 1);
+frame.add_bond(3, 1);
+frame.add_bond(2, 4);
+
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+
+frame.remove_bond(2, 4);
+let bonds = frame.topology().bonds();
+assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+
source

pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error>

Add a copy of residue to this frame.

+
Errors
+

This function fails is the residue id is already in this frame’s +topology, or if the residue contain atoms that are already in another +residue.

+
Example
+
let mut frame = Frame::new();
+
+let residue = Residue::new("foo");
+frame.add_residue(&residue).unwrap();
+
+let topology = frame.topology();
+assert_eq!(topology.residues_count(), 1);
+assert_eq!(topology.residue(0).unwrap().name(), "foo");
+
source

pub fn distance(&self, i: usize, j: usize) -> f64

Get the distance between the atoms at indexes i and j in this frame, +accounting for periodic boundary conditions. The result is expressed in +Angstroms.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+
+assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+
source

pub fn angle(&self, i: usize, j: usize, k: usize) -> f64

Get the angle formed by the atoms at indexes i, j and k in this +frame, accounting for periodic boundary conditions. The result is +expressed in radians.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+
source

pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64

Get the dihedral angle formed by the atoms at indexes i, j, k and +m in this frame, accounting for periodic boundary conditions. The +result is expressed in radians.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+
+assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+
source

pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64

Get the out of plane distance formed by the atoms at indexes i, j, +k and m in this frame, accounting for periodic boundary conditions. +The result is expressed in angstroms.

+

This is the distance between the atom j and the ikm plane. The j atom +is the center of the improper dihedral angle formed by i, j, k and m.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+
+assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+
source

pub fn positions(&self) -> &[[f64; 3]]

Get a view into the positions of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+
+let positions = frame.positions();
+assert_eq!(positions.len(), 67);
+assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+
source

pub fn positions_mut(&mut self) -> &mut [[f64; 3]]

Get a mutable view into the positions of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+{
+    let positions = frame.positions_mut();
+    assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    positions[0] = [1.0, 2.0, 3.0];
+}
+
+let positions = frame.positions();
+assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+
source

pub fn velocities(&self) -> Option<&[[f64; 3]]>

Get a view into the velocities of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+
+let velocities = frame.velocities().expect("missing velocities");
+assert_eq!(velocities.len(), 67);
+assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+
source

pub fn velocities_mut(&mut self) -> Option<&mut [[f64; 3]]>

Get a mutable view into the velocities of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(67);
+frame.add_velocities();
+{
+    let velocities = frame.velocities_mut().expect("missing velocities");
+    assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    velocities[0] = [1.0, 2.0, 3.0];
+}
+
+let velocities = frame.velocities().expect("missing velocities");
+assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+
source

pub fn has_velocities(&self) -> bool

Check if this frame contains velocity data.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+
source

pub fn add_velocities(&mut self)

Add velocity data to this frame. If the frame already have velocities, +this does nothing.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.has_velocities(), false);
+
+frame.add_velocities();
+assert_eq!(frame.has_velocities(), true);
+
source

pub fn cell(&self) -> UnitCellRef<'_>

Get a reference to the UnitCell from this frame.

+
Example
+
let frame = Frame::new();
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Infinite);
+
source

pub fn cell_mut(&mut self) -> UnitCellMut<'_>

Get a mutable reference to the UnitCell from this frame.

+
Example
+
let mut frame = Frame::new();
+
+assert_eq!(frame.cell().shape(), CellShape::Infinite);
+
+frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+
source

pub fn set_cell(&mut self, cell: &UnitCell)

Set the UnitCell of this frame to cell.

+
Example
+
let mut frame = Frame::new();
+
+frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+
+let cell = frame.cell();
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+
source

pub fn topology(&self) -> TopologyRef<'_>

Get a reference to the Topology of this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(42);
+
+let topology = frame.topology();
+assert_eq!(topology.size(), 42);
+
source

pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error>

Set the Topology of this frame to topology.

+
Errors
+

This function fails if the topology contains a different number of atoms +than this frame.

+
Example
+
let mut frame = Frame::new();
+frame.resize(2);
+
+let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Cl"));
+topology.add_atom(&Atom::new("Cl"));
+topology.add_bond(0, 1);
+
+frame.set_topology(&topology).unwrap();
+assert_eq!(frame.atom(0).name(), "Cl");
+
source

pub fn step(&self) -> usize

Get this frame step, i.e. the frame number in the trajectory

+
Example
+
let frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
source

pub fn set_step(&mut self, step: usize)

Set this frame step to step.

+
Example
+
let mut frame = Frame::new();
+assert_eq!(frame.step(), 0);
+
+frame.set_step(10);
+assert_eq!(frame.step(), 10);
+
source

pub fn guess_bonds(&mut self) -> Result<(), Error>

Guess the bonds, angles and dihedrals in this frame.

+

The bonds are guessed using a distance-based algorithm, and then angles +and dihedrals are guessed from the bonds.

+
Errors
+

This function can fail if the covalent radius is unknown for some atoms +in the frame.

+
Example
+
let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+assert_eq!(frame.topology().bonds_count(), 0);
+
+frame.guess_bonds().unwrap();
+assert_eq!(frame.topology().bonds_count(), 1);
+
source

pub fn clear_bonds(&mut self)

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology of the frame.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+
+frame.add_bond(0, 1);
+frame.add_bond(1, 2);
+
+assert_eq!(frame.topology().bonds().len(), 2);
+assert_eq!(frame.topology().angles().len(), 1);
+
+frame.clear_bonds();
+assert!(frame.topology().bonds().is_empty());
+assert!(frame.topology().angles().is_empty());
+
source

pub fn set(&mut self, name: &str, property: impl Into<Property>)

Add a new property with the given name to this frame.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut frame = Frame::new();
+frame.set("a string", "hello");
+frame.set("a double", 4.3);
+
+assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+
+assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(frame.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut frame = Frame::new();
+frame.set("foo", Property::Double(22.2));
+frame.set("bar", Property::Bool(false));
+
+for (name, property) in frame.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+
source

pub fn iter_atoms(&self) -> AtomIter<'_>

Gets an iterator over atoms

+
Example
+
let mut frame = Frame::new();
+
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+
+let mut atoms: Vec<AtomRef> = Vec::new();
+
+for atom in frame.iter_atoms() {
+    atoms.push(atom);
+}
+
+assert_eq!(atoms.len(), 2);
+

Trait Implementations§

source§

impl Clone for Frame

source§

fn clone(&self) -> Frame

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Frame

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Frame

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Frame

§

impl !Send for Frame

§

impl !Sync for Frame

§

impl Unpin for Frame

§

impl UnwindSafe for Frame

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.Match.html b/0.10.40/chemfiles/struct.Match.html new file mode 100644 index 000000000..21c7a7322 --- /dev/null +++ b/0.10.40/chemfiles/struct.Match.html @@ -0,0 +1,39 @@ +Match in chemfiles - Rust

Struct chemfiles::Match

source ·
pub struct Match { /* private fields */ }
Expand description

A Match is a set of atomic indexes matching a given selection. It can +mostly be used like a &[usize].

+

Implementations§

source§

impl Match

source

pub fn len(&self) -> usize

Get the length of the Match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+
source

pub fn new(atoms: &[usize]) -> Match

Create a new match containing the atoms in the atoms slice.

+
Panics
+

If the slice contains more than 4 elements, which is the maximal size +of a match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+assert_eq!(atomic_match.len(), 3);
+assert_eq!(atomic_match[0], 3);
+assert_eq!(atomic_match[1], 4);
+assert_eq!(atomic_match[2], 5);
+
source

pub fn iter(&self) -> Iter<'_, usize>

Iterate over the atomic indexes in the match.

+
Example
+
let atomic_match = Match::new(&[3, 4, 5]);
+let mut iter = atomic_match.iter();
+
+assert_eq!(iter.next(), Some(&3));
+assert_eq!(iter.next(), Some(&4));
+assert_eq!(iter.next(), Some(&5));
+assert_eq!(iter.next(), None);
+

Trait Implementations§

source§

impl Clone for Match

source§

fn clone(&self) -> Match

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Match

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Index<usize> for Match

§

type Output = usize

The returned type after indexing.
source§

fn index(&self, i: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<'a> IntoIterator for &'a Match

§

type Item = &'a usize

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, usize>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<Match> for Match

source§

fn eq(&self, other: &Match) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Match

source§

impl StructuralEq for Match

source§

impl StructuralPartialEq for Match

Auto Trait Implementations§

§

impl RefUnwindSafe for Match

§

impl Send for Match

§

impl Sync for Match

§

impl Unpin for Match

§

impl UnwindSafe for Match

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.MemoryTrajectoryReader.html b/0.10.40/chemfiles/struct.MemoryTrajectoryReader.html new file mode 100644 index 000000000..6863c6248 --- /dev/null +++ b/0.10.40/chemfiles/struct.MemoryTrajectoryReader.html @@ -0,0 +1,133 @@ +MemoryTrajectoryReader in chemfiles - Rust
pub struct MemoryTrajectoryReader<'data> { /* private fields */ }
Expand description

MemoryTrajectoryReader is a handle for a Trajectory in memory.

+

Implementations§

source§

impl<'data> MemoryTrajectoryReader<'data>

source

pub fn new<Data, Format>( + data: Data, + format: Format +) -> Result<MemoryTrajectoryReader<'data>, Error>where + Data: Into<&'data [u8]>, + Format: AsRef<str>,

Read a memory buffer as though it was a formatted file.

+

The memory buffer used to store the file is given using the data +argument. The format parameter is required and should follow the same +rules as in the main Trajectory constructor.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format, or if the format do not support in-memory readers.

+
Example
+
let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+let mut trajectory = MemoryTrajectoryReader::new(aromatics.as_bytes(), "SMI").unwrap();
+let mut frame = Frame::new();
+trajectory.read(&mut frame).unwrap();
+assert_eq!(frame.size(), 6);
+

Methods from Deref<Target = Trajectory>§

source

pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error>

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+
source

pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error>

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+
source

pub fn write(&mut self, frame: &Frame) -> Result<(), Error>

Write a frame to this trajectory.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+
source

pub fn set_topology(&mut self, topology: &Topology)

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+
Example
+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+
source

pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>where + P: AsRef<Path>,

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+
source

pub fn set_topology_with_format<'a, P, S>( + &mut self, + path: P, + format: S +) -> Result<(), Error>where + P: AsRef<Path>, + S: Into<&'a str>,

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+
source

pub fn set_cell(&mut self, cell: &UnitCell)

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+
source

pub fn nsteps(&mut self) -> usize

Get the number of steps (the number of frames) in a trajectory.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+
source

pub fn memory_buffer(&self) -> Result<&str, Error>

Obtain the memory buffer written to by the trajectory.

+
Errors
+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+
Example
+
let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+
source

pub fn path(&self) -> String

Get file path for this trajectory.

+
Example
+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations§

source§

impl<'a> Deref for MemoryTrajectoryReader<'a>

§

type Target = Trajectory

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> DerefMut for MemoryTrajectoryReader<'a>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'data> RefUnwindSafe for MemoryTrajectoryReader<'data>

§

impl<'data> !Send for MemoryTrajectoryReader<'data>

§

impl<'data> !Sync for MemoryTrajectoryReader<'data>

§

impl<'data> Unpin for MemoryTrajectoryReader<'data>

§

impl<'data> UnwindSafe for MemoryTrajectoryReader<'data>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.PropertiesIter.html b/0.10.40/chemfiles/struct.PropertiesIter.html new file mode 100644 index 000000000..38bd08a2c --- /dev/null +++ b/0.10.40/chemfiles/struct.PropertiesIter.html @@ -0,0 +1,185 @@ +PropertiesIter in chemfiles - Rust
pub struct PropertiesIter<'a> { /* private fields */ }
Expand description

An iterator over the properties in an atom/frame/residue

+

Trait Implementations§

source§

impl<'a> Iterator for PropertiesIter<'a>

§

type Item = (String, Property)

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
source§

fn count(self) -> usize

Consumes the iterator, counting the number of iterations and returning it. Read more
source§

fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · source§

fn last(self) -> Option<Self::Item>where + Self: Sized,

Consumes the iterator, returning the last element. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Selfwhere + Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> Bwhere + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> boolwhere + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> Rwhere + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · source§

fn fold<B, F>(self, init: B, f: F) -> Bwhere + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
source§

fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
source§

fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> Swhere + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> Pwhere + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> boolwhere + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd<K>,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for PropertiesIter<'a>

§

impl<'a> !Send for PropertiesIter<'a>

§

impl<'a> !Sync for PropertiesIter<'a>

§

impl<'a> Unpin for PropertiesIter<'a>

§

impl<'a> !UnwindSafe for PropertiesIter<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<I> IntoIterator for Iwhere + I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.Residue.html b/0.10.40/chemfiles/struct.Residue.html new file mode 100644 index 000000000..4d4291492 --- /dev/null +++ b/0.10.40/chemfiles/struct.Residue.html @@ -0,0 +1,100 @@ +Residue in chemfiles - Rust

Struct chemfiles::Residue

source ·
pub struct Residue { /* private fields */ }
Expand description

A Residue is a group of atoms belonging to the same logical unit. They +can be small molecules, amino-acids in a protein, monomers in polymers, +etc.

+

Implementations§

source§

impl Residue

source

pub fn new<'a>(name: impl Into<&'a str>) -> Residue

Create a new residue with the given name

+
Example
+
let residue = Residue::new("ALA");
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), None);
+
source

pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue

Create a new residue with the given name and id as identifier.

+
Example
+
let residue = Residue::with_id("ALA", 67);
+assert_eq!(residue.name(), "ALA");
+assert_eq!(residue.id(), Some(67));
+
source

pub fn size(&self) -> usize

Get the number of atoms in this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+
source

pub fn id(&self) -> Option<i64>

Get the identifier of this residue in the initial topology file.

+
Example
+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+
source

pub fn name(&self) -> String

Get the name of this residue.

+
Example
+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+
source

pub fn add_atom(&mut self, atom: usize)

Add the atom at index atom in this residue.

+

This will fail if the atom is already in the residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+assert_eq!(residue.contains(56), true);
+
+// Adding the same atom twice is fine
+residue.add_atom(56);
+assert_eq!(residue.size(), 1);
+
source

pub fn contains(&self, atom: usize) -> bool

Check if the atom at index i is in this residue

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+
source

pub fn atoms(&self) -> Vec<usize>

Get the list of atoms of this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+
source

pub fn set(&mut self, name: &str, property: impl Into<Property>)

Add a new property with the given name to this residue.

+

If a property with the same name already exists, this function override +the existing property with the new one.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("a string", "hello");
+residue.set("a double", 3.2);
+
+assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl Clone for Residue

source§

fn clone(&self) -> Residue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Residue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Residue

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.ResidueRef.html b/0.10.40/chemfiles/struct.ResidueRef.html new file mode 100644 index 000000000..323047d80 --- /dev/null +++ b/0.10.40/chemfiles/struct.ResidueRef.html @@ -0,0 +1,63 @@ +ResidueRef in chemfiles - Rust

Struct chemfiles::ResidueRef

source ·
pub struct ResidueRef<'a> { /* private fields */ }
Expand description

An analog to a reference to a residue (&Residue)

+

Methods from Deref<Target = Residue>§

source

pub fn size(&self) -> usize

Get the number of atoms in this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.size(), 0);
+
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+assert_eq!(residue.size(), 3);
+
source

pub fn id(&self) -> Option<i64>

Get the identifier of this residue in the initial topology file.

+
Example
+
let residue = Residue::with_id("", 42);
+assert_eq!(residue.id(), Some(42));
+
source

pub fn name(&self) -> String

Get the name of this residue.

+
Example
+
let residue = Residue::new("water");
+assert_eq!(residue.name(), "water");
+
source

pub fn contains(&self, atom: usize) -> bool

Check if the atom at index i is in this residue

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.contains(56), false);
+
+residue.add_atom(56);
+assert_eq!(residue.contains(56), true);
+
source

pub fn atoms(&self) -> Vec<usize>

Get the list of atoms of this residue.

+
Example
+
let mut residue = Residue::new("water");
+assert_eq!(residue.atoms(), vec![]);
+
+residue.add_atom(56);
+assert_eq!(residue.atoms(), vec![56]);
+
source

pub fn get(&self, name: &str) -> Option<Property>

Get a property with the given name in this frame, if it exist.

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+
+assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+assert_eq!(residue.get("Bar"), None);
+
source

pub fn properties(&self) -> PropertiesIter<'_>

Get an iterator over all (name, property) pairs for this frame

+
Examples
+
let mut residue = Residue::new("ALA");
+residue.set("foo", Property::Double(22.2));
+residue.set("bar", Property::Bool(false));
+
+for (name, property) in residue.properties() {
+    if name == "foo" {
+        assert_eq!(property, Property::Double(22.2));
+    } else if name == "bar" {
+        assert_eq!(property, Property::Bool(false));
+    }
+}
+

Trait Implementations§

source§

impl<'a> Debug for ResidueRef<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for ResidueRef<'a>

§

type Target = Residue

The resulting type after dereferencing.
source§

fn deref(&self) -> &Residue

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for ResidueRef<'a>

§

impl<'a> !Send for ResidueRef<'a>

§

impl<'a> !Sync for ResidueRef<'a>

§

impl<'a> Unpin for ResidueRef<'a>

§

impl<'a> UnwindSafe for ResidueRef<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.Selection.html b/0.10.40/chemfiles/struct.Selection.html new file mode 100644 index 000000000..c6f6b62ca --- /dev/null +++ b/0.10.40/chemfiles/struct.Selection.html @@ -0,0 +1,69 @@ +Selection in chemfiles - Rust

Struct chemfiles::Selection

source ·
pub struct Selection { /* private fields */ }
Expand description

A Selection allow to select atoms in a Frame, from a selection +language. The selection language is built by combining basic operations. +Each basic operation follows the <selector>[(<variable>)] <operator> <value> structure, where <operator> is a comparison operator in +== != < <= > >=.

+

Implementations§

source§

impl Selection

source

pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error>

Create a new selection from the given selection string.

+
Errors
+

This function fails if the selection string is invalid.

+
Example
+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+
source

pub fn size(&self) -> usize

Get the size of the selection, i.e. the number of atoms we are selecting +together.

+

This value is 1 for the ‘atom’ context, 2 for the ‘pair’ and ‘bond’ +context, 3 for the ‘three’ and ‘angles’ context and 4 for the ‘four’ +and ‘dihedral’ context.

+
Example
+
let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+assert_eq!(selection.size(), 2);
+
source

pub fn string(&self) -> String

Get the selection string used to create this selection.

+
Example
+
let selection = Selection::new("name H").unwrap();
+assert_eq!(selection.string(), "name H");
+
source

pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match>

Evaluate a selection for a given frame, and return the corresponding +matches.

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+let matches = selection.evaluate(&frame);
+
+assert_eq!(matches.len(), 2);
+
+assert_eq!(matches[0].len(), 2);
+assert_eq!(matches[0][0], 0);
+assert_eq!(matches[0][1], 1);
+
+assert_eq!(matches[1].len(), 2);
+assert_eq!(matches[1][0], 2);
+assert_eq!(matches[1][1], 1);
+
source

pub fn list(&mut self, frame: &Frame) -> Vec<usize>

Evaluates a selection of size 1 on a given frame. This function +returns the list of atomic indexes in the frame matching this selection.

+
Panics
+

If the selection size is not 1

+
Example
+
let mut frame = Frame::new();
+frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+
+let mut selection = Selection::new("name H").unwrap();
+let matches = selection.list(&frame);
+
+assert_eq!(matches.len(), 2);
+assert_eq!(matches[0], 0);
+assert_eq!(matches[1], 2);
+

Trait Implementations§

source§

impl Clone for Selection

source§

fn clone(&self) -> Selection

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Selection

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Selection

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.Topology.html b/0.10.40/chemfiles/struct.Topology.html new file mode 100644 index 000000000..65c601356 --- /dev/null +++ b/0.10.40/chemfiles/struct.Topology.html @@ -0,0 +1,277 @@ +Topology in chemfiles - Rust

Struct chemfiles::Topology

source ·
pub struct Topology { /* private fields */ }
Expand description

A Topology contains the definition of all the atoms in the system, and +the liaisons between the atoms (bonds, angles, dihedrals, …). It will +also contain all the residues information if it is available.

+

Implementations§

source§

impl Topology

source

pub fn new() -> Topology

Create a new empty topology.

+
Example
+
let topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
source

pub fn atom(&self, index: usize) -> AtomRef<'_>

Get a reference of the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+
source

pub fn atom_mut(&mut self, index: usize) -> AtomMut<'_>

Get a mutable reference to the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+assert_eq!(topology.atom(4).name(), "");
+
+topology.atom_mut(4).set_name("Fe");
+assert_eq!(topology.atom(4).name(), "Fe");
+
source

pub fn size(&self) -> usize

Get the current number of atoms in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+
source

pub fn resize(&mut self, natoms: usize)

Resize this topology to hold natoms atoms, inserting dummy atoms if +the new size if bigger than the old one.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+
source

pub fn add_atom(&mut self, atom: &Atom)

Add an Atom at the end of this topology

+
Example
+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("Mg"));
+
+let atom = topology.atom(0);
+assert_eq!(atom.name(), "Mg");
+
source

pub fn remove(&mut self, index: usize)

Remove an Atom from this topology by index. This modify all the +other atoms indexes.

+
Panics
+

If the index is out of bounds

+
Example
+
let mut topology = Topology::new();
+topology.resize(9);
+assert_eq!(topology.size(), 9);
+
+topology.remove(7);
+assert_eq!(topology.size(), 8);
+
source

pub fn bonds_count(&self) -> usize

Get the number of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+
source

pub fn angles_count(&self) -> usize

Get the number of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+
source

pub fn dihedrals_count(&self) -> usize

Get the number of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+
source

pub fn impropers_count(&self) -> usize

Get the number of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+
source

pub fn bonds(&self) -> Vec<[usize; 2]>

Get the list of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+
source

pub fn angles(&self) -> Vec<[usize; 3]>

Get the list of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+
source

pub fn dihedrals(&self) -> Vec<[usize; 4]>

Get the list of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+
source

pub fn impropers(&self) -> Vec<[usize; 4]>

Get the list of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+
source

pub fn clear_bonds(&mut self)

Remove all existing bonds, angles, dihedral angles and improper +dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+assert_eq!(topology.angles().len(), 1);
+
+topology.clear_bonds();
+assert!(topology.bonds().is_empty());
+assert!(topology.angles().is_empty());
+
source

pub fn add_bond(&mut self, i: usize, j: usize)

Add a bond between the atoms at indexes i and j in the topology.

+

The bond order is set to BondOrder::Unknown.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+
source

pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder)

Add a bond between the atoms at indexes i and j in the topology +with the given bond order.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+
source

pub fn bond_order(&self, i: usize, j: usize) -> BondOrder

Get the bond order for the bond between the atoms at indexes i and +j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+
source

pub fn bond_orders(&self) -> Vec<BondOrder>

Get the bond order for all the bonds in the topology

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+
source

pub fn remove_bond(&mut self, i: usize, j: usize)

Remove any existing bond between the atoms at indexes i and j in +this topology.

+

This function does nothing if there is no bond between i and j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+assert_eq!(topology.bonds_count(), 2);
+
+topology.remove_bond(0, 1);
+assert_eq!(topology.bonds_count(), 1);
+
+// Removing a bond that does not exists is fine
+topology.remove_bond(0, 2);
+assert_eq!(topology.bonds_count(), 1);
+
source

pub fn residue(&self, index: usize) -> Option<ResidueRef<'_>>

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+
source

pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef<'_>>

Get a copy of the residue containing the atom at index index in this +topology, if any.

+
Example
+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+
source

pub fn residues_count(&self) -> u64

Get the number of residues in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+
source

pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error>

Add a residue to this topology.

+
Errors
+

This function fails is the residue id is not already in the topology, +or if the residue contains atoms that are already in another residue.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+
source

pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+
Example
+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations§

source§

impl Clone for Topology

source§

fn clone(&self) -> Topology

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Topology

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Topology

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.TopologyRef.html b/0.10.40/chemfiles/struct.TopologyRef.html new file mode 100644 index 000000000..3c0544476 --- /dev/null +++ b/0.10.40/chemfiles/struct.TopologyRef.html @@ -0,0 +1,170 @@ +TopologyRef in chemfiles - Rust

Struct chemfiles::TopologyRef

source ·
pub struct TopologyRef<'a> { /* private fields */ }
Expand description

An analog to a reference to a topology (&Topology)

+

Methods from Deref<Target = Topology>§

source

pub fn atom(&self, index: usize) -> AtomRef<'_>

Get a reference of the atom at the given index in this topology.

+
Panics
+

If index is out of bounds.

+
Example
+
let mut topology = Topology::new();
+topology.resize(6);
+
+let atom = topology.atom(4);
+assert_eq!(atom.name(), "");
+
source

pub fn size(&self) -> usize

Get the current number of atoms in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.size(), 0);
+
+topology.resize(6);
+assert_eq!(topology.size(), 6);
+
source

pub fn bonds_count(&self) -> usize

Get the number of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds_count(), 3);
+
source

pub fn angles_count(&self) -> usize

Get the number of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.angles_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles_count(), 2);
+
source

pub fn dihedrals_count(&self) -> usize

Get the number of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.dihedrals_count(), 1);
+
source

pub fn impropers_count(&self) -> usize

Get the number of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.dihedrals_count(), 0);
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+assert_eq!(topology.impropers_count(), 1);
+
source

pub fn bonds(&self) -> Vec<[usize; 2]>

Get the list of bonds in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+
source

pub fn angles(&self) -> Vec<[usize; 3]>

Get the list of angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+
source

pub fn dihedrals(&self) -> Vec<[usize; 4]>

Get the list of dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(2, 1);
+topology.add_bond(2, 3);
+
+assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+
source

pub fn impropers(&self) -> Vec<[usize; 4]>

Get the list of improper dihedral angles in the topology.

+
Example
+
let mut topology = Topology::new();
+topology.resize(4);
+
+topology.add_bond(0, 1);
+topology.add_bond(0, 2);
+topology.add_bond(0, 3);
+
+assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+
source

pub fn bond_order(&self, i: usize, j: usize) -> BondOrder

Get the bond order for the bond between the atoms at indexes i and +j.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(2);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+
source

pub fn bond_orders(&self) -> Vec<BondOrder>

Get the bond order for all the bonds in the topology

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.bonds_count(), 0);
+topology.resize(3);
+
+topology.add_bond_with_order(0, 1, BondOrder::Double);
+topology.add_bond_with_order(0, 2, BondOrder::Single);
+
+assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+
source

pub fn residue(&self, index: usize) -> Option<ResidueRef<'_>>

Get a reference to the residue at index index from this topology.

+

The residue index in the topology is not always the same as the residue +id.

+
Example
+
let mut topology = Topology::new();
+topology.add_residue(&Residue::new("water")).unwrap();
+
+let residue = topology.residue(0).unwrap();
+assert_eq!(residue.name(), "water");
+
source

pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef<'_>>

Get a copy of the residue containing the atom at index index in this +topology, if any.

+
Example
+
let mut topology = Topology::new();
+topology.resize(8);
+
+let mut residue = Residue::new("water");
+residue.add_atom(0);
+residue.add_atom(1);
+residue.add_atom(2);
+topology.add_residue(&residue).unwrap();
+
+let residue = topology.residue_for_atom(0).unwrap();
+assert_eq!(residue.name(), "water");
+
+assert!(topology.residue_for_atom(6).is_none());
+
source

pub fn residues_count(&self) -> u64

Get the number of residues in this topology.

+
Example
+
let mut topology = Topology::new();
+assert_eq!(topology.residues_count(), 0);
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+assert_eq!(topology.residues_count(), 2);
+
source

pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool

Check if the two residues first and second from the topology are +linked together, i.e. if there is a bond between one atom in the +first residue and one atom in the second one.

+
Example
+
let mut topology = Topology::new();
+
+topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+
+let first = topology.residue(0).unwrap();
+let second = topology.residue(1).unwrap();
+assert_eq!(topology.are_linked(&first, &second), false);
+

Trait Implementations§

source§

impl<'a> Debug for TopologyRef<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for TopologyRef<'a>

§

type Target = Topology

The resulting type after dereferencing.
source§

fn deref(&self) -> &Topology

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for TopologyRef<'a>

§

impl<'a> !Send for TopologyRef<'a>

§

impl<'a> !Sync for TopologyRef<'a>

§

impl<'a> Unpin for TopologyRef<'a>

§

impl<'a> UnwindSafe for TopologyRef<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.Trajectory.html b/0.10.40/chemfiles/struct.Trajectory.html new file mode 100644 index 000000000..baf8da589 --- /dev/null +++ b/0.10.40/chemfiles/struct.Trajectory.html @@ -0,0 +1,159 @@ +Trajectory in chemfiles - Rust

Struct chemfiles::Trajectory

source ·
pub struct Trajectory { /* private fields */ }
Expand description

The Trajectory type is the main entry point when using chemfiles. A +Trajectory behave a bit like a file, allowing to read and/or write +Frame.

+

Implementations§

source§

impl Trajectory

source

pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>where + P: AsRef<Path>,

Open the file at the given path in the given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+
Errors
+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+
Example
+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
source

pub fn open_with_format<'a, P, S>( + filename: P, + mode: char, + format: S +) -> Result<Trajectory, Error>where + P: AsRef<Path>, + S: Into<&'a str>,

Open the file at the given path using a specific file format and the +given mode.

+

Valid modes are 'r' for read, 'w' for write and 'a' for append.

+

Specifying a format is needed when the file format does not match the +extension, or when there is not standard extension for this format. If +format is an empty string, the format will be guessed from the +extension.

+
Errors
+

This function fails if the file is not accessible for the given mode, if +it is incorrectly formatted for the corresponding format, or in case of +I/O errors from the OS.

+
Example
+
let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+
source

pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>where + S: Into<&'a str>,

Write to a memory buffer as though it was a formatted file.

+

The format parameter should follow the same rules as in the main +Trajectory constructor, except that compression specification +is not supported.

+

The memory_buffer function can be used to retrieve the data written +to memory of the Trajectory.

+
Errors
+

This function fails if the format do not support in-memory writers.

+
Example
+
let trajectory_memory = Trajectory::memory_writer("SMI");
+
+// Binary formats typically do not support this feature
+assert!(Trajectory::memory_writer("XTC").is_err());
+
source

pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error>

Read the next step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of atom +in the next step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read(&mut frame).unwrap();
+
source

pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error>

Read a specific step of this trajectory into a frame.

+

If the number of atoms in frame does not correspond to the number of +atom at this step, the frame is resized.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+let mut frame = Frame::new();
+
+trajectory.read_step(10, &mut frame).unwrap();
+
source

pub fn write(&mut self, frame: &Frame) -> Result<(), Error>

Write a frame to this trajectory.

+
Errors
+

This function fails if the data is incorrectly formatted for the +corresponding format.

+
Example
+
let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+let mut frame = Frame::new();
+
+trajectory.write(&mut frame).unwrap();
+
source

pub fn set_topology(&mut self, topology: &Topology)

Set the topology associated with this trajectory. This topology will +be used when reading and writing the files, replacing any topology in +the frames or files.

+
Example
+
let mut topology = Topology::new();
+topology.add_atom(&Atom::new("H"));
+topology.add_atom(&Atom::new("O"));
+topology.add_atom(&Atom::new("H"));
+topology.add_bond(0, 1);
+topology.add_bond(1, 2);
+
+let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_topology(&topology);
+
source

pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>where + P: AsRef<Path>,

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in format; +and extracting the topology of this frame.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_file("topology.pdb").unwrap();
+
source

pub fn set_topology_with_format<'a, P, S>( + &mut self, + path: P, + format: S +) -> Result<(), Error>where + P: AsRef<Path>, + S: Into<&'a str>,

Set the topology associated with this trajectory by reading the first +frame of the file at the given path using the file format in +format; and extracting the topology of this frame.

+

If format is an empty string, the format will be guessed from the +path extension.

+
Errors
+

This function fails if the topology file is incorrectly formatted for +the corresponding format, or in case of I/O errors from the OS.

+
Example
+
let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+
source

pub fn set_cell(&mut self, cell: &UnitCell)

Set the unit cell associated with a trajectory. This cell will be +used when reading and writing the files, replacing any unit cell in the +frames or files.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+
source

pub fn nsteps(&mut self) -> usize

Get the number of steps (the number of frames) in a trajectory.

+
Example
+
let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+println!("This trajectory contains {} steps", trajectory.nsteps());
+
source

pub fn memory_buffer(&self) -> Result<&str, Error>

Obtain the memory buffer written to by the trajectory.

+
Errors
+

This fails if the trajectory was not opened with +Trajectory::memory_writer.

+
Example
+
let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+
+let mut frame = Frame::new();
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+frame.add_bond_with_order(0, 1, BondOrder::Single);
+
+trajectory_memory.write(&frame).unwrap();
+
+let result = trajectory_memory.memory_buffer();
+assert_eq!(result.unwrap(), "CC\n");
+
source

pub fn path(&self) -> String

Get file path for this trajectory.

+
Example
+
let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+
+assert_eq!(trajectory.path(), "water.xyz");
+

Trait Implementations§

source§

impl Debug for Trajectory

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Trajectory

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.UnitCell.html b/0.10.40/chemfiles/struct.UnitCell.html new file mode 100644 index 000000000..c43e16382 --- /dev/null +++ b/0.10.40/chemfiles/struct.UnitCell.html @@ -0,0 +1,143 @@ +UnitCell in chemfiles - Rust

Struct chemfiles::UnitCell

source ·
pub struct UnitCell { /* private fields */ }
Expand description

An UnitCell represent the box containing the atoms, and its periodicity.

+

An unit cell is fully represented by three lengths (a, b, c); and three +angles (alpha, beta, gamma). The angles are stored in degrees, and the +lengths in Angstroms.

+

A cell also has a matricial representation, by projecting the three base +vector into an orthonormal base. We choose to represent such matrix as an +upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+

Implementations§

source§

impl UnitCell

source

pub fn new(lengths: [f64; 3]) -> UnitCell

Create an Orthorhombic UnitCell from the three lengths, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn infinite() -> UnitCell

Create an Infinite UnitCell.

+
Example
+
let cell = UnitCell::infinite();
+
+assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Infinite);
+
source

pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell

Create an Triclinic UnitCell from the three lengths (in Angstroms) +and three angles (in degree). alpha is the angle between the vectors +b and c; beta is the between the vectors a and c and gamma +is the angle between the vectors a and b.

+
Example
+
let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+
+assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+assert_eq!(cell.angles()[0], 98.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+assert_eq!(cell.shape(), CellShape::Triclinic);
+
source

pub fn from_matrix(matrix: [[f64; 3]; 3]) -> UnitCell

Create an UnitCell from a cell matrix. If matrix contains only +zeros, then an Infinite cell is created. If only the diagonal of the +matrix is non-zero, then the cell is Orthorhombic. Else a +Triclinic cell is created. The matrix entries should be in Angstroms.

+
Panics
+

If the matrix has a negative determinant, or more generally is not +representing a unit cell.

+
Example
+
let cell = UnitCell::from_matrix([
+    [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+]);
+
+assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn lengths(&self) -> [f64; 3]

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+
source

pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error>

Set the three lengths of the cell, in Angstroms.

+
Errors
+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+
Example
+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+
source

pub fn angles(&self) -> [f64; 3]

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
source

pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error>

Set the three angles of the cell, in degrees.

+
Errors
+

This function fails if the unit cell is not Triclinic.

+
Example
+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
source

pub fn matrix(&self) -> [[f64; 3]; 3]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+
source

pub fn shape(&self) -> CellShape

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error>

Set the shape of the unit cell to shape.

+
Errors
+

This can fail if the cell length or angles are incompatible with the +new shape.

+
Example
+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+
source

pub fn volume(&self) -> f64

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+
source

pub fn wrap(&self, vector: &mut [f64; 3])

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations§

source§

impl Clone for UnitCell

source§

fn clone(&self) -> UnitCell

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UnitCell

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for UnitCell

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.UnitCellMut.html b/0.10.40/chemfiles/struct.UnitCellMut.html new file mode 100644 index 000000000..c7b4f3117 --- /dev/null +++ b/0.10.40/chemfiles/struct.UnitCellMut.html @@ -0,0 +1,91 @@ +UnitCellMut in chemfiles - Rust

Struct chemfiles::UnitCellMut

source ·
pub struct UnitCellMut<'a> { /* private fields */ }
Expand description

An analog to a mutable reference to an unit cell (&mut UnitCell)

+

Methods from Deref<Target = UnitCell>§

source

pub fn lengths(&self) -> [f64; 3]

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+
source

pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error>

Set the three lengths of the cell, in Angstroms.

+
Errors
+

This function fails if the unit cell is infinite, or if one of the +lengths is negative.

+
Example
+
let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+
+cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+
+assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+
source

pub fn angles(&self) -> [f64; 3]

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
source

pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error>

Set the three angles of the cell, in degrees.

+
Errors
+

This function fails if the unit cell is not Triclinic.

+
Example
+
let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
+cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
source

pub fn matrix(&self) -> [[f64; 3]; 3]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+
source

pub fn shape(&self) -> CellShape

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error>

Set the shape of the unit cell to shape.

+
Errors
+

This can fail if the cell length or angles are incompatible with the +new shape.

+
Example
+
let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+cell.set_shape(CellShape::Triclinic).unwrap();
+assert_eq!(cell.shape(), CellShape::Triclinic);
+
source

pub fn volume(&self) -> f64

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+
source

pub fn wrap(&self, vector: &mut [f64; 3])

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations§

source§

impl<'a> Debug for UnitCellMut<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for UnitCellMut<'a>

§

type Target = UnitCell

The resulting type after dereferencing.
source§

fn deref(&self) -> &UnitCell

Dereferences the value.
source§

impl<'a> DerefMut for UnitCellMut<'a>

source§

fn deref_mut(&mut self) -> &mut UnitCell

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for UnitCellMut<'a>

§

impl<'a> !Send for UnitCellMut<'a>

§

impl<'a> !Sync for UnitCellMut<'a>

§

impl<'a> Unpin for UnitCellMut<'a>

§

impl<'a> !UnwindSafe for UnitCellMut<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/struct.UnitCellRef.html b/0.10.40/chemfiles/struct.UnitCellRef.html new file mode 100644 index 000000000..c0daa6d39 --- /dev/null +++ b/0.10.40/chemfiles/struct.UnitCellRef.html @@ -0,0 +1,58 @@ +UnitCellRef in chemfiles - Rust

Struct chemfiles::UnitCellRef

source ·
pub struct UnitCellRef<'a> { /* private fields */ }
Expand description

An analog to a reference to an unit cell (&UnitCell)

+

Methods from Deref<Target = UnitCell>§

source

pub fn lengths(&self) -> [f64; 3]

Get the three lengths of the cell, in Angstroms.

+
Example
+
let cell = UnitCell::new([30.0, 30.0, 23.0]);
+assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+
source

pub fn angles(&self) -> [f64; 3]

Get the three angles of the cell, in degrees.

+
Example
+
let cell = UnitCell::new([20.0, 20.0, 20.0]);
+assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+
+let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+assert_eq!(cell.angles()[0], 100.0);
+// Rounding errors might occur due to internal representation
+assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+assert_eq!(cell.angles()[2], 90.0);
+
source

pub fn matrix(&self) -> [[f64; 3]; 3]

Get the unit cell matricial representation.

+

The unit cell representation is obtained by aligning the a vector along +the x axis and putting the b vector in the xy plane. This make the +matrix an upper triangular matrix:

+
| a_x   b_x   c_x |
+|  0    b_y   c_y |
+|  0     0    c_z |
+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let matrix = cell.matrix();
+
+assert_eq!(matrix[0][0], 10.0);
+assert_eq!(matrix[1][1], 20.0);
+assert_eq!(matrix[2][2], 30.0);
+
+assert!(matrix[1][2].abs() < 1e-9);
+
source

pub fn shape(&self) -> CellShape

Get the shape of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
source

pub fn volume(&self) -> f64

Get the volume of the unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+
source

pub fn wrap(&self, vector: &mut [f64; 3])

Wrap a vector in this unit cell.

+
Example
+
let cell = UnitCell::new([10.0, 20.0, 30.0]);
+
+let mut vector = [12.0, 5.2, -45.3];
+cell.wrap(&mut vector);
+assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+

Trait Implementations§

source§

impl<'a> Debug for UnitCellRef<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Deref for UnitCellRef<'a>

§

type Target = UnitCell

The resulting type after dereferencing.
source§

fn deref(&self) -> &UnitCell

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for UnitCellRef<'a>

§

impl<'a> !Send for UnitCellRef<'a>

§

impl<'a> !Sync for UnitCellRef<'a>

§

impl<'a> Unpin for UnitCellRef<'a>

§

impl<'a> UnwindSafe for UnitCellRef<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere + T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

+

That is, this conversion is whatever the implementation of +From<T> for U chooses to do.

+
source§

impl<T, U> TryFrom<U> for Twhere + U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere + U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
\ No newline at end of file diff --git a/0.10.40/chemfiles/topology/enum.BondOrder.html b/0.10.40/chemfiles/topology/enum.BondOrder.html new file mode 100644 index 000000000..14589bc12 --- /dev/null +++ b/0.10.40/chemfiles/topology/enum.BondOrder.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/enum.BondOrder.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/topology/struct.Topology.html b/0.10.40/chemfiles/topology/struct.Topology.html new file mode 100644 index 000000000..1215dacfd --- /dev/null +++ b/0.10.40/chemfiles/topology/struct.Topology.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Topology.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/topology/struct.TopologyRef.html b/0.10.40/chemfiles/topology/struct.TopologyRef.html new file mode 100644 index 000000000..7cdec6164 --- /dev/null +++ b/0.10.40/chemfiles/topology/struct.TopologyRef.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.TopologyRef.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/trajectory/struct.MemoryTrajectoryReader.html b/0.10.40/chemfiles/trajectory/struct.MemoryTrajectoryReader.html new file mode 100644 index 000000000..2d8d0b029 --- /dev/null +++ b/0.10.40/chemfiles/trajectory/struct.MemoryTrajectoryReader.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.MemoryTrajectoryReader.html...

+ + + \ No newline at end of file diff --git a/0.10.40/chemfiles/trajectory/struct.Trajectory.html b/0.10.40/chemfiles/trajectory/struct.Trajectory.html new file mode 100644 index 000000000..bab83ffc9 --- /dev/null +++ b/0.10.40/chemfiles/trajectory/struct.Trajectory.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../chemfiles/struct.Trajectory.html...

+ + + \ No newline at end of file diff --git a/0.10.40/crates.js b/0.10.40/crates.js new file mode 100644 index 000000000..833ec8f70 --- /dev/null +++ b/0.10.40/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["chemfiles"]; \ No newline at end of file diff --git a/0.10.40/help.html b/0.10.40/help.html new file mode 100644 index 000000000..b73ce6d22 --- /dev/null +++ b/0.10.40/help.html @@ -0,0 +1 @@ +Rustdoc help

Rustdoc help

Back
\ No newline at end of file diff --git a/0.10.40/implementors/core/clone/trait.Clone.js b/0.10.40/implementors/core/clone/trait.Clone.js new file mode 100644 index 000000000..f284ac665 --- /dev/null +++ b/0.10.40/implementors/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Clone for Status"],["impl Clone for Error"],["impl Clone for FormatMetadata"],["impl Clone for Frame"],["impl Clone for Residue"],["impl Clone for Atom"],["impl Clone for Property"],["impl Clone for Selection"],["impl Clone for BondOrder"],["impl Clone for CellShape"],["impl Clone for UnitCell"],["impl Clone for Match"],["impl Clone for Topology"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/cmp/trait.Eq.js b/0.10.40/implementors/core/cmp/trait.Eq.js new file mode 100644 index 000000000..27c214d24 --- /dev/null +++ b/0.10.40/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Eq for Error"],["impl Eq for Status"],["impl Eq for Match"],["impl Eq for BondOrder"],["impl Eq for CellShape"],["impl Eq for FormatMetadata"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/cmp/trait.Ord.js b/0.10.40/implementors/core/cmp/trait.Ord.js new file mode 100644 index 000000000..561fafab5 --- /dev/null +++ b/0.10.40/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Ord for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/cmp/trait.PartialEq.js b/0.10.40/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..4a7184db4 --- /dev/null +++ b/0.10.40/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl PartialEq<Property> for Property"],["impl PartialEq<CellShape> for CellShape"],["impl PartialEq<Match> for Match"],["impl PartialEq<Status> for Status"],["impl PartialEq<FormatMetadata> for FormatMetadata"],["impl PartialEq<Error> for Error"],["impl PartialEq<BondOrder> for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/cmp/trait.PartialOrd.js b/0.10.40/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..2469006df --- /dev/null +++ b/0.10.40/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl PartialOrd<Property> for Property"],["impl PartialOrd<BondOrder> for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/convert/trait.From.js b/0.10.40/implementors/core/convert/trait.From.js new file mode 100644 index 000000000..48c80525d --- /dev/null +++ b/0.10.40/implementors/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> From<&'a str> for Property"],["impl From<chfl_status> for Error"],["impl From<CellShape> for chfl_cellshape"],["impl From<bool> for Property"],["impl From<Utf8Error> for Error"],["impl From<String> for Property"],["impl From<chfl_cellshape> for CellShape"],["impl From<f64> for Property"],["impl From<chfl_bond_order> for BondOrder"],["impl From<[f64; 3]> for Property"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/error/trait.Error.js b/0.10.40/implementors/core/error/trait.Error.js new file mode 100644 index 000000000..722e02b82 --- /dev/null +++ b/0.10.40/implementors/core/error/trait.Error.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Error for Error"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/fmt/trait.Debug.js b/0.10.40/implementors/core/fmt/trait.Debug.js new file mode 100644 index 000000000..049d79b5c --- /dev/null +++ b/0.10.40/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Debug for Selection"],["impl<'a> Debug for AtomRef<'a>"],["impl Debug for Error"],["impl Debug for FormatMetadata"],["impl<'a> Debug for TopologyRef<'a>"],["impl Debug for BondOrder"],["impl Debug for Match"],["impl Debug for Frame"],["impl<'a> Debug for UnitCellRef<'a>"],["impl Debug for Topology"],["impl Debug for Atom"],["impl<'a> Debug for UnitCellMut<'a>"],["impl<'a> Debug for ResidueRef<'a>"],["impl Debug for Trajectory"],["impl Debug for Residue"],["impl<'a> Debug for AtomMut<'a>"],["impl Debug for UnitCell"],["impl Debug for Property"],["impl Debug for CellShape"],["impl Debug for Status"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/fmt/trait.Display.js b/0.10.40/implementors/core/fmt/trait.Display.js new file mode 100644 index 000000000..7ce344649 --- /dev/null +++ b/0.10.40/implementors/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Display for Error"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/iter/traits/collect/trait.IntoIterator.js b/0.10.40/implementors/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 000000000..628b8c5e3 --- /dev/null +++ b/0.10.40/implementors/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> IntoIterator for &'a Match"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/iter/traits/iterator/trait.Iterator.js b/0.10.40/implementors/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 000000000..b5e5452ba --- /dev/null +++ b/0.10.40/implementors/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> Iterator for PropertiesIter<'a>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/marker/trait.Copy.js b/0.10.40/implementors/core/marker/trait.Copy.js new file mode 100644 index 000000000..f38a2e214 --- /dev/null +++ b/0.10.40/implementors/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Copy for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/marker/trait.Freeze.js b/0.10.40/implementors/core/marker/trait.Freeze.js new file mode 100644 index 000000000..b8a14d050 --- /dev/null +++ b/0.10.40/implementors/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Freeze for Error",1,["chemfiles::errors::Error"]],["impl Freeze for Status",1,["chemfiles::errors::Status"]],["impl Freeze for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> Freeze for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> Freeze for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl Freeze for CellShape",1,["chemfiles::cell::CellShape"]],["impl Freeze for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> Freeze for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> Freeze for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl Freeze for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> Freeze for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl Freeze for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl Freeze for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> Freeze for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl Freeze for Frame",1,["chemfiles::frame::Frame"]],["impl Freeze for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> Freeze for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl Freeze for Match",1,["chemfiles::selection::Match"]],["impl Freeze for Selection",1,["chemfiles::selection::Selection"]],["impl Freeze for Property",1,["chemfiles::property::Property"]],["impl<'a> Freeze for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl Freeze for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/marker/trait.Send.js b/0.10.40/implementors/core/marker/trait.Send.js new file mode 100644 index 000000000..e9fdddb0e --- /dev/null +++ b/0.10.40/implementors/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Send for Error",1,["chemfiles::errors::Error"]],["impl Send for Status",1,["chemfiles::errors::Status"]],["impl !Send for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> !Send for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> !Send for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl Send for CellShape",1,["chemfiles::cell::CellShape"]],["impl !Send for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> !Send for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> !Send for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl !Send for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> !Send for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl Send for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl !Send for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> !Send for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl !Send for Frame",1,["chemfiles::frame::Frame"]],["impl !Send for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> !Send for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl Send for Match",1,["chemfiles::selection::Match"]],["impl !Send for Selection",1,["chemfiles::selection::Selection"]],["impl Send for Property",1,["chemfiles::property::Property"]],["impl<'a> !Send for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl Send for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/marker/trait.StructuralEq.js b/0.10.40/implementors/core/marker/trait.StructuralEq.js new file mode 100644 index 000000000..fe0733c7a --- /dev/null +++ b/0.10.40/implementors/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl StructuralEq for Match"],["impl StructuralEq for BondOrder"],["impl StructuralEq for FormatMetadata"],["impl StructuralEq for CellShape"],["impl StructuralEq for Error"],["impl StructuralEq for Status"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/marker/trait.StructuralPartialEq.js b/0.10.40/implementors/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 000000000..3d22c25a9 --- /dev/null +++ b/0.10.40/implementors/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl StructuralPartialEq for CellShape"],["impl StructuralPartialEq for Status"],["impl StructuralPartialEq for FormatMetadata"],["impl StructuralPartialEq for Match"],["impl StructuralPartialEq for Property"],["impl StructuralPartialEq for Error"],["impl StructuralPartialEq for BondOrder"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/marker/trait.Sync.js b/0.10.40/implementors/core/marker/trait.Sync.js new file mode 100644 index 000000000..36c9751d8 --- /dev/null +++ b/0.10.40/implementors/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Sync for Error",1,["chemfiles::errors::Error"]],["impl Sync for Status",1,["chemfiles::errors::Status"]],["impl !Sync for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> !Sync for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> !Sync for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl Sync for CellShape",1,["chemfiles::cell::CellShape"]],["impl !Sync for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> !Sync for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> !Sync for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl !Sync for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> !Sync for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl Sync for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl !Sync for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> !Sync for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl !Sync for Frame",1,["chemfiles::frame::Frame"]],["impl !Sync for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> !Sync for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl Sync for Match",1,["chemfiles::selection::Match"]],["impl !Sync for Selection",1,["chemfiles::selection::Selection"]],["impl Sync for Property",1,["chemfiles::property::Property"]],["impl<'a> !Sync for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl Sync for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/marker/trait.Unpin.js b/0.10.40/implementors/core/marker/trait.Unpin.js new file mode 100644 index 000000000..1a05ca1f6 --- /dev/null +++ b/0.10.40/implementors/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Unpin for Error",1,["chemfiles::errors::Error"]],["impl Unpin for Status",1,["chemfiles::errors::Status"]],["impl Unpin for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> Unpin for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> Unpin for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl Unpin for CellShape",1,["chemfiles::cell::CellShape"]],["impl Unpin for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> Unpin for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> Unpin for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl Unpin for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> Unpin for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl Unpin for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl Unpin for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> Unpin for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl Unpin for Frame",1,["chemfiles::frame::Frame"]],["impl Unpin for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> Unpin for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl Unpin for Match",1,["chemfiles::selection::Match"]],["impl Unpin for Selection",1,["chemfiles::selection::Selection"]],["impl Unpin for Property",1,["chemfiles::property::Property"]],["impl<'a> Unpin for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl Unpin for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/ops/deref/trait.Deref.js b/0.10.40/implementors/core/ops/deref/trait.Deref.js new file mode 100644 index 000000000..6218f49c3 --- /dev/null +++ b/0.10.40/implementors/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> Deref for AtomMut<'a>"],["impl<'a> Deref for UnitCellRef<'a>"],["impl<'a> Deref for MemoryTrajectoryReader<'a>"],["impl<'a> Deref for ResidueRef<'a>"],["impl<'a> Deref for AtomRef<'a>"],["impl<'a> Deref for TopologyRef<'a>"],["impl<'a> Deref for UnitCellMut<'a>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/ops/deref/trait.DerefMut.js b/0.10.40/implementors/core/ops/deref/trait.DerefMut.js new file mode 100644 index 000000000..97fa627fc --- /dev/null +++ b/0.10.40/implementors/core/ops/deref/trait.DerefMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl<'a> DerefMut for UnitCellMut<'a>"],["impl<'a> DerefMut for MemoryTrajectoryReader<'a>"],["impl<'a> DerefMut for AtomMut<'a>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/ops/drop/trait.Drop.js b/0.10.40/implementors/core/ops/drop/trait.Drop.js new file mode 100644 index 000000000..20d42a1e9 --- /dev/null +++ b/0.10.40/implementors/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Drop for Residue"],["impl Drop for Frame"],["impl Drop for Selection"],["impl Drop for Atom"],["impl Drop for Topology"],["impl Drop for Trajectory"],["impl Drop for UnitCell"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/ops/index/trait.Index.js b/0.10.40/implementors/core/ops/index/trait.Index.js new file mode 100644 index 000000000..76d582a63 --- /dev/null +++ b/0.10.40/implementors/core/ops/index/trait.Index.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl Index<usize> for Match"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js b/0.10.40/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 000000000..407e069d4 --- /dev/null +++ b/0.10.40/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl RefUnwindSafe for Error",1,["chemfiles::errors::Error"]],["impl RefUnwindSafe for Status",1,["chemfiles::errors::Status"]],["impl RefUnwindSafe for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> RefUnwindSafe for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> RefUnwindSafe for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl RefUnwindSafe for CellShape",1,["chemfiles::cell::CellShape"]],["impl RefUnwindSafe for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> RefUnwindSafe for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> RefUnwindSafe for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl RefUnwindSafe for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> RefUnwindSafe for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl RefUnwindSafe for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl RefUnwindSafe for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> RefUnwindSafe for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl RefUnwindSafe for Frame",1,["chemfiles::frame::Frame"]],["impl RefUnwindSafe for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> RefUnwindSafe for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl RefUnwindSafe for Match",1,["chemfiles::selection::Match"]],["impl RefUnwindSafe for Selection",1,["chemfiles::selection::Selection"]],["impl RefUnwindSafe for Property",1,["chemfiles::property::Property"]],["impl<'a> !RefUnwindSafe for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl RefUnwindSafe for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/implementors/core/panic/unwind_safe/trait.UnwindSafe.js b/0.10.40/implementors/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 000000000..dfa56645c --- /dev/null +++ b/0.10.40/implementors/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"chemfiles":[["impl UnwindSafe for Error",1,["chemfiles::errors::Error"]],["impl UnwindSafe for Status",1,["chemfiles::errors::Status"]],["impl UnwindSafe for Atom",1,["chemfiles::atom::Atom"]],["impl<'a> UnwindSafe for AtomRef<'a>",1,["chemfiles::atom::AtomRef"]],["impl<'a> !UnwindSafe for AtomMut<'a>",1,["chemfiles::atom::AtomMut"]],["impl UnwindSafe for CellShape",1,["chemfiles::cell::CellShape"]],["impl UnwindSafe for UnitCell",1,["chemfiles::cell::UnitCell"]],["impl<'a> UnwindSafe for UnitCellRef<'a>",1,["chemfiles::cell::UnitCellRef"]],["impl<'a> !UnwindSafe for UnitCellMut<'a>",1,["chemfiles::cell::UnitCellMut"]],["impl UnwindSafe for Residue",1,["chemfiles::residue::Residue"]],["impl<'a> UnwindSafe for ResidueRef<'a>",1,["chemfiles::residue::ResidueRef"]],["impl UnwindSafe for BondOrder",1,["chemfiles::topology::BondOrder"]],["impl UnwindSafe for Topology",1,["chemfiles::topology::Topology"]],["impl<'a> UnwindSafe for TopologyRef<'a>",1,["chemfiles::topology::TopologyRef"]],["impl UnwindSafe for Frame",1,["chemfiles::frame::Frame"]],["impl UnwindSafe for Trajectory",1,["chemfiles::trajectory::Trajectory"]],["impl<'data> UnwindSafe for MemoryTrajectoryReader<'data>",1,["chemfiles::trajectory::MemoryTrajectoryReader"]],["impl UnwindSafe for Match",1,["chemfiles::selection::Match"]],["impl UnwindSafe for Selection",1,["chemfiles::selection::Selection"]],["impl UnwindSafe for Property",1,["chemfiles::property::Property"]],["impl<'a> !UnwindSafe for PropertiesIter<'a>",1,["chemfiles::property::PropertiesIter"]],["impl UnwindSafe for FormatMetadata",1,["chemfiles::misc::FormatMetadata"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/0.10.40/index.html b/0.10.40/index.html new file mode 100644 index 000000000..8b8b920bb --- /dev/null +++ b/0.10.40/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/0.10.40/search-index.js b/0.10.40/search-index.js new file mode 100644 index 000000000..b19b80825 --- /dev/null +++ b/0.10.40/search-index.js @@ -0,0 +1,5 @@ +var searchIndex = JSON.parse('{\ +"chemfiles":{"doc":"Chemfiles is a multi-language library written in modern …","t":"NNDDDENENNNNDNNDDNDNDNNDENNNDDDNNENNNDDDNNNDDDNNLLLLLLLFLLLLLLLLLLLLLLLMLLLMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLLLLLLLLLLLLLLLLLLLLLLLLMLLLLLLLLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLMLLMLLLLLLLLLLLLLLLLLMLLLLLLMLMLLLLLLMLLLLLLLLLLLLLLLLLLLLFLLLLLLMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLMLFLLLLM","n":["Amide","Aromatic","Atom","AtomMut","AtomRef","BondOrder","Bool","CellShape","ChemfilesError","ConfigurationError","Double","Double","Error","FileError","FormatError","FormatMetadata","Frame","Infinite","Match","MemoryError","MemoryTrajectoryReader","Orthorhombic","OutOfBounds","PropertiesIter","Property","PropertyError","Quadruple","Quintuplet","Residue","ResidueRef","Selection","SelectionError","Single","Status","StdCppError","String","Success","Topology","TopologyRef","Trajectory","Triclinic","Triple","UTF8PathError","UnitCell","UnitCellMut","UnitCellRef","Unknown","Vector3D","add_atom","add_atom","add_atom","add_bond","add_bond","add_bond_with_order","add_bond_with_order","add_configuration","add_residue","add_residue","add_velocities","angle","angles","angles","angles_count","are_linked","atom","atom","atom_mut","atom_mut","atomic_number","atomic_type","atoms","atoms","bond_order","bond_orders","bonds","bonds","bonds_count","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","cell","cell_mut","charge","cleanup","clear_bonds","clear_bonds","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","contains","count","covalent_radius","deref","deref","deref","deref","deref","deref","deref","deref_mut","deref_mut","deref_mut","description","description","dihedral","dihedrals","dihedrals_count","distance","drop","drop","drop","drop","drop","drop","drop","eq","eq","eq","eq","eq","eq","eq","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","evaluate","extension","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","formats_list","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_matrix","full_name","get","get","get","guess_bonds","guess_format","has_velocities","id","impropers","impropers_count","index","infinite","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into","into_iter","into_iter","iter","iter_atoms","last_error","len","lengths","list","mass","matrix","memory","memory_buffer","memory_writer","message","name","name","name","new","new","new","new","new","new","new","new","next","nsteps","open","open_with_format","out_of_plane","partial_cmp","partial_cmp","path","positions","positions","positions_mut","properties","properties","properties","provide","read","read","read_step","reference","remove","remove","remove_bond","remove_bond","residue","residue_for_atom","residues","residues_count","resize","resize","set","set","set","set_angles","set_atomic_type","set_cell","set_cell","set_charge","set_lengths","set_mass","set_name","set_shape","set_step","set_topology","set_topology","set_topology_file","set_topology_with_format","set_warning_callback","shape","size","size","size","size","size_hint","status","step","string","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","topology","triclinic","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","unit_cell","vdw_radius","velocities","velocities","velocities_mut","version","volume","with_id","wrap","write","write"],"q":[[0,"chemfiles"]],"d":["Amide bond (required by some file formats)","Aromatic bond (required by some file formats)","An Atom is a particle in the current Frame. It stores the …","An analog to a mutable reference to an atom (&mut Atom)","An analog to a reference to an atom (&Atom)","Possible bond order associated with bonds","Boolean property","Available unit cell shapes.","Exception in the C++ chemfiles library","Error in configuration files syntax","Double bond","Floating point property","Error type for Chemfiles.","Error while reading or writing a file","Error in file formatting, i.e. the file is invalid","FormatMetadata contains metadata associated with one …","A Frame contains data from one simulation step: the …","Infinite cell, to use when there is no cell.","A Match is a set of atomic indexes matching a given …","Error in memory allocations","MemoryTrajectoryReader is a handle for a Trajectory in …","Orthorhombic cell, with the three angles equals to 90°.","Error for out of bounds indexing","An iterator over the properties in an atom/frame/residue","A Property is a piece of data that can be associated with …","Error related to properties","Quadruple bond (present in some metals)","Quintuplet bond (present in some metals)","A Residue is a group of atoms belonging to the same …","An analog to a reference to a residue (&Residue)","A Selection allow to select atoms in a Frame, from a …","Error in selection string syntax","Single bond","Possible causes of error in chemfiles","Exception in the C++ standard library","String property","No error","A Topology contains the definition of all the atoms in the …","An analog to a reference to a topology (&Topology)","The Trajectory type is the main entry point when using …","Triclinic cell, with any values for the angles.","Triple bond","The given path is not valid UTF8","An UnitCell represent the box containing the atoms, and …","An analog to a mutable reference to an unit cell (…","An analog to a reference to an unit cell (&UnitCell)","Unknown or unspecified bond order","3-dimensional vector property","Add the atom at index atom in this residue.","Add an Atom at the end of this topology","Add an Atom and the corresponding position and optionally …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Add a bond between the atoms at indexes i and j in the …","Read configuration data from the file at path.","Add a residue to this topology.","Add a copy of residue to this frame.","Add velocity data to this frame. If the frame already have …","Get the angle formed by the atoms at indexes i, j and k in …","Get the three angles of the cell, in degrees.","Get the list of angles in the topology.","Get the number of angles in the topology.","Check if the two residues first and second from the …","Get a reference of the atom at the given index in this …","Get a reference to the atom at the given index in this …","Get a mutable reference to the atom at the given index in …","Get a mutable reference to the atom at the given index in …","Try to get the atomic number of the atom from the atomic …","Get the atom type.","Get the list of atoms of this residue.","Does this format support storing atom names or types?","Get the bond order for the bond between the atoms at …","Get the bond order for all the bonds in the topology","Get the list of bonds in the topology.","Does this format support storing bonds between atoms?","Get the number of bonds in the topology.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Get a reference to the UnitCell from this frame.","Get a mutable reference to the UnitCell from this frame.","Get the atom charge, in number of the electron charge e.","Clear any error from the C++ library","Remove all existing bonds, angles, dihedral angles and …","Remove all existing bonds, angles, dihedral angles and …","","","","","","","","","","","","","","","","","","","","","","","","","","","","Check if the atom at index i is in this residue","","Try to get the covalent radius of the atom from the atomic …","","","","","","","","","","","","Extended, user-facing description of the format.","Get the dihedral angle formed by the atoms at indexes i, j…","Get the list of dihedral angles in the topology.","Get the number of dihedral angles in the topology.","Get the distance between the atoms at indexes i and j in …","","","","","","","","","","","","","","","","","","","","","Evaluate a selection for a given frame, and return the …","Extension associated with the format.","","","","","","","","","","","","","","","","","","","","","","Get the list of formats known by chemfiles, as well as all …","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","","","","Returns the argument unchanged.","Create an UnitCell from a cell matrix. If matrix contains …","Try to get the full name of the atom from the atomic type. …","Get a property with the given name in this atom, if it …","Get a property with the given name in this frame, if it …","Get a property with the given name in this frame, if it …","Guess the bonds, angles and dihedrals in this frame.","Get the format that chemfiles would use to read a file at …","Check if this frame contains velocity data.","Get the identifier of this residue in the initial topology …","Get the list of improper dihedral angles in the topology.","Get the number of improper dihedral angles in the topology.","","Create an Infinite UnitCell.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","Iterate over the atomic indexes in the match.","Gets an iterator over atoms","Get the last error message from the C++ library.","Get the length of the Match.","Get the three lengths of the cell, in Angstroms.","Evaluates a selection of size 1 on a given frame. This …","Get the atom mass, in atomic mass units.","Get the unit cell matricial representation.","Does this format support in-memory IO?","Obtain the memory buffer written to by the trajectory.","Write to a memory buffer as though it was a formatted file.","A message describing the error cause","Get the atom name.","Get the name of this residue.","Name of the format.","Read a memory buffer as though it was a formatted file.","Create an atom with the given name, and set the atom type …","Create an Orthorhombic UnitCell from the three lengths, in …","Create a new residue with the given name","Create a new empty topology.","Create an empty frame. It will be resized by the library …","Create a new match containing the atoms in the atoms slice.","Create a new selection from the given selection string.","","Get the number of steps (the number of frames) in a …","Open the file at the given path in the given mode.","Open the file at the given path using a specific file …","Get the out of plane distance formed by the atoms at …","","","Get file path for this trajectory.","Get a view into the positions of this frame.","Does this format support storing atomic positions?","Get a mutable view into the positions of this frame.","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","Get an iterator over all (name, property) pairs for this …","","Read the next step of this trajectory into a frame.","Is reading files in this format implemented?","Read a specific step of this trajectory into a frame.","URL pointing to the format definition/reference.","Remove an Atom from this topology by index. This modify …","Remove the atom at index i in this frame.","Remove any existing bond between the atoms at indexes i …","Remove any existing bond between the atoms at indexes i …","Get a reference to the residue at index index from this …","Get a copy of the residue containing the atom at index …","Does this format support storing residues?","Get the number of residues in this topology.","Resize this topology to hold natoms atoms, inserting dummy …","Resize the positions and the velocities in this frame, to …","Add a new property with the given name to this atom.","Add a new property with the given name to this residue.","Add a new property with the given name to this frame.","Set the three angles of the cell, in degrees.","Set the atom type to atomic_type.","Set the UnitCell of this frame to cell.","Set the unit cell associated with a trajectory. This cell …","Set the atom charge to charge, in number of the electron …","Set the three lengths of the cell, in Angstroms.","Set the atom mass to mass, in atomic mass units.","Set the atom name to name.","Set the shape of the unit cell to shape.","Set this frame step to step.","Set the Topology of this frame to topology.","Set the topology associated with this trajectory. This …","Set the topology associated with this trajectory by …","Set the topology associated with this trajectory by …","Use callback for every chemfiles warning. The callback …","Get the shape of the unit cell.","Get the number of atoms in this residue.","Get the current number of atoms in this topology.","Get the current number of atoms in this frame.","Get the size of the selection, i.e. the number of atoms we …","","The error status code","Get this frame step, i.e. the frame number in the …","Get the selection string used to create this selection.","","","","","","","","","","","","","","","Get a reference to the Topology of this frame.","Create an Triclinic UnitCell from the three lengths (in …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Does this format support storing unit cell information?","Try to get the Van der Waals radius of the atom from the …","Get a view into the velocities of this frame.","Does this format support storing atomic velocities?","Get a mutable view into the velocities of this frame.","Get the version of the chemfiles library.","Get the volume of the unit cell.","Create a new residue with the given name and id as …","Wrap a vector in this unit cell.","Write a frame to this trajectory.","Is writing files in this format implemented?"],"i":[10,10,0,0,0,0,28,0,24,24,10,28,0,24,24,0,0,25,0,24,0,25,24,0,0,24,10,10,0,0,0,24,10,0,24,28,24,0,0,0,25,10,24,0,0,0,10,28,1,3,5,3,5,3,5,0,3,5,5,5,15,3,3,3,3,5,3,5,4,4,1,29,3,3,3,29,3,32,31,13,24,4,18,19,25,15,22,23,1,33,10,3,34,5,35,26,27,28,29,32,31,13,24,4,18,19,25,15,22,23,1,33,10,3,34,5,35,26,27,28,29,5,5,4,13,3,5,13,24,4,25,15,1,10,3,5,26,27,28,29,13,24,4,25,15,1,10,3,5,26,27,28,29,10,1,31,4,32,18,19,22,23,33,34,32,19,23,13,29,5,3,3,5,4,15,1,3,5,35,27,13,24,25,10,26,28,29,13,24,25,10,26,29,27,29,13,13,24,4,18,19,25,15,22,23,1,33,10,3,34,5,35,26,27,28,29,0,32,31,13,13,13,24,4,18,19,25,25,15,22,23,1,33,10,10,3,34,5,35,26,27,28,28,28,28,28,28,29,15,4,4,1,5,5,0,5,1,3,3,26,15,32,31,13,24,4,18,19,25,15,22,23,1,33,10,3,34,5,35,26,27,28,29,31,26,26,5,13,26,15,27,4,15,29,35,35,13,4,1,29,32,4,15,1,3,5,26,27,31,35,35,35,5,10,28,35,5,29,5,4,1,5,13,35,29,35,29,3,5,3,5,3,3,29,3,3,5,4,1,5,15,4,5,35,4,15,4,4,15,5,5,35,35,35,0,15,1,3,5,27,31,13,5,27,13,24,4,25,15,1,10,3,5,26,27,28,29,13,5,15,32,31,13,24,4,18,19,25,15,22,23,1,33,10,3,34,5,35,26,27,28,29,32,31,13,24,4,18,19,25,15,22,23,1,33,10,3,34,5,35,26,27,28,29,32,31,13,24,4,18,19,25,15,22,23,1,33,10,3,34,5,35,26,27,28,29,29,4,5,29,5,0,15,1,15,35,29],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[1,2]],[[3,4]],[[5,4,[7,[6]],[9,[[8,[[7,[6]]]]]]]],[[3,2,2]],[[5,2,2]],[[3,2,2,10]],[[5,2,2,10]],[[[12,[11]]],[[14,[13]]]],[[3,1],[[14,[13]]]],[[5,1],[[14,[13]]]],[5],[[5,2,2,2],6],[15,[[7,[6]]]],[3,[[16,[[7,[2]]]]]],[3,2],[[3,1,1],17],[[3,2],18],[[5,2],18],[[3,2],19],[[5,2],19],[4,20],[4,21],[1,[[16,[2]]]],0,[[3,2,2],10],[3,[[16,[10]]]],[3,[[16,[[7,[2]]]]]],0,[3,2],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[5,22],[5,23],[4,6],[[]],[3],[5],[13,13],[24,24],[4,4],[25,25],[15,15],[1,1],[10,10],[3,3],[5,5],[26,26],[27,27],[28,28],[29,29],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[10,10],30],[[1,2],17],[31,2],[4,6],[32],[18,4],[19,4],[22,15],[23,15],[33,1],[34,3],[32],[19,4],[23,15],[13,11],0,[[5,2,2,2,2],6],[3,[[16,[[7,[2]]]]]],[3,2],[[5,2,2],6],[4],[15],[1],[3],[5],[35],[27],[[13,13],17],[[24,24],17],[[25,25],17],[[10,10],17],[[26,26],17],[[28,28],17],[[29,29],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[],17],[[27,5],[[16,[26]]]],0,[[13,36],37],[[13,36],[[14,[38]]]],[[24,36],37],[[4,36],37],[[18,36],37],[[19,36],37],[[25,36],37],[[15,36],37],[[22,36],37],[[23,36],37],[[1,36],37],[[33,36],37],[[10,36],37],[[3,36],37],[[34,36],37],[[5,36],37],[[35,36],37],[[26,36],37],[[27,36],37],[[28,36],37],[[29,36],37],[[],[[16,[29]]]],[[]],[[]],[39,13],[40,13],[[]],[[]],[[]],[[]],[[]],[41,25],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[42,10],[[]],[[]],[[]],[[]],[[]],[[]],[[[7,[6]]],28],[17,28],[[]],[21,28],[6,28],[11,28],[[]],[[[7,[[7,[6]]]]],15],[4,21],[[4,11],[[8,[28]]]],[[1,11],[[8,[28]]]],[[5,11],[[8,[28]]]],[5,[[14,[13]]]],[[[12,[43]]],[[14,[21,13]]]],[5,17],[1,[[8,[44]]]],[3,[[16,[[7,[2]]]]]],[3,2],[[26,2]],[[],15],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[26],[26,[[45,[2]]]],0,[[],21],[26,2],[15,[[7,[6]]]],[[27,5],[[16,[2]]]],[4,6],[15,[[7,[[7,[6]]]]]],0,[35,[[14,[11,13]]]],[[[9,[11]]],[[14,[35,13]]]],0,[4,21],[1,21],0,[[[9,[[47,[46]]]],[12,[11]]],[[14,[32,13]]]],[[[9,[11]]],4],[[[7,[6]]],15],[[[9,[11]]],1],[[],3],[[],5],[[[47,[2]]],26],[[[9,[11]]],[[14,[27,13]]]],[31,8],[35,2],[[[12,[43]],48],[[14,[35,13]]]],[[[12,[43]],48,[9,[11]]],[[14,[35,13]]]],[[5,2,2,2,2],6],[[10,10],[[8,[30]]]],[[28,28],[[8,[30]]]],[35,21],[5,[[47,[[7,[6]]]]]],0,[5,[[47,[[7,[6]]]]]],[4,31],[1,31],[5,31],[49],[[35,5],[[14,[13]]]],0,[[35,2,5],[[14,[13]]]],0,[[3,2]],[[5,2]],[[3,2,2]],[[5,2,2]],[[3,2],[[8,[33]]]],[[3,2],[[8,[33]]]],0,[3,20],[[3,2]],[[5,2]],[[4,11,[9,[28]]]],[[1,11,[9,[28]]]],[[5,11,[9,[28]]]],[[15,[7,[6]]],[[14,[13]]]],[[4,[9,[11]]]],[[5,15]],[[35,15]],[[4,6]],[[15,[7,[6]]],[[14,[13]]]],[[4,6]],[[4,[9,[11]]]],[[15,25],[[14,[13]]]],[[5,2]],[[5,3],[[14,[13]]]],[[35,3]],[[35,[12,[43]]],[[14,[13]]]],[[35,[12,[43]],[9,[11]]],[[14,[13]]]],0,[15,25],[1,2],[3,2],[5,2],[27,2],[31],0,[5,2],[27,21],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[]],[[],21],[5,34],[[[7,[6]],[7,[6]]],15],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],14],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],[[],50],0,[4,6],[5,[[8,[[47,[[7,[6]]]]]]]],0,[5,[[8,[[47,[[7,[6]]]]]]]],[[],21],[15,6],[[[9,[11]],44],1],[[15,[7,[6]]]],[[35,5],[[14,[13]]]],0],"c":[],"p":[[3,"Residue"],[15,"usize"],[3,"Topology"],[3,"Atom"],[3,"Frame"],[15,"f64"],[15,"array"],[4,"Option"],[8,"Into"],[4,"BondOrder"],[15,"str"],[8,"AsRef"],[3,"Error"],[4,"Result"],[3,"UnitCell"],[3,"Vec"],[15,"bool"],[3,"AtomRef"],[3,"AtomMut"],[15,"u64"],[3,"String"],[3,"UnitCellRef"],[3,"UnitCellMut"],[4,"Status"],[4,"CellShape"],[3,"Match"],[3,"Selection"],[4,"Property"],[3,"FormatMetadata"],[4,"Ordering"],[3,"PropertiesIter"],[3,"MemoryTrajectoryReader"],[3,"ResidueRef"],[3,"TopologyRef"],[3,"Trajectory"],[3,"Formatter"],[6,"Result"],[3,"Error"],[3,"Utf8Error"],[4,"chfl_status"],[4,"chfl_cellshape"],[4,"chfl_bond_order"],[3,"Path"],[15,"i64"],[3,"Iter"],[15,"u8"],[15,"slice"],[15,"char"],[3,"Demand"],[3,"TypeId"]]}\ +}'); +if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; +if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; diff --git a/0.10.40/settings.html b/0.10.40/settings.html new file mode 100644 index 000000000..2e13b17b2 --- /dev/null +++ b/0.10.40/settings.html @@ -0,0 +1 @@ +Rustdoc settings

Rustdoc settings

Back
\ No newline at end of file diff --git a/0.10.40/source-files.js b/0.10.40/source-files.js new file mode 100644 index 000000000..6f5ac469c --- /dev/null +++ b/0.10.40/source-files.js @@ -0,0 +1,4 @@ +var sourcesIndex = JSON.parse('{\ +"chemfiles":["",[],["atom.rs","cell.rs","errors.rs","frame.rs","lib.rs","misc.rs","property.rs","residue.rs","selection.rs","strings.rs","topology.rs","trajectory.rs"]]\ +}'); +createSourceSidebar(); diff --git a/0.10.40/src/chemfiles/atom.rs.html b/0.10.40/src/chemfiles/atom.rs.html new file mode 100644 index 000000000..44dcd4e5b --- /dev/null +++ b/0.10.40/src/chemfiles/atom.rs.html @@ -0,0 +1,1063 @@ +atom.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::marker::PhantomData;
+
+use chemfiles_sys as ffi;
+
+use crate::errors::{check_not_null, check_success};
+use crate::property::{PropertiesIter, Property, RawProperty};
+use crate::strings;
+
+/// An `Atom` is a particle in the current `Frame`. It stores the following
+/// atomic properties:
+///
+/// - atom name;
+/// - atom type;
+/// - atom mass;
+/// - atom charge.
+///
+/// The atom name is usually an unique identifier (`H1`, `C_a`) while the
+/// atom type will be shared between all particles of the same type: `H`,
+/// `Ow`, `CH3`.
+#[derive(Debug)]
+pub struct Atom {
+    handle: *mut ffi::CHFL_ATOM,
+}
+
+/// An analog to a reference to an atom (`&Atom`)
+#[derive(Debug)]
+pub struct AtomRef<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a Atom>,
+}
+
+impl<'a> std::ops::Deref for AtomRef<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an atom (`&mut Atom`)
+#[derive(Debug)]
+pub struct AtomMut<'a> {
+    inner: Atom,
+    marker: PhantomData<&'a mut Atom>,
+}
+
+impl<'a> std::ops::Deref for AtomMut<'a> {
+    type Target = Atom;
+    fn deref(&self) -> &Atom {
+        &self.inner
+    }
+}
+
+impl<'a> std::ops::DerefMut for AtomMut<'a> {
+    fn deref_mut(&mut self) -> &mut Atom {
+        &mut self.inner
+    }
+}
+
+impl Clone for Atom {
+    fn clone(&self) -> Atom {
+        unsafe {
+            let new_handle = ffi::chfl_atom_copy(self.as_ptr());
+            Atom::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Atom {
+    /// Create an owned `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut ffi::CHFL_ATOM) -> Atom {
+        check_not_null(ptr);
+        Atom { handle: ptr }
+    }
+
+    /// Create a borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    #[allow(clippy::ptr_cast_constness)]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const ffi::CHFL_ATOM) -> AtomRef<'a> {
+        AtomRef {
+            inner: Atom::from_ptr(ptr as *mut ffi::CHFL_ATOM),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a mutably borrowed `Atom` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut ffi::CHFL_ATOM) -> AtomMut<'a> {
+        AtomMut {
+            inner: Atom::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const ffi::CHFL_ATOM {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut ffi::CHFL_ATOM {
+        self.handle
+    }
+
+    /// Create an atom with the given `name`, and set the atom type to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Atom {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = ffi::chfl_atom(buffer.as_ptr());
+            Atom::from_ptr(handle)
+        }
+    }
+
+    /// Get the atom mass, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.mass(), 4.002602);
+    /// ```
+    pub fn mass(&self) -> f64 {
+        let mut mass = 0.0;
+        unsafe {
+            check_success(ffi::chfl_atom_mass(self.as_ptr(), &mut mass));
+        }
+        return mass;
+    }
+
+    /// Set the atom mass to `mass`, in atomic mass units.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_mass(34.9);
+    /// assert_eq!(atom.mass(), 34.9);
+    /// ```
+    pub fn set_mass(&mut self, mass: f64) {
+        unsafe {
+            check_success(ffi::chfl_atom_set_mass(self.as_mut_ptr(), mass));
+        }
+    }
+
+    /// Get the atom charge, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.charge(), 0.0);
+    /// ```
+    pub fn charge(&self) -> f64 {
+        let mut charge = 0.0;
+        unsafe {
+            check_success(ffi::chfl_atom_charge(self.as_ptr(), &mut charge));
+        }
+        return charge;
+    }
+
+    /// Set the atom charge to `charge`, in number of the electron charge *e*.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_charge(-2.0);
+    /// assert_eq!(atom.charge(), -2.0);
+    /// ```
+    pub fn set_charge(&mut self, charge: f64) {
+        unsafe {
+            check_success(ffi::chfl_atom_set_charge(self.as_mut_ptr(), charge));
+        }
+    }
+
+    /// Get the atom name.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.name(), "He");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { ffi::chfl_atom_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_name).expect("getting name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Get the atom type.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("He");
+    /// assert_eq!(atom.atomic_type(), "He");
+    /// ```
+    pub fn atomic_type(&self) -> String {
+        let get_type = |ptr, len| unsafe { ffi::chfl_atom_type(self.as_ptr(), ptr, len) };
+        let buffer = strings::call_autogrow_buffer(10, get_type).expect("getting type failed");
+        return strings::from_c(buffer.as_ptr());
+    }
+
+    /// Set the atom name to `name`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_name("Zn3");
+    /// assert_eq!(atom.name(), "Zn3");
+    /// ```
+    pub fn set_name<'a>(&mut self, name: impl Into<&'a str>) {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            check_success(ffi::chfl_atom_set_name(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Set the atom type to `atomic_type`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let mut atom = Atom::new("He");
+    ///
+    /// atom.set_atomic_type("F");
+    /// assert_eq!(atom.atomic_type(), "F");
+    /// ```
+    pub fn set_atomic_type<'a>(&mut self, atomic_type: impl Into<&'a str>) {
+        let buffer = strings::to_c(atomic_type.into());
+        unsafe {
+            check_success(ffi::chfl_atom_set_type(self.as_mut_ptr(), buffer.as_ptr()));
+        }
+    }
+
+    /// Try to get the full name of the atom from the atomic type. For example,
+    /// the full name of "He" is "Helium", and so on. If the name can not be
+    /// found, this function returns the empty string.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// let atom = Atom::new("Zn");
+    /// assert_eq!(atom.full_name(), "Zinc");
+    /// ```
+    pub fn full_name(&self) -> String {
+        let get_full_name = |ptr, len| unsafe { ffi::chfl_atom_full_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(10, get_full_name).expect("getting full name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Try to get the Van der Waals radius of the atom from the atomic type.
+    /// If the radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").vdw_radius(), 1.4);
+    /// assert_eq!(Atom::new("Xxx").vdw_radius(), 0.0);
+    /// ```
+    pub fn vdw_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(ffi::chfl_atom_vdw_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the covalent radius of the atom from the atomic type. If the
+    /// radius can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").covalent_radius(), 0.32);
+    /// assert_eq!(Atom::new("Xxx").covalent_radius(), 0.0);
+    /// ```
+    pub fn covalent_radius(&self) -> f64 {
+        let mut radius: f64 = 0.0;
+        unsafe {
+            check_success(ffi::chfl_atom_covalent_radius(self.as_ptr(), &mut radius));
+        }
+        return radius;
+    }
+
+    /// Try to get the atomic number of the atom from the atomic type. If the
+    /// number can not be found, returns 0.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Atom;
+    /// assert_eq!(Atom::new("He").atomic_number(), 2);
+    /// assert_eq!(Atom::new("Xxx").atomic_number(), 0);
+    /// ```
+    pub fn atomic_number(&self) -> u64 {
+        let mut number = 0;
+        unsafe {
+            check_success(ffi::chfl_atom_atomic_number(self.as_ptr(), &mut number));
+        }
+        return number;
+    }
+
+    /// Add a new `property` with the given `name` to this atom.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("a bool", true);
+    /// atom.set("a string", "test");
+    ///
+    /// assert_eq!(atom.get("a bool"), Some(Property::Bool(true)));
+    /// assert_eq!(atom.get("a string"), Some(Property::String("test".into())));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(ffi::chfl_atom_set_property(
+                self.as_mut_ptr(),
+                buffer.as_ptr(),
+                property.as_ptr(),
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this atom, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(atom.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(atom.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = ffi::chfl_atom_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                let property = Property::from_raw(raw);
+                Some(property)
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this atom
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Atom, Property};
+    /// let mut atom = Atom::new("He");
+    /// atom.set("foo", Property::Double(22.2));
+    /// atom.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in atom.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(ffi::chfl_atom_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![std::ptr::null_mut(); size];
+        unsafe {
+            check_success(ffi::chfl_atom_list_properties(
+                self.as_ptr(),
+                c_names.as_mut_ptr(),
+                count,
+            ));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property")),
+        }
+    }
+}
+
+impl Drop for Atom {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = ffi::chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+
+        let copy = atom.clone();
+        assert_eq!(copy.name(), "He");
+
+        atom.set_name("Na");
+        assert_eq!(atom.name(), "Na");
+        assert_eq!(copy.name(), "He");
+    }
+
+    #[test]
+    fn mass() {
+        let mut atom = Atom::new("He");
+        approx::assert_ulps_eq!(atom.mass(), 4.002602);
+        atom.set_mass(15.0);
+        assert_eq!(atom.mass(), 15.0);
+    }
+
+    #[test]
+    fn charge() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.charge(), 0.0);
+        atom.set_charge(-1.5);
+        assert_eq!(atom.charge(), -1.5);
+    }
+
+    #[test]
+    fn name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.name(), "He");
+        atom.set_name("Zn-12");
+        assert_eq!(atom.name(), "Zn-12");
+    }
+
+    #[test]
+    fn atomic_type() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.atomic_type(), "He");
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.atomic_type(), "Zn");
+    }
+
+    #[test]
+    fn full_name() {
+        let mut atom = Atom::new("He");
+        assert_eq!(atom.full_name(), "Helium");
+
+        atom.set_atomic_type("Zn");
+        assert_eq!(atom.full_name(), "Zinc");
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.full_name(), "");
+    }
+
+    #[test]
+    fn radii() {
+        let atom = Atom::new("He");
+        approx::assert_ulps_eq!(atom.vdw_radius(), 1.4);
+        approx::assert_ulps_eq!(atom.covalent_radius(), 0.32);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.vdw_radius(), 0.0);
+        assert_eq!(atom.covalent_radius(), 0.0);
+    }
+
+    #[test]
+    fn atomic_number() {
+        let atom = Atom::new("He");
+        assert_eq!(atom.atomic_number(), 2);
+
+        let atom = Atom::new("Unknown");
+        assert_eq!(atom.atomic_number(), 0);
+    }
+
+    #[test]
+    fn property() {
+        let mut atom = Atom::new("F");
+
+        atom.set("foo", -22.0);
+        assert_eq!(atom.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(atom.get("bar"), None);
+
+        atom.set("bar", Property::String("here".into()));
+        for (name, property) in atom.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/cell.rs.html b/0.10.40/src/chemfiles/cell.rs.html new file mode 100644 index 000000000..3a7d6e33e --- /dev/null +++ b/0.10.40/src/chemfiles/cell.rs.html @@ -0,0 +1,1075 @@ +cell.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::marker::PhantomData;
+
+#[allow(clippy::wildcard_imports)]
+use chemfiles_sys as ffi;
+
+use crate::errors::{check, check_not_null, check_success, Error};
+
+/// Available unit cell shapes.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub enum CellShape {
+    /// Orthorhombic cell, with the three angles equals to 90°.
+    Orthorhombic,
+    /// Triclinic cell, with any values for the angles.
+    Triclinic,
+    /// Infinite cell, to use when there is no cell.
+    Infinite,
+}
+
+impl From<ffi::chfl_cellshape> for CellShape {
+    fn from(celltype: ffi::chfl_cellshape) -> CellShape {
+        match celltype {
+            ffi::chfl_cellshape::CHFL_CELL_ORTHORHOMBIC => CellShape::Orthorhombic,
+            ffi::chfl_cellshape::CHFL_CELL_TRICLINIC => CellShape::Triclinic,
+            ffi::chfl_cellshape::CHFL_CELL_INFINITE => CellShape::Infinite,
+        }
+    }
+}
+
+impl From<CellShape> for ffi::chfl_cellshape {
+    fn from(celltype: CellShape) -> ffi::chfl_cellshape {
+        match celltype {
+            CellShape::Orthorhombic => ffi::chfl_cellshape::CHFL_CELL_ORTHORHOMBIC,
+            CellShape::Triclinic => ffi::chfl_cellshape::CHFL_CELL_TRICLINIC,
+            CellShape::Infinite => ffi::chfl_cellshape::CHFL_CELL_INFINITE,
+        }
+    }
+}
+
+/// An `UnitCell` represent the box containing the atoms, and its periodicity.
+///
+/// An unit cell is fully represented by three lengths (a, b, c); and three
+/// angles (alpha, beta, gamma). The angles are stored in degrees, and the
+/// lengths in Angstroms.
+///
+/// A cell also has a matricial representation, by projecting the three base
+/// vector into an orthonormal base. We choose to represent such matrix as an
+/// upper triangular matrix:
+///
+/// ```text
+/// | a_x   b_x   c_x |
+/// |  0    b_y   c_y |
+/// |  0     0    c_z |
+/// ```
+#[derive(Debug)]
+pub struct UnitCell {
+    handle: *mut ffi::CHFL_CELL,
+}
+
+/// An analog to a reference to an unit cell (`&UnitCell`)
+#[derive(Debug)]
+pub struct UnitCellRef<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a UnitCell>,
+}
+
+impl<'a> std::ops::Deref for UnitCellRef<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+/// An analog to a mutable reference to an unit cell (`&mut UnitCell`)
+#[derive(Debug)]
+pub struct UnitCellMut<'a> {
+    inner: UnitCell,
+    marker: PhantomData<&'a mut UnitCell>,
+}
+
+impl<'a> std::ops::Deref for UnitCellMut<'a> {
+    type Target = UnitCell;
+    fn deref(&self) -> &UnitCell {
+        &self.inner
+    }
+}
+
+impl<'a> std::ops::DerefMut for UnitCellMut<'a> {
+    fn deref_mut(&mut self) -> &mut UnitCell {
+        &mut self.inner
+    }
+}
+
+impl Clone for UnitCell {
+    fn clone(&self) -> UnitCell {
+        unsafe {
+            let new_handle = ffi::chfl_cell_copy(self.as_ptr());
+            UnitCell::from_ptr(new_handle)
+        }
+    }
+}
+
+impl UnitCell {
+    /// Create an owned `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut ffi::CHFL_CELL) -> UnitCell {
+        check_not_null(ptr);
+        UnitCell { handle: ptr }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, and the caller is responsible for setting the right lifetime.
+    #[inline]
+    #[allow(clippy::ptr_cast_constness)]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const ffi::CHFL_CELL) -> UnitCellRef<'a> {
+        UnitCellRef {
+            inner: UnitCell::from_ptr(ptr as *mut ffi::CHFL_CELL),
+            marker: PhantomData,
+        }
+    }
+
+    /// Create a borrowed `UnitCell` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible for
+    /// setting the right lifetime
+    #[inline]
+    pub(crate) unsafe fn ref_mut_from_ptr<'a>(ptr: *mut ffi::CHFL_CELL) -> UnitCellMut<'a> {
+        UnitCellMut {
+            inner: UnitCell::from_ptr(ptr),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const ffi::CHFL_CELL {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut ffi::CHFL_CELL {
+        self.handle
+    }
+
+    /// Create an `Orthorhombic` `UnitCell` from the three lengths, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn new(lengths: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = ffi::chfl_cell(lengths.as_ptr(), std::ptr::null());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `Infinite` `UnitCell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::infinite();
+    ///
+    /// assert_eq!(cell.lengths(), [0.0, 0.0, 0.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn infinite() -> UnitCell {
+        let mut cell = UnitCell::new([0.0, 0.0, 0.0]);
+        cell.set_shape(CellShape::Infinite).expect("could not set cell shape");
+        return cell;
+    }
+
+    /// Create an `Triclinic` `UnitCell` from the three lengths (in Angstroms)
+    /// and three angles (in degree). `alpha` is the angle between the vectors
+    /// `b` and `c`; `beta` is the between the vectors `a` and `c` and `gamma`
+    /// is the angle between the vectors `a` and `b`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::triclinic([10.0, 10.0, 10.0], [98.0, 99.0, 90.0]);
+    ///
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// assert_eq!(cell.angles()[0], 98.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 99.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn triclinic(lengths: [f64; 3], angles: [f64; 3]) -> UnitCell {
+        unsafe {
+            let handle = ffi::chfl_cell(lengths.as_ptr(), angles.as_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Create an `UnitCell` from a cell matrix. If `matrix` contains only
+    /// zeros, then an `Infinite` cell is created. If only the diagonal of the
+    /// matrix is non-zero, then the cell is `Orthorhombic`. Else a
+    /// `Triclinic` cell is created. The matrix entries should be in Angstroms.
+    ///
+    /// # Panics
+    ///
+    /// If the matrix has a negative determinant, or more generally is not
+    /// representing a unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::from_matrix([
+    ///     [1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]
+    /// ]);
+    ///
+    /// assert_eq!(cell.lengths(), [1.0, 2.0, 3.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn from_matrix(mut matrix: [[f64; 3]; 3]) -> UnitCell {
+        unsafe {
+            let handle = ffi::chfl_cell_from_matrix(matrix.as_mut_ptr());
+            UnitCell::from_ptr(handle)
+        }
+    }
+
+    /// Get the three lengths of the cell, in Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([30.0, 30.0, 23.0]);
+    /// assert_eq!(cell.lengths(), [30.0, 30.0, 23.0]);
+    /// ```
+    pub fn lengths(&self) -> [f64; 3] {
+        let mut lengths = [0.0; 3];
+        unsafe {
+            check_success(ffi::chfl_cell_lengths(self.as_ptr(), lengths.as_mut_ptr()));
+        }
+        return lengths;
+    }
+
+    /// Set the three lengths of the cell, in Angstroms.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is infinite, or if one of the
+    /// lengths is negative.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::new([30.0, 30.0, 23.0]);
+    ///
+    /// cell.set_lengths([10.0, 30.0, 42.0]).unwrap();
+    /// assert_eq!(cell.lengths(), [10.0, 30.0, 42.0]);
+    ///
+    /// assert!(UnitCell::infinite().set_lengths([1.0, 1.0, 1.0]).is_err());
+    /// ```
+    pub fn set_lengths(&mut self, lengths: [f64; 3]) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_cell_set_lengths(self.as_mut_ptr(), lengths.as_ptr())) }
+    }
+
+    /// Get the three angles of the cell, in degrees.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([20.0, 20.0, 20.0]);
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    ///
+    /// let cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    /// ```
+    pub fn angles(&self) -> [f64; 3] {
+        let mut angles = [0.0; 3];
+        unsafe {
+            check_success(ffi::chfl_cell_angles(self.as_ptr(), angles.as_mut_ptr()));
+        }
+        return angles;
+    }
+
+    /// Set the three angles of the cell, in degrees.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the unit cell is not `Triclinic`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let mut cell = UnitCell::triclinic([20.0, 20.0, 20.0], [100.0, 120.0, 90.0]);
+    /// assert_eq!(cell.angles()[0], 100.0);
+    /// // Rounding errors might occur due to internal representation
+    /// assert!((cell.angles()[1] - 120.0).abs() < 1e-12);
+    /// assert_eq!(cell.angles()[2], 90.0);
+    ///
+    /// cell.set_angles([90.0, 90.0, 90.0]).unwrap();
+    /// assert_eq!(cell.angles(), [90.0, 90.0, 90.0]);
+    /// ```
+    pub fn set_angles(&mut self, angles: [f64; 3]) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_cell_set_angles(self.as_mut_ptr(), angles.as_ptr())) }
+    }
+
+    /// Get the unit cell matricial representation.
+    ///
+    /// The unit cell representation is obtained by aligning the a vector along
+    /// the *x* axis and putting the b vector in the *xy* plane. This make the
+    /// matrix an upper triangular matrix:
+    ///
+    /// ```text
+    /// | a_x   b_x   c_x |
+    /// |  0    b_y   c_y |
+    /// |  0     0    c_z |
+    /// ```
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let matrix = cell.matrix();
+    ///
+    /// assert_eq!(matrix[0][0], 10.0);
+    /// assert_eq!(matrix[1][1], 20.0);
+    /// assert_eq!(matrix[2][2], 30.0);
+    ///
+    /// assert!(matrix[1][2].abs() < 1e-9);
+    /// ```
+    pub fn matrix(&self) -> [[f64; 3]; 3] {
+        let mut matrix = [[0.0; 3]; 3];
+        unsafe {
+            check_success(ffi::chfl_cell_matrix(self.as_ptr(), matrix.as_mut_ptr()));
+        }
+        return matrix;
+    }
+
+    /// Get the shape of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// ```
+    pub fn shape(&self) -> CellShape {
+        let mut shape = ffi::chfl_cellshape::CHFL_CELL_INFINITE;
+        unsafe {
+            check_success(ffi::chfl_cell_shape(self.as_ptr(), &mut shape));
+        }
+        return CellShape::from(shape);
+    }
+
+    /// Set the shape of the unit cell to `shape`.
+    ///
+    /// # Errors
+    ///
+    /// This can fail if the cell length or angles are incompatible with the
+    /// new shape.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{UnitCell, CellShape};
+    /// let mut cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    ///
+    /// cell.set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(cell.shape(), CellShape::Triclinic);
+    /// ```
+    pub fn set_shape(&mut self, shape: CellShape) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_cell_set_shape(self.as_mut_ptr(), shape.into())) }
+    }
+
+    /// Get the volume of the unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    /// assert_eq!(cell.volume(), 10.0 * 20.0 * 30.0);
+    /// ```
+    pub fn volume(&self) -> f64 {
+        let mut volume = 0.0;
+        unsafe {
+            check_success(ffi::chfl_cell_volume(self.as_ptr(), &mut volume));
+        }
+        return volume;
+    }
+
+    /// Wrap a `vector` in this unit cell.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::UnitCell;
+    /// let cell = UnitCell::new([10.0, 20.0, 30.0]);
+    ///
+    /// let mut vector = [12.0, 5.2, -45.3];
+    /// cell.wrap(&mut vector);
+    /// assert_eq!(vector, [2.0, 5.2, 14.700000000000003]);
+    /// ```
+    pub fn wrap(&self, vector: &mut [f64; 3]) {
+        unsafe {
+            check_success(ffi::chfl_cell_wrap(self.as_ptr(), vector.as_mut_ptr()));
+        }
+    }
+}
+
+impl Drop for UnitCell {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = ffi::chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+
+        let copy = cell.clone();
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+        assert_eq!(copy.lengths(), [2.0, 3.0, 4.0]);
+    }
+
+    #[test]
+    fn lengths() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.lengths(), [2.0, 3.0, 4.0]);
+        cell.set_lengths([10.0, 12.0, 11.0]).unwrap();
+        assert_eq!(cell.lengths(), [10.0, 12.0, 11.0]);
+    }
+
+    #[test]
+    fn angles() {
+        let mut cell = UnitCell::new([2.0, 3.0, 4.0]);
+        crate::assert_vector3d_eq(&cell.angles(), &[90.0, 90.0, 90.0], 1e-6);
+
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        cell.set_angles([80.0, 89.0, 100.0]).unwrap();
+
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 89.0, 100.0], 1e-6);
+
+        let cell = UnitCell::triclinic([1., 2., 3.], [80., 90., 100.]);
+        crate::assert_vector3d_eq(&cell.angles(), &[80.0, 90.0, 100.0], 1e-6);
+    }
+
+    #[test]
+    fn volume() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.volume(), 2.0 * 3.0 * 4.0);
+    }
+
+    #[test]
+    fn wrap() {
+        let cell = UnitCell::new([10.0, 20.0, 30.0]);
+        let mut vector = [12.0, 5.2, -45.3];
+        cell.wrap(&mut vector);
+        crate::assert_vector3d_eq(&vector, &[2.0, 5.2, 14.7], 1e-6);
+    }
+
+    #[test]
+    fn matrix() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+
+        let matrix = cell.matrix();
+        let result = [[2.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 4.0]];
+
+        for i in 0..3 {
+            for j in 0..3 {
+                approx::assert_ulps_eq!(matrix[i][j], result[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn from_matrix() {
+        let cell = UnitCell::from_matrix([[10.0, 0.0, 0.0], [0.0, 21.0, 0.0], [0.0, 0.0, 32.0]]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        assert_eq!(cell.lengths(), [10.0, 21.0, 32.0]);
+
+        let result_matrix = [[123.0, 4.08386, 71.7295], [0.0, 233.964, 133.571], [0.0, 0.0, 309.901]];
+        let cell = UnitCell::from_matrix(result_matrix);
+
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+        for i in 0..3 {
+            approx::assert_ulps_eq!(cell.lengths()[i], [123.0, 234.0, 345.0][i], epsilon = 1e-3);
+            approx::assert_ulps_eq!(cell.angles()[i], [67.0, 78.0, 89.0][i], epsilon = 1e-3);
+        }
+
+        let matrix = cell.matrix();
+        for i in 0..3 {
+            for j in 0..3 {
+                approx::assert_ulps_eq!(matrix[i][j], result_matrix[i][j], epsilon = 1e-12);
+            }
+        }
+    }
+
+    #[test]
+    fn shape() {
+        let cell = UnitCell::new([2.0, 3.0, 4.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+
+        let cell = UnitCell::infinite();
+        assert_eq!(cell.shape(), CellShape::Infinite);
+
+        let cell = UnitCell::triclinic([1.0, 2.0, 3.0], [80.0, 90.0, 100.0]);
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+
+        let mut cell = UnitCell::new([10.0, 10.0, 10.0]);
+        assert_eq!(cell.shape(), CellShape::Orthorhombic);
+        cell.set_shape(CellShape::Triclinic).unwrap();
+        assert_eq!(cell.shape(), CellShape::Triclinic);
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/errors.rs.html b/0.10.40/src/chemfiles/errors.rs.html new file mode 100644 index 000000000..6d519c6bc --- /dev/null +++ b/0.10.40/src/chemfiles/errors.rs.html @@ -0,0 +1,477 @@ +errors.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::os::raw::c_char;
+use std::panic::{self, RefUnwindSafe};
+use std::path::Path;
+
+use chemfiles_sys as ffi;
+
+use crate::strings;
+
+#[derive(Clone, Debug, PartialEq, Eq)]
+/// Error type for Chemfiles.
+pub struct Error {
+    /// The error status code
+    pub status: Status,
+    /// A message describing the error cause
+    pub message: String,
+}
+
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Clone, Debug, PartialEq, Eq)]
+/// Possible causes of error in chemfiles
+pub enum Status {
+    /// No error
+    Success = ffi::chfl_status::CHFL_SUCCESS as isize,
+    /// Error in memory allocations
+    MemoryError = ffi::chfl_status::CHFL_MEMORY_ERROR as isize,
+    /// Error while reading or writing a file
+    FileError = ffi::chfl_status::CHFL_FILE_ERROR as isize,
+    /// Error in file formatting, *i.e.* the file is invalid
+    FormatError = ffi::chfl_status::CHFL_FORMAT_ERROR as isize,
+    /// Error in selection string syntax
+    SelectionError = ffi::chfl_status::CHFL_SELECTION_ERROR as isize,
+    /// Error in configuration files syntax
+    ConfigurationError = ffi::chfl_status::CHFL_CONFIGURATION_ERROR as isize,
+    /// Error for out of bounds indexing
+    OutOfBounds = ffi::chfl_status::CHFL_OUT_OF_BOUNDS as isize,
+    /// Error related to properties
+    PropertyError = ffi::chfl_status::CHFL_PROPERTY_ERROR as isize,
+    /// Exception in the C++ chemfiles library
+    ChemfilesError = ffi::chfl_status::CHFL_GENERIC_ERROR as isize,
+    /// Exception in the C++ standard library
+    StdCppError = ffi::chfl_status::CHFL_CXX_ERROR as isize,
+    /// The given path is not valid UTF8
+    // TODO: rename this to UTF8Error in the next breaking release
+    UTF8PathError,
+}
+
+impl From<ffi::chfl_status> for Error {
+    fn from(status: ffi::chfl_status) -> Error {
+        let status = match status {
+            ffi::chfl_status::CHFL_SUCCESS => Status::Success,
+            ffi::chfl_status::CHFL_CXX_ERROR => Status::StdCppError,
+            ffi::chfl_status::CHFL_GENERIC_ERROR => Status::ChemfilesError,
+            ffi::chfl_status::CHFL_MEMORY_ERROR => Status::MemoryError,
+            ffi::chfl_status::CHFL_FILE_ERROR => Status::FileError,
+            ffi::chfl_status::CHFL_FORMAT_ERROR => Status::FormatError,
+            ffi::chfl_status::CHFL_SELECTION_ERROR => Status::SelectionError,
+            ffi::chfl_status::CHFL_CONFIGURATION_ERROR => Status::ConfigurationError,
+            ffi::chfl_status::CHFL_OUT_OF_BOUNDS => Status::OutOfBounds,
+            ffi::chfl_status::CHFL_PROPERTY_ERROR => Status::PropertyError,
+        };
+
+        let message = Error::last_error();
+        Error { status, message }
+    }
+}
+
+impl From<std::str::Utf8Error> for Error {
+    fn from(_: std::str::Utf8Error) -> Self {
+        Error {
+            status: Status::UTF8PathError,
+            message: "failed to convert data to UTF8 string".into(),
+        }
+    }
+}
+
+impl Error {
+    /// Create a new error because the given `path` is invalid UTF-8 data
+    pub(crate) fn utf8_path_error(path: &Path) -> Error {
+        Error {
+            status: Status::UTF8PathError,
+            message: format!("Could not convert '{}' to UTF8", path.display()),
+        }
+    }
+
+    /// Get the last error message from the C++ library.
+    pub fn last_error() -> String {
+        unsafe { strings::from_c(ffi::chfl_last_error()) }
+    }
+
+    /// Clear any error from the C++ library
+    pub fn cleanup() {
+        unsafe {
+            check(ffi::chfl_clear_errors()).expect("error in ffi::chfl_clear_errors. Things went very bad");
+        }
+    }
+}
+
+/// Check return value of a C function, and get the error if needed.
+pub(crate) fn check(status: ffi::chfl_status) -> Result<(), Error> {
+    if status == ffi::chfl_status::CHFL_SUCCESS {
+        Ok(())
+    } else {
+        Err(Error::from(status))
+    }
+}
+
+/// Check return value of a C function, panic if it failed.
+pub(crate) fn check_success(status: ffi::chfl_status) {
+    assert!(
+        status == ffi::chfl_status::CHFL_SUCCESS,
+        "unexpected failure: {}",
+        Error::last_error()
+    );
+}
+
+/// Check a pointer for null.
+pub(crate) fn check_not_null<T>(ptr: *const T) {
+    assert!(!ptr.is_null(), "unexpected null pointer: {}", Error::last_error());
+}
+
+pub trait WarningCallback: RefUnwindSafe + Fn(&str) {}
+impl<T> WarningCallback for T where T: RefUnwindSafe + Fn(&str) {}
+
+static mut LOGGING_CALLBACK: Option<*mut dyn WarningCallback<Output = ()>> = None;
+
+extern "C" fn warning_callback(message: *const c_char) {
+    unsafe {
+        let callback = &*LOGGING_CALLBACK.expect("No callback provided, this is an internal bug");
+        // ignore result. If a panic happened, everything is going badly anyway
+        let _result = panic::catch_unwind(|| {
+            callback(&strings::from_c(message));
+        });
+    }
+}
+
+/// Use `callback` for every chemfiles warning. The callback will be passed
+/// the warning message. This will drop any previous warning callback.
+pub fn set_warning_callback<F>(callback: F)
+where
+    F: WarningCallback + 'static,
+{
+    // box callback to ensure it stays accessible
+    let callback = Box::into_raw(Box::new(callback));
+    unsafe {
+        if let Some(previous) = LOGGING_CALLBACK {
+            // drop the previous callback
+            let previous = Box::from_raw(previous);
+            std::mem::drop(previous);
+            // set the LOGGING_CALLBACK to the new one
+            LOGGING_CALLBACK = Some(callback);
+        } else {
+            // set the LOGGING_CALLBACK
+            LOGGING_CALLBACK = Some(callback);
+            // Tell C code to use Rust-provided callback
+            check_success(ffi::chfl_set_warning_callback(warning_callback));
+        }
+    }
+}
+
+impl std::fmt::Display for Error {
+    fn fmt(&self, fmt: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
+        write!(fmt, "{}", self.message)
+    }
+}
+
+impl std::error::Error for Error {
+    fn description(&self) -> &str {
+        match self.status {
+            Status::Success => "Success",
+            Status::StdCppError => "Exception from the C++ standard library",
+            Status::ChemfilesError => "Exception from the chemfiles library",
+            Status::MemoryError => "Error in memory allocations",
+            Status::FileError => "Error while reading or writing a file",
+            Status::FormatError => "Error in file formatting, i.e. the file is invalid",
+            Status::SelectionError => "Error in selection string syntax",
+            Status::UTF8PathError => "A string is not valid UTF8",
+            Status::ConfigurationError => "Error in configuration files",
+            Status::OutOfBounds => "Out of bounds indexing",
+            Status::PropertyError => "Error in property",
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use crate::Trajectory;
+
+    #[test]
+    fn errors() {
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+        assert!(Trajectory::open("nope", 'r').is_err());
+        assert_eq!(
+            Error::last_error(),
+            "file at \'nope\' does not have an extension, provide a format name to read it"
+        );
+        Error::cleanup();
+        assert_eq!(Error::last_error(), "");
+    }
+
+    #[test]
+    fn codes() {
+        assert_eq!(Error::from(ffi::chfl_status::CHFL_SUCCESS).status, Status::Success);
+        assert_eq!(
+            Error::from(ffi::chfl_status::CHFL_CXX_ERROR).status,
+            Status::StdCppError
+        );
+        assert_eq!(
+            Error::from(ffi::chfl_status::CHFL_GENERIC_ERROR).status,
+            Status::ChemfilesError
+        );
+        assert_eq!(
+            Error::from(ffi::chfl_status::CHFL_MEMORY_ERROR).status,
+            Status::MemoryError
+        );
+        assert_eq!(Error::from(ffi::chfl_status::CHFL_FILE_ERROR).status, Status::FileError);
+        assert_eq!(
+            Error::from(ffi::chfl_status::CHFL_FORMAT_ERROR).status,
+            Status::FormatError
+        );
+        assert_eq!(
+            Error::from(ffi::chfl_status::CHFL_SELECTION_ERROR).status,
+            Status::SelectionError
+        );
+        assert_eq!(
+            Error::from(ffi::chfl_status::CHFL_OUT_OF_BOUNDS).status,
+            Status::OutOfBounds
+        );
+        assert_eq!(
+            Error::from(ffi::chfl_status::CHFL_PROPERTY_ERROR).status,
+            Status::PropertyError
+        );
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/frame.rs.html b/0.10.40/src/chemfiles/frame.rs.html new file mode 100644 index 000000000..c12ef93e6 --- /dev/null +++ b/0.10.40/src/chemfiles/frame.rs.html @@ -0,0 +1,2389 @@ +frame.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+#[allow(clippy::wildcard_imports)]
+use chemfiles_sys as ffi;
+
+use crate::{Atom, AtomMut, AtomRef};
+use crate::{BondOrder, Residue, Topology, TopologyRef};
+use crate::{UnitCell, UnitCellMut, UnitCellRef};
+
+use crate::errors::{check, check_not_null, check_success, Error};
+use crate::property::{PropertiesIter, Property, RawProperty};
+use crate::strings;
+
+/// A `Frame` contains data from one simulation step: the current unit
+/// cell, the topology, the positions, and the velocities of the particles in
+/// the system. If some information is missing (topology or velocity or unit
+/// cell), the corresponding data is filled with a default value.
+#[derive(Debug)]
+pub struct Frame {
+    handle: *mut ffi::CHFL_FRAME,
+}
+
+impl Clone for Frame {
+    fn clone(&self) -> Frame {
+        unsafe {
+            let new_handle = ffi::chfl_frame_copy(self.as_ptr());
+            Frame::from_ptr(new_handle)
+        }
+    }
+}
+
+#[derive(Debug)]
+pub struct AtomIter<'a> {
+    frame: &'a Frame,
+    index: usize,
+    size: usize,
+}
+
+impl Frame {
+    /// Create a `Frame` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut ffi::CHFL_FRAME) -> Frame {
+        check_not_null(ptr);
+        Frame { handle: ptr }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const ffi::CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut ffi::CHFL_FRAME {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut ffi::CHFL_FRAME {
+        self.handle
+    }
+
+    /// Create an empty frame. It will be resized by the library as needed.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    ///
+    /// assert_eq!(frame.size(), 0);
+    /// ```
+    pub fn new() -> Frame {
+        unsafe { Frame::from_ptr(ffi::chfl_frame()) }
+    }
+
+    /// Get a reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// let atom = frame.atom(0);
+    /// assert_eq!(atom.name(), "Zn");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = ffi::chfl_atom_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64);
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this frame.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    ///
+    /// assert_eq!(frame.atom(0).name(), "Zn");
+    ///
+    /// frame.atom_mut(0).set_name("Fe");
+    /// assert_eq!(frame.atom(0).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = ffi::chfl_atom_from_frame(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.size(), 0);
+    ///
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(ffi::chfl_frame_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize the positions and the velocities in this frame, to make space for
+    /// `natoms` atoms. Previous data is conserved, as well as the presence of
+    /// absence of velocities.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// assert_eq!(frame.size(), 67);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(ffi::chfl_frame_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` and the corresponding position and optionally velocity
+    /// data to this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [1.0, 1.0, 2.0], None);
+    ///
+    /// frame.add_velocities();
+    /// frame.add_atom(&Atom::new("Zn"), [-1.0, 1.0, 2.0], [0.2, 0.1, 0.0]);
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom, position: [f64; 3], velocity: impl Into<Option<[f64; 3]>>) {
+        let velocity = velocity.into();
+        let velocity_ptr = match velocity {
+            Some(ref data) => data.as_ptr(),
+            None => std::ptr::null(),
+        };
+
+        unsafe {
+            check_success(ffi::chfl_frame_add_atom(
+                self.as_mut_ptr(),
+                atom.as_ptr(),
+                position.as_ptr(),
+                velocity_ptr,
+            ));
+        }
+    }
+
+    /// Remove the atom at index `i` in this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("Zn"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Fe"), [0.0; 3], None);
+    /// frame.add_atom(&Atom::new("Sn"), [0.0; 3], None);
+    /// assert_eq!(frame.size(), 3);
+    ///
+    /// frame.remove(1);
+    /// assert_eq!(frame.size(), 2);
+    /// assert_eq!(frame.atom(1).name(), "Sn");
+    /// ```
+    pub fn remove(&mut self, i: usize) {
+        unsafe {
+            check_success(ffi::chfl_frame_remove(self.as_mut_ptr(), i as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    /// assert_eq!(frame.topology().bonds_count(), 3);
+    ///
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+    /// assert_eq!(frame.topology().bonds(), vec![[0, 1], [1, 3], [2, 4]]);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(ffi::chfl_frame_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the frame
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, BondOrder};
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    /// frame.resize(2);
+    ///
+    /// frame.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(ffi::chfl_frame_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// the frame.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(5);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(3, 1);
+    /// frame.add_bond(2, 4);
+    ///
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3], [2, 4]]);
+    ///
+    /// frame.remove_bond(2, 4);
+    /// let bonds = frame.topology().bonds();
+    /// assert_eq!(bonds, vec![[0, 1], [1, 3]]);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(ffi::chfl_frame_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a copy of `residue` to this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue id is already in this frame's
+    /// topology, or if the residue contain atoms that are already in another
+    /// residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Residue};
+    /// let mut frame = Frame::new();
+    ///
+    /// let residue = Residue::new("foo");
+    /// frame.add_residue(&residue).unwrap();
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.residues_count(), 1);
+    /// assert_eq!(topology.residue(0).unwrap().name(), "foo");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_frame_add_residue(self.as_mut_ptr(), residue.as_ptr())) }
+    }
+
+    /// Get the distance between the atoms at indexes `i` and `j` in this frame,
+    /// accounting for periodic boundary conditions. The result is expressed in
+    /// Angstroms.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [1.0, 2.0, 3.0], None);
+    ///
+    /// assert_eq!(frame.distance(0, 1), f64::sqrt(14.0));
+    /// ```
+    pub fn distance(&self, i: usize, j: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(ffi::chfl_frame_distance(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get the angle formed by the atoms at indexes `i`, `j` and `k` in this
+    /// frame, accounting for periodic boundary conditions. The result is
+    /// expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.angle(0, 1, 2), f64::consts::PI / 2.0);
+    /// ```
+    pub fn angle(&self, i: usize, j: usize, k: usize) -> f64 {
+        let mut angle = 0.0;
+        unsafe {
+            check_success(ffi::chfl_frame_angle(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                &mut angle,
+            ));
+        }
+        return angle;
+    }
+
+    /// Get the dihedral angle formed by the atoms at indexes `i`, `j`, `k` and
+    /// `m` in this frame, accounting for periodic boundary conditions. The
+    /// result is expressed in radians.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// # use std::f64;
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 1.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 1.0], None);
+    ///
+    /// assert_eq!(frame.dihedral(0, 1, 2, 3), f64::consts::PI / 2.0);
+    /// ```
+    pub fn dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut dihedral = 0.0;
+        unsafe {
+            check_success(ffi::chfl_frame_dihedral(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut dihedral,
+            ));
+        }
+        return dihedral;
+    }
+
+    /// Get the out of plane distance formed by the atoms at indexes `i`, `j`,
+    /// `k` and `m` in this frame, accounting for periodic boundary conditions.
+    /// The result is expressed in angstroms.
+    ///
+    /// This is the distance between the atom j and the ikm plane. The j atom
+    /// is the center of the improper dihedral angle formed by i, j, k and m.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("A"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("B"), [0.0, 0.0, 2.0], None);
+    /// frame.add_atom(&Atom::new("C"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("D"), [0.0, 1.0, 0.0], None);
+    ///
+    /// assert_eq!(frame.out_of_plane(0, 1, 2, 3), 2.0);
+    /// ```
+    pub fn out_of_plane(&self, i: usize, j: usize, k: usize, m: usize) -> f64 {
+        let mut distance = 0.0;
+        unsafe {
+            check_success(ffi::chfl_frame_out_of_plane(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                k as u64,
+                m as u64,
+                &mut distance,
+            ));
+        }
+        return distance;
+    }
+
+    /// Get a view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions.len(), 67);
+    /// assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn positions(&self) -> &[[f64; 3]] {
+        let mut ptr = std::ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(ffi::chfl_frame_positions(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms,
+            ));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return std::slice::from_raw_parts(ptr, size);
+        }
+    }
+
+    /// Get a mutable view into the positions of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// {
+    ///     let positions = frame.positions_mut();
+    ///     assert_eq!(positions[0], [0.0, 0.0, 0.0]);
+    ///     positions[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let positions = frame.positions();
+    /// assert_eq!(positions[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn positions_mut(&mut self) -> &mut [[f64; 3]] {
+        let mut ptr = std::ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(ffi::chfl_frame_positions(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return std::slice::from_raw_parts_mut(ptr, size);
+        }
+    }
+
+    /// Get a view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    ///
+    /// let velocities = frame.velocities().expect("missing velocities");
+    /// assert_eq!(velocities.len(), 67);
+    /// assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    /// ```
+    pub fn velocities(&self) -> Option<&[[f64; 3]]> {
+        if !self.has_velocities() {
+            return None;
+        }
+
+        let mut ptr = std::ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(ffi::chfl_frame_velocities(
+                self.as_mut_ptr_MANUALLY_CHECKING_BORROW(),
+                &mut ptr,
+                &mut natoms,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return Some(std::slice::from_raw_parts(ptr, size));
+        }
+    }
+
+    /// Get a mutable view into the velocities of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(67);
+    /// frame.add_velocities();
+    /// {
+    ///     let velocities = frame.velocities_mut().expect("missing velocities");
+    ///     assert_eq!(velocities[0], [0.0, 0.0, 0.0]);
+    ///     velocities[0] = [1.0, 2.0, 3.0];
+    /// }
+    ///
+    /// let velocities = frame.velocities().expect("missing velocities");
+    /// assert_eq!(velocities[0], [1.0, 2.0, 3.0]);
+    /// ```
+    pub fn velocities_mut(&mut self) -> Option<&mut [[f64; 3]]> {
+        if !self.has_velocities() {
+            return None;
+        }
+
+        let mut ptr = std::ptr::null_mut();
+        let mut natoms = 0;
+        unsafe {
+            check_success(ffi::chfl_frame_velocities(self.as_mut_ptr(), &mut ptr, &mut natoms));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        let size = natoms as usize;
+        unsafe {
+            return Some(std::slice::from_raw_parts_mut(ptr, size));
+        }
+    }
+
+    /// Check if this frame contains velocity data.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn has_velocities(&self) -> bool {
+        let mut res = 0;
+        unsafe {
+            check_success(ffi::chfl_frame_has_velocities(self.as_ptr(), &mut res));
+        }
+        return res != 0;
+    }
+
+    /// Add velocity data to this frame. If the frame already have velocities,
+    /// this does nothing.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.has_velocities(), false);
+    ///
+    /// frame.add_velocities();
+    /// assert_eq!(frame.has_velocities(), true);
+    /// ```
+    pub fn add_velocities(&mut self) {
+        unsafe {
+            check_success(ffi::chfl_frame_add_velocities(self.as_mut_ptr()));
+        }
+    }
+
+    /// Get a reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let frame = Frame::new();
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Infinite);
+    /// ```
+    pub fn cell(&self) -> UnitCellRef {
+        unsafe {
+            let handle = ffi::chfl_cell_from_frame(self.as_mut_ptr_MANUALLY_CHECKING_BORROW());
+            UnitCell::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the `UnitCell` from this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// assert_eq!(frame.cell().shape(), CellShape::Infinite);
+    ///
+    /// frame.cell_mut().set_shape(CellShape::Triclinic).unwrap();
+    /// assert_eq!(frame.cell().shape(), CellShape::Triclinic);
+    /// ```
+    pub fn cell_mut(&mut self) -> UnitCellMut {
+        unsafe {
+            let handle = ffi::chfl_cell_from_frame(self.as_mut_ptr());
+            UnitCell::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Set the `UnitCell` of this frame to `cell`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, UnitCell, CellShape};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.set_cell(&UnitCell::new([10.0, 10.0, 10.0]));
+    ///
+    /// let cell = frame.cell();
+    /// assert_eq!(cell.shape(), CellShape::Orthorhombic);
+    /// assert_eq!(cell.lengths(), [10.0, 10.0, 10.0]);
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(ffi::chfl_frame_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get a reference to the `Topology` of this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// frame.resize(42);
+    ///
+    /// let topology = frame.topology();
+    /// assert_eq!(topology.size(), 42);
+    /// ```
+    pub fn topology(&self) -> TopologyRef {
+        unsafe {
+            let handle = ffi::chfl_topology_from_frame(self.as_ptr());
+            Topology::ref_from_ptr(handle)
+        }
+    }
+
+    /// Set the `Topology` of this frame to `topology`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology contains a different number of atoms
+    /// than this frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Topology, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.resize(2);
+    ///
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_atom(&Atom::new("Cl"));
+    /// topology.add_bond(0, 1);
+    ///
+    /// frame.set_topology(&topology).unwrap();
+    /// assert_eq!(frame.atom(0).name(), "Cl");
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_frame_set_topology(self.as_mut_ptr(), topology.as_ptr())) }
+    }
+
+    /// Get this frame step, i.e. the frame number in the trajectory
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    /// ```
+    pub fn step(&self) -> usize {
+        let mut step = 0;
+        unsafe {
+            check_success(ffi::chfl_frame_step(self.as_ptr(), &mut step));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return step as usize;
+    }
+
+    /// Set this frame step to `step`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Frame;
+    /// let mut frame = Frame::new();
+    /// assert_eq!(frame.step(), 0);
+    ///
+    /// frame.set_step(10);
+    /// assert_eq!(frame.step(), 10);
+    /// ```
+    pub fn set_step(&mut self, step: usize) {
+        unsafe {
+            check_success(ffi::chfl_frame_set_step(self.as_mut_ptr(), step as u64));
+        }
+    }
+
+    /// Guess the bonds, angles and dihedrals in this `frame`.
+    ///
+    /// The bonds are guessed using a distance-based algorithm, and then angles
+    /// and dihedrals are guessed from the bonds.
+    ///
+    /// # Errors
+    ////
+    /// This function can fail if the covalent radius is unknown for some atoms
+    /// in the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Frame, Atom};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("Cl"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("Cl"), [1.5, 0.0, 0.0], None);
+    /// assert_eq!(frame.topology().bonds_count(), 0);
+    ///
+    /// frame.guess_bonds().unwrap();
+    /// assert_eq!(frame.topology().bonds_count(), 1);
+    /// ```
+    pub fn guess_bonds(&mut self) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_frame_guess_bonds(self.as_mut_ptr())) }
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology of the frame.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, Frame};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [0.0, 1.0, 0.0], None);
+    ///
+    /// frame.add_bond(0, 1);
+    /// frame.add_bond(1, 2);
+    ///
+    /// assert_eq!(frame.topology().bonds().len(), 2);
+    /// assert_eq!(frame.topology().angles().len(), 1);
+    ///
+    /// frame.clear_bonds();
+    /// assert!(frame.topology().bonds().is_empty());
+    /// assert!(frame.topology().angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(ffi::chfl_frame_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a new `property` with the given `name` to this frame.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("a string", "hello");
+    /// frame.set("a double", 4.3);
+    ///
+    /// assert_eq!(frame.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(frame.get("a double"), Some(Property::Double(4.3)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(ffi::chfl_frame_set_property(
+                self.as_mut_ptr(),
+                buffer.as_ptr(),
+                property.as_ptr(),
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(frame.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(frame.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = ffi::chfl_frame_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Frame, Property};
+    /// let mut frame = Frame::new();
+    /// frame.set("foo", Property::Double(22.2));
+    /// frame.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in frame.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(ffi::chfl_frame_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![std::ptr::null_mut(); size];
+        unsafe {
+            check_success(ffi::chfl_frame_list_properties(
+                self.as_ptr(),
+                c_names.as_mut_ptr(),
+                count,
+            ));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property")),
+        }
+    }
+
+    /// Gets an iterator over atoms
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, AtomRef, Frame};
+    /// let mut frame = Frame::new();
+    ///
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    ///
+    /// let mut atoms: Vec<AtomRef> = Vec::new();
+    ///
+    /// for atom in frame.iter_atoms() {
+    ///     atoms.push(atom);
+    /// }
+    ///
+    /// assert_eq!(atoms.len(), 2);
+    /// ```
+    pub fn iter_atoms(&self) -> AtomIter<'_> {
+        AtomIter {
+            frame: self,
+            index: 0,
+            size: self.size(),
+        }
+    }
+}
+
+impl Drop for Frame {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = ffi::chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl<'a> Iterator for AtomIter<'a> {
+    type Item = AtomRef<'a>;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.size <= self.index {
+            return None;
+        }
+        let atom = self.frame.atom(self.index);
+        self.index += 1;
+        Some(atom)
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+        let copy = frame.clone();
+        assert_eq!(copy.size(), 0);
+
+        frame.resize(42);
+        assert_eq!(frame.size(), 42);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.size(), 0);
+
+        frame.resize(12);
+        assert_eq!(frame.size(), 12);
+    }
+
+    #[test]
+    fn add_atom() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        let positions = &[[1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        frame.add_velocities();
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], [4.0, 3.0, 2.0]);
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+        assert_eq!(frame.atom(1).name(), "F");
+
+        let positions = &[[1.0, 1.0, 2.0], [1.0, 1.0, 2.0]];
+        assert_eq!(frame.positions(), positions);
+
+        let velocities = &[[0.0, 0.0, 0.0], [4.0, 3.0, 2.0]];
+        assert_eq!(frame.velocities().unwrap(), velocities);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_atom() {
+        let mut frame = Frame::new();
+        frame.resize(22);
+        let _atom = frame.atom(23);
+    }
+
+    #[test]
+    fn remove_atom() {
+        let mut frame = Frame::new();
+        frame.add_atom(&Atom::new("U"), [1.0, 1.0, 2.0], None);
+        frame.add_atom(&Atom::new("F"), [1.0, 1.0, 2.0], None);
+
+        assert_eq!(frame.size(), 2);
+        assert_eq!(frame.atom(0).name(), "U");
+
+        frame.remove(0);
+        assert_eq!(frame.size(), 1);
+        assert_eq!(frame.atom(0).name(), "F");
+    }
+
+    #[test]
+    #[should_panic]
+    fn remove_out_of_bounds() {
+        let mut frame = Frame::new();
+        frame.resize(32);
+
+        frame.remove(100);
+    }
+
+    #[test]
+    fn positions() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        let expected = &[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0], [10.0, 11.0, 12.0]];
+
+        frame.positions_mut().clone_from_slice(expected);
+        assert_eq!(frame.positions(), expected);
+    }
+
+    #[test]
+    fn velocities() {
+        let mut frame = Frame::new();
+        frame.resize(4);
+        assert!(!frame.has_velocities());
+        frame.add_velocities();
+        assert!(frame.has_velocities());
+
+        let expected = &[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0], [10.0, 11.0, 12.0]];
+
+        frame.velocities_mut().unwrap().clone_from_slice(expected);
+        assert_eq!(frame.velocities().unwrap(), expected);
+    }
+
+    #[test]
+    fn cell() {
+        let mut frame = Frame::new();
+        frame.set_cell(&UnitCell::new([3.0, 4.0, 5.0]));
+        let cell = frame.cell();
+        assert_eq!(cell.lengths(), [3.0, 4.0, 5.0]);
+    }
+
+    #[test]
+    fn topology() {
+        let mut frame = Frame::new();
+        frame.resize(2);
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Zn"));
+        topology.add_atom(&Atom::new("Ar"));
+
+        assert!(frame.set_topology(&topology).is_ok());
+
+        let topology = frame.topology();
+
+        assert_eq!(topology.atom(0).name(), "Zn");
+        assert_eq!(topology.atom(1).name(), "Ar");
+
+        assert_eq!(frame.atom(0).name(), "Zn");
+        assert_eq!(frame.atom(1).name(), "Ar");
+    }
+
+    #[test]
+    fn bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        assert_eq!(frame.topology().bonds_count(), 0);
+
+        frame.add_bond(0, 1);
+        frame.add_bond(9, 2);
+        frame.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(frame.topology().bonds_count(), 3);
+
+        assert_eq!(frame.topology().bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(frame.topology().bond_orders(), expected);
+
+        assert_eq!(frame.topology().bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(frame.topology().bond_order(3, 7), BondOrder::Aromatic);
+
+        frame.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        frame.remove_bond(8, 7);
+        assert_eq!(frame.topology().bonds_count(), 2);
+
+        frame.clear_bonds();
+        assert_eq!(frame.topology().bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut frame = Frame::new();
+        frame.resize(12);
+        frame.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn residues() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.topology().residues_count(), 0);
+
+        let residue = &Residue::new("foobar");
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+        frame.add_residue(residue).unwrap();
+
+        assert_eq!(frame.topology().residues_count(), 3);
+        assert_eq!(frame.topology().residue(0).unwrap().name(), "foobar");
+    }
+
+    #[test]
+    fn step() {
+        let mut frame = Frame::new();
+        assert_eq!(frame.step(), 0);
+        frame.set_step(42);
+        assert_eq!(frame.step(), 42);
+    }
+
+    #[test]
+    fn property() {
+        let mut frame = Frame::new();
+        frame.set("foo", -22.0);
+        assert_eq!(frame.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(frame.get("bar"), None);
+
+        frame.set("bar", Property::String("here".into()));
+        for (name, property) in frame.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+
+    #[test]
+    fn pbc_geometry() {
+        use std::f64::consts::PI;
+
+        let mut frame = Frame::new();
+        let atom = &Atom::new("");
+
+        frame.add_atom(atom, [1.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 0.0], None);
+        frame.add_atom(atom, [0.0, 1.0, 1.0], None);
+        frame.add_atom(atom, [0.0, 0.0, 2.0], None);
+
+        assert_eq!(frame.distance(0, 2), f64::sqrt(2.0));
+        assert_eq!(frame.angle(0, 1, 2), PI / 2.0);
+        assert_eq!(frame.dihedral(0, 1, 2, 3), PI / 2.0);
+        assert_eq!(frame.out_of_plane(1, 4, 0, 2), 2.0);
+    }
+
+    #[test]
+    fn atom_iterator() {
+        let mut frame = Frame::new();
+
+        frame.add_atom(&Atom::new("H1"), [1.0, 0.0, 0.0], None);
+        frame.add_atom(&Atom::new("H2"), [0.0, 1.0, 0.0], None);
+        frame.add_atom(&Atom::new("H3"), [0.0, 0.0, 1.0], None);
+        frame.add_atom(&Atom::new("H4"), [1.0, 1.0, 1.0], None);
+
+        let mut items: Vec<(AtomRef, &[f64; 3])> = Vec::new();
+
+        for item in frame.iter_atoms().zip(frame.positions()) {
+            items.push(item);
+        }
+
+        assert_eq!(items[0].0.name(), "H1");
+        assert_eq!(items[2].0.name(), "H3");
+
+        assert_eq!(items[1].1, &[0.0_f64, 1.0_f64, 0.0_f64]);
+        assert_eq!(items[3].1, &[1.0_f64, 1.0_f64, 1.0_f64]);
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/lib.rs.html b/0.10.40/src/chemfiles/lib.rs.html new file mode 100644 index 000000000..0c422ce31 --- /dev/null +++ b/0.10.40/src/chemfiles/lib.rs.html @@ -0,0 +1,265 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! Chemfiles is a multi-language library written in modern C++ for reading and
+//! writing from and to molecular trajectory files. These files are created by
+//! your favorite theoretical chemistry program, and contains information about
+//! atomic or residues names and positions. Some format also have additional
+//! information, such as velocities, forces, energy, …
+//!
+//! This crate expose the C API of chemfiles to Rust, and make all the
+//! functionalities accessible. For more information on the C++ library,
+//! please see its [documentation][cxx_doc]. Specifically, the following pages
+//! are worth reading:
+//!
+//! - The [overview][overview] of the classes organization;
+//! - The list of [supported formats][formats];
+//! - The documentation for the [selection language][selections];
+//!
+//! [cxx_doc]: https://chemfiles.org/chemfiles
+//! [overview]: https://chemfiles.org/chemfiles/latest/overview.html
+//! [formats]: https://chemfiles.org/chemfiles/latest/formats.html
+//! [selections]: https://chemfiles.org/chemfiles/latest/selections.html
+
+#![deny(missing_docs)]
+#![warn(trivial_casts, unused_import_braces, variant_size_differences)]
+#![warn(unused_results)]
+// Configuration for clippy lints
+#![warn(clippy::all, clippy::pedantic)]
+#![allow(clippy::needless_return, clippy::module_name_repetitions)]
+#![allow(clippy::missing_panics_doc, clippy::must_use_candidate)]
+// Allow a few more clippy lints in test mode
+#![cfg_attr(test, allow(clippy::float_cmp, clippy::unreadable_literal, clippy::shadow_unrelated))]
+// deny(warnings) in doc tests
+#![doc(test(attr(deny(warnings))))]
+#![doc(test(attr(allow(unused_variables))))]
+
+use chemfiles_sys as ffi;
+
+mod strings;
+
+mod errors;
+pub use self::errors::set_warning_callback;
+pub use self::errors::{Error, Status};
+
+mod atom;
+pub use self::atom::Atom;
+pub use self::atom::AtomMut;
+pub use self::atom::AtomRef;
+
+mod cell;
+pub use self::cell::CellShape;
+pub use self::cell::UnitCell;
+pub use self::cell::UnitCellMut;
+pub use self::cell::UnitCellRef;
+
+mod residue;
+pub use self::residue::Residue;
+pub use self::residue::ResidueRef;
+
+mod topology;
+pub use self::topology::BondOrder;
+pub use self::topology::Topology;
+pub use self::topology::TopologyRef;
+
+mod frame;
+pub use self::frame::Frame;
+
+mod trajectory;
+pub use self::trajectory::MemoryTrajectoryReader;
+pub use self::trajectory::Trajectory;
+
+mod selection;
+pub use self::selection::{Match, Selection};
+
+mod property;
+pub use self::property::PropertiesIter;
+pub use self::property::Property;
+
+mod misc;
+pub use self::misc::{formats_list, guess_format, FormatMetadata};
+
+/// Get the version of the chemfiles library.
+///
+/// # Example
+/// ```
+/// let version = chemfiles::version();
+/// assert!(version.starts_with("0.10"));
+/// ```
+pub fn version() -> String {
+    unsafe { strings::from_c(ffi::chfl_version()) }
+}
+
+/// Read configuration data from the file at `path`.
+///
+/// By default, chemfiles reads configuration from any file named
+/// `.chemfiles.toml` in the current directory or any parent directory. This
+/// function can be used to add data from another configuration file. Data from
+/// the new configuration file will overwrite any existing data.
+///
+/// # Errors
+///
+/// This function will fail if there is no file at `path`, or if the file is
+/// incorrectly formatted.
+///
+/// # Example
+/// ```no_run
+/// chemfiles::add_configuration("local-config.toml").unwrap();
+/// // from now on, the data from "local-config.toml" will be used
+/// ```
+pub fn add_configuration<S>(path: S) -> Result<(), Error>
+where
+    S: AsRef<str>,
+{
+    let buffer = strings::to_c(path.as_ref());
+    unsafe { errors::check(ffi::chfl_add_configuration(buffer.as_ptr())) }
+}
+
+#[cfg(test)]
+fn assert_vector3d_eq(lhs: &[f64; 3], rhs: &[f64; 3], eps: f64) {
+    lhs.iter()
+        .zip(rhs)
+        .for_each(|(l, r)| approx::assert_ulps_eq!(l, r, epsilon = eps));
+}
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    fn version() {
+        assert!(!crate::version().is_empty());
+        assert!(crate::version().starts_with("0.10"));
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/misc.rs.html b/0.10.40/src/chemfiles/misc.rs.html new file mode 100644 index 000000000..a835121aa --- /dev/null +++ b/0.10.40/src/chemfiles/misc.rs.html @@ -0,0 +1,299 @@ +misc.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2020 Guillaume Fraux -- BSD licensed
+use std::convert::TryInto;
+use std::ffi::CStr;
+use std::path::Path;
+
+use chemfiles_sys as ffi;
+
+use crate::errors::check_success;
+
+use crate::{errors::check, Error};
+
+/// `FormatMetadata` contains metadata associated with one format.
+#[allow(clippy::struct_excessive_bools)]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct FormatMetadata {
+    /// Name of the format.
+    pub name: &'static str,
+    /// Extension associated with the format.
+    pub extension: Option<&'static str>,
+    /// Extended, user-facing description of the format.
+    pub description: &'static str,
+    /// URL pointing to the format definition/reference.
+    pub reference: &'static str,
+    /// Is reading files in this format implemented?
+    pub read: bool,
+    /// Is writing files in this format implemented?
+    pub write: bool,
+    /// Does this format support in-memory IO?
+    pub memory: bool,
+    /// Does this format support storing atomic positions?
+    pub positions: bool,
+    /// Does this format support storing atomic velocities?
+    pub velocities: bool,
+    /// Does this format support storing unit cell information?
+    pub unit_cell: bool,
+    /// Does this format support storing atom names or types?
+    pub atoms: bool,
+    /// Does this format support storing bonds between atoms?
+    pub bonds: bool,
+    /// Does this format support storing residues?
+    pub residues: bool,
+}
+
+impl FormatMetadata {
+    pub(crate) fn from_raw(raw: &ffi::chfl_format_metadata) -> Self {
+        let str_from_ptr = |ptr| unsafe { CStr::from_ptr(ptr).to_str().expect("Invalid Rust str from C") };
+        let extension = if raw.extension.is_null() {
+            None
+        } else {
+            Some(str_from_ptr(raw.extension))
+        };
+        Self {
+            name: str_from_ptr(raw.name),
+            extension,
+            description: str_from_ptr(raw.description),
+            reference: str_from_ptr(raw.reference),
+            read: raw.read,
+            write: raw.write,
+            memory: raw.memory,
+            positions: raw.positions,
+            velocities: raw.velocities,
+            unit_cell: raw.unit_cell,
+            atoms: raw.atoms,
+            bonds: raw.bonds,
+            residues: raw.residues,
+        }
+    }
+}
+
+/// Get the list of formats known by chemfiles, as well as all associated metadata.
+///
+/// # Example
+/// ```
+/// let formats = chemfiles::formats_list();
+/// println!("chemfiles supports {} formats:", formats.len());
+/// for format in &formats {
+///     println!(
+///         "   {:<15} {}",
+///         format.name,
+///         format.extension.as_deref().unwrap_or("")
+///     );
+/// }
+/// ```
+#[must_use]
+pub fn formats_list() -> Vec<FormatMetadata> {
+    let mut formats = std::ptr::null_mut();
+    let mut count: u64 = 0;
+    let formats_slice = unsafe {
+        check_success(ffi::chfl_formats_list(&mut formats, &mut count));
+        std::slice::from_raw_parts(formats, count.try_into().expect("failed to convert u64 to usize"))
+    };
+    let formats_vec = formats_slice.iter().map(FormatMetadata::from_raw).collect();
+    unsafe {
+        let _ = ffi::chfl_free(formats as *const _);
+    }
+    return formats_vec;
+}
+
+#[allow(clippy::doc_markdown)]
+/// Get the format that chemfiles would use to read a file at the given
+/// ``path``.
+///
+/// The format is mostly guessed from the path extension, chemfiles only tries
+/// to read the file to distinguish between CIF and mmCIF files. Opening the
+/// file using the returned format string might still fail. For example, it will
+/// fail if the file is not actually formatted according to the guessed format;
+/// or the format/compression combination is not supported (e.g. `XTC / GZ` will
+/// not work since the XTC reader does not support compressed files).
+///
+/// The returned format is represented in a way compatible with the various
+/// `Trajectory` constructors, i.e. `"<format name> [/ <compression>]"`, where
+/// compression is optional.
+///
+/// # Errors
+///
+/// This function returns an error if the file format couldn't be guessed.
+///
+/// # Panics
+///
+/// This function panics if the path can't be converted to a Unicode string.
+///
+/// # Examples
+/// ```
+/// let format = chemfiles::guess_format("trajectory.xyz.xz").unwrap();
+/// assert_eq!(format, "XYZ / XZ");
+///
+/// let format = chemfiles::guess_format("trajectory.nc").unwrap();
+/// assert_eq!(format, "Amber NetCDF");
+///
+/// let format = chemfiles::guess_format("trajectory.unknown.format");
+/// assert!(format.is_err());
+/// ```
+pub fn guess_format<P>(path: P) -> Result<String, Error>
+where
+    P: AsRef<Path>,
+{
+    let path = path.as_ref().to_str().expect("couldn't convert path to Unicode");
+    let path = crate::strings::to_c(path);
+    let mut buffer = vec![0; 128];
+    unsafe {
+        check(ffi::chfl_guess_format(
+            path.as_ptr(),
+            buffer.as_mut_ptr(),
+            buffer.len() as u64,
+        ))?;
+    }
+    Ok(crate::strings::from_c(buffer.as_ptr()))
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/property.rs.html b/0.10.40/src/chemfiles/property.rs.html new file mode 100644 index 000000000..12cfb08e0 --- /dev/null +++ b/0.10.40/src/chemfiles/property.rs.html @@ -0,0 +1,569 @@ +property.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use chemfiles_sys as ffi;
+
+use crate::errors::{check, check_not_null, check_success, Error};
+use crate::strings;
+
+/// A thin wrapper around `ffi::CHFL_PROPERTY`
+#[derive(Debug)]
+pub(crate) struct RawProperty {
+    handle: *mut ffi::CHFL_PROPERTY,
+}
+
+impl RawProperty {
+    /// Create a `RawProperty` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    pub unsafe fn from_ptr(ptr: *mut ffi::CHFL_PROPERTY) -> RawProperty {
+        check_not_null(ptr);
+        RawProperty { handle: ptr }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    pub fn as_ptr(&self) -> *const ffi::CHFL_PROPERTY {
+        self.handle
+    }
+
+    fn double(value: f64) -> RawProperty {
+        unsafe {
+            let handle = ffi::chfl_property_double(value);
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn bool(value: bool) -> RawProperty {
+        unsafe {
+            let handle = ffi::chfl_property_bool(u8::from(value));
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn vector3d(value: [f64; 3]) -> RawProperty {
+        unsafe {
+            let handle = ffi::chfl_property_vector3d(value.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn string(value: &str) -> RawProperty {
+        let buffer = strings::to_c(value);
+        unsafe {
+            let handle = ffi::chfl_property_string(buffer.as_ptr());
+            RawProperty::from_ptr(handle)
+        }
+    }
+
+    fn get_kind(&self) -> ffi::chfl_property_kind {
+        let mut kind = ffi::chfl_property_kind::CHFL_PROPERTY_BOOL;
+        unsafe {
+            check_success(ffi::chfl_property_get_kind(self.as_ptr(), &mut kind));
+        }
+        return kind;
+    }
+
+    fn get_bool(&self) -> Result<bool, Error> {
+        let mut value = 0;
+        unsafe {
+            check(ffi::chfl_property_get_bool(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value != 0);
+    }
+
+    fn get_double(&self) -> Result<f64, Error> {
+        let mut value = 0.0;
+        unsafe {
+            check(ffi::chfl_property_get_double(self.as_ptr(), &mut value))?;
+        }
+        return Ok(value);
+    }
+
+    fn get_string(&self) -> Result<String, Error> {
+        let get_string = |ptr, len| unsafe { ffi::chfl_property_get_string(self.as_ptr(), ptr, len) };
+        let value = strings::call_autogrow_buffer(64, get_string)?;
+        return Ok(strings::from_c(value.as_ptr()));
+    }
+
+    fn get_vector3d(&self) -> Result<[f64; 3], Error> {
+        let mut value = [0.0; 3];
+        unsafe {
+            check(ffi::chfl_property_get_vector3d(self.as_ptr(), value.as_mut_ptr()))?;
+        }
+        return Ok(value);
+    }
+}
+
+impl Drop for RawProperty {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = ffi::chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+/// A `Property` is a piece of data that can be associated with an `Atom` or a
+/// `Frame`.
+#[derive(Debug, Clone, PartialEq, PartialOrd)]
+pub enum Property {
+    /// Boolean property
+    Bool(bool),
+    /// Floating point property
+    Double(f64),
+    /// String property
+    String(String),
+    /// 3-dimensional vector property
+    Vector3D([f64; 3]),
+}
+
+impl From<bool> for Property {
+    fn from(value: bool) -> Self {
+        Property::Bool(value)
+    }
+}
+
+impl From<f64> for Property {
+    fn from(value: f64) -> Self {
+        Property::Double(value)
+    }
+}
+
+impl From<String> for Property {
+    fn from(value: String) -> Self {
+        Property::String(value)
+    }
+}
+
+impl<'a> From<&'a str> for Property {
+    fn from(value: &'a str) -> Self {
+        Property::String(value.into())
+    }
+}
+
+impl From<[f64; 3]> for Property {
+    fn from(value: [f64; 3]) -> Self {
+        Property::Vector3D(value)
+    }
+}
+
+impl Property {
+    pub(crate) fn as_raw(&self) -> RawProperty {
+        match *self {
+            Property::Bool(value) => RawProperty::bool(value),
+            Property::Double(value) => RawProperty::double(value),
+            Property::String(ref value) => RawProperty::string(value),
+            Property::Vector3D(value) => RawProperty::vector3d(value),
+        }
+    }
+
+    #[allow(clippy::needless_pass_by_value)] // raw property
+    pub(crate) fn from_raw(raw: RawProperty) -> Property {
+        match raw.get_kind() {
+            ffi::chfl_property_kind::CHFL_PROPERTY_BOOL => Self::Bool(raw.get_bool().expect("should be a bool")),
+            ffi::chfl_property_kind::CHFL_PROPERTY_DOUBLE => {
+                Self::Double(raw.get_double().expect("should be a double"))
+            }
+            ffi::chfl_property_kind::CHFL_PROPERTY_STRING => {
+                Self::String(raw.get_string().expect("should be a string"))
+            }
+            ffi::chfl_property_kind::CHFL_PROPERTY_VECTOR3D => {
+                Property::Vector3D(raw.get_vector3d().expect("should be a vector3d"))
+            }
+        }
+    }
+}
+
+/// An iterator over the properties in an atom/frame/residue
+pub struct PropertiesIter<'a> {
+    pub(crate) names: std::vec::IntoIter<String>,
+    pub(crate) getter: Box<dyn Fn(&str) -> Property + 'a>,
+}
+
+impl<'a> Iterator for PropertiesIter<'a> {
+    type Item = (String, Property);
+    fn next(&mut self) -> Option<Self::Item> {
+        self.names.next().map(|name| {
+            let property = (self.getter)(&name);
+            (name, property)
+        })
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.names.size_hint()
+    }
+
+    fn count(self) -> usize {
+        self.names.count()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    mod raw {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = RawProperty::bool(false);
+            assert_eq!(property.get_kind(), ffi::chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(property.get_bool(), Ok(false));
+        }
+
+        #[test]
+        fn double() {
+            let property = RawProperty::double(45.0);
+            assert_eq!(property.get_kind(), ffi::chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(property.get_double(), Ok(45.0));
+        }
+
+        #[test]
+        fn string() {
+            let property = RawProperty::string("test");
+            assert_eq!(property.get_kind(), ffi::chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(property.get_string(), Ok("test".into()));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = RawProperty::vector3d([1.2, 3.4, 5.6]);
+            assert_eq!(property.get_kind(), ffi::chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(property.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+        }
+    }
+
+    mod rust {
+        use super::super::*;
+
+        #[test]
+        fn bool() {
+            let property = Property::Bool(false);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), ffi::chfl_property_kind::CHFL_PROPERTY_BOOL);
+            assert_eq!(raw.get_bool(), Ok(false));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn double() {
+            let property = Property::Double(45.0);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), ffi::chfl_property_kind::CHFL_PROPERTY_DOUBLE);
+            assert_eq!(raw.get_double(), Ok(45.0));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+
+        #[test]
+        fn string() {
+            let property = Property::String("test".into());
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), ffi::chfl_property_kind::CHFL_PROPERTY_STRING);
+            assert_eq!(raw.get_string(), Ok("test".into()));
+
+            assert_eq!(Property::from_raw(raw), property);
+
+            let property = Property::String("long string ".repeat(128));
+            let raw = property.as_raw();
+            assert_eq!(raw.get_string(), Ok("long string ".repeat(128)));
+        }
+
+        #[test]
+        fn vector3d() {
+            let property = Property::Vector3D([1.2, 3.4, 5.6]);
+
+            let raw = property.as_raw();
+            assert_eq!(raw.get_kind(), ffi::chfl_property_kind::CHFL_PROPERTY_VECTOR3D);
+            assert_eq!(raw.get_vector3d(), Ok([1.2, 3.4, 5.6]));
+
+            assert_eq!(Property::from_raw(raw), property);
+        }
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/residue.rs.html b/0.10.40/src/chemfiles/residue.rs.html new file mode 100644 index 000000000..447c5db03 --- /dev/null +++ b/0.10.40/src/chemfiles/residue.rs.html @@ -0,0 +1,823 @@ +residue.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::marker::PhantomData;
+
+use chemfiles_sys as ffi;
+
+use crate::errors::{check_not_null, check_success};
+use crate::property::{PropertiesIter, Property, RawProperty};
+use crate::strings;
+
+/// A `Residue` is a group of atoms belonging to the same logical unit. They
+/// can be small molecules, amino-acids in a protein, monomers in polymers,
+/// *etc.*
+#[derive(Debug)]
+pub struct Residue {
+    handle: *mut ffi::CHFL_RESIDUE,
+}
+
+/// An analog to a reference to a residue (`&Residue`)
+#[derive(Debug)]
+pub struct ResidueRef<'a> {
+    inner: Residue,
+    marker: PhantomData<&'a Residue>,
+}
+
+impl<'a> std::ops::Deref for ResidueRef<'a> {
+    type Target = Residue;
+    fn deref(&self) -> &Residue {
+        &self.inner
+    }
+}
+
+impl Clone for Residue {
+    fn clone(&self) -> Residue {
+        unsafe {
+            let new_handle = ffi::chfl_residue_copy(self.as_ptr());
+            Residue::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Residue {
+    /// Create a `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut ffi::CHFL_RESIDUE) -> Residue {
+        check_not_null(ptr);
+        Residue { handle: ptr }
+    }
+
+    /// Create a borrowed `Residue` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    #[allow(clippy::ptr_cast_constness)]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const ffi::CHFL_RESIDUE) -> ResidueRef<'a> {
+        ResidueRef {
+            inner: Residue::from_ptr(ptr as *mut ffi::CHFL_RESIDUE),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const ffi::CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut ffi::CHFL_RESIDUE {
+        self.handle
+    }
+
+    /// Create a new residue with the given `name`
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("ALA");
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), None);
+    /// ```
+    pub fn new<'a>(name: impl Into<&'a str>) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = ffi::chfl_residue(buffer.as_ptr());
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Create a new residue with the given `name` and `id` as identifier.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("ALA", 67);
+    /// assert_eq!(residue.name(), "ALA");
+    /// assert_eq!(residue.id(), Some(67));
+    /// ```
+    pub fn with_id<'a>(name: impl Into<&'a str>, id: i64) -> Residue {
+        let buffer = strings::to_c(name.into());
+        unsafe {
+            let handle = ffi::chfl_residue_with_id(buffer.as_ptr(), id);
+            Residue::from_ptr(handle)
+        }
+    }
+
+    /// Get the number of atoms in this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    ///
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// assert_eq!(residue.size(), 3);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(ffi::chfl_residue_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the identifier of this residue in the initial topology file.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::with_id("", 42);
+    /// assert_eq!(residue.id(), Some(42));
+    /// ```
+    pub fn id(&self) -> Option<i64> {
+        let mut resid = 0;
+        let status = unsafe { ffi::chfl_residue_id(self.as_ptr(), &mut resid) };
+
+        if status == ffi::chfl_status::CHFL_SUCCESS {
+            return Some(resid);
+        } else if status == ffi::chfl_status::CHFL_GENERIC_ERROR {
+            return None;
+        }
+
+        // call check_success to panic in case of error
+        check_success(status);
+        unreachable!();
+    }
+
+    /// Get the name of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let residue = Residue::new("water");
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn name(&self) -> String {
+        let get_name = |ptr, len| unsafe { ffi::chfl_residue_name(self.as_ptr(), ptr, len) };
+        let name = strings::call_autogrow_buffer(64, get_name).expect("getting residue name failed");
+        return strings::from_c(name.as_ptr());
+    }
+
+    /// Add the atom at index `atom` in this residue.
+    ///
+    /// This will fail if the atom is already in the residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.size(), 0);
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// assert_eq!(residue.contains(56), true);
+    ///
+    /// // Adding the same atom twice is fine
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.size(), 1);
+    /// ```
+    pub fn add_atom(&mut self, atom: usize) {
+        unsafe {
+            check_success(ffi::chfl_residue_add_atom(self.as_mut_ptr(), atom as u64));
+        }
+    }
+
+    /// Check if the atom at index `i` is in this residue
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.contains(56), false);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.contains(56), true);
+    /// ```
+    pub fn contains(&self, atom: usize) -> bool {
+        let mut inside = 0;
+        unsafe {
+            check_success(ffi::chfl_residue_contains(self.as_ptr(), atom as u64, &mut inside));
+        }
+        return inside != 0;
+    }
+
+    /// Get the list of atoms of this residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Residue;
+    /// let mut residue = Residue::new("water");
+    /// assert_eq!(residue.atoms(), vec![]);
+    ///
+    /// residue.add_atom(56);
+    /// assert_eq!(residue.atoms(), vec![56]);
+    /// ```
+    pub fn atoms(&self) -> Vec<usize> {
+        let size = self.size();
+        let count = size as u64;
+        let mut indices = vec![u64::max_value(); size];
+        unsafe {
+            check_success(ffi::chfl_residue_atoms(self.as_ptr(), indices.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return indices.into_iter().map(|idx| idx as usize).collect();
+    }
+
+    /// Add a new `property` with the given `name` to this residue.
+    ///
+    /// If a property with the same name already exists, this function override
+    /// the existing property with the new one.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("a string", "hello");
+    /// residue.set("a double", 3.2);
+    ///
+    /// assert_eq!(residue.get("a string"), Some(Property::String("hello".into())));
+    /// assert_eq!(residue.get("a double"), Some(Property::Double(3.2)));
+    /// ```
+    pub fn set(&mut self, name: &str, property: impl Into<Property>) {
+        let buffer = strings::to_c(name);
+        let property = property.into().as_raw();
+        unsafe {
+            check_success(ffi::chfl_residue_set_property(
+                self.as_mut_ptr(),
+                buffer.as_ptr(),
+                property.as_ptr(),
+            ));
+        }
+    }
+
+    /// Get a property with the given `name` in this frame, if it exist.
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    ///
+    /// assert_eq!(residue.get("foo"), Some(Property::Double(22.2)));
+    /// assert_eq!(residue.get("Bar"), None);
+    /// ```
+    pub fn get(&self, name: &str) -> Option<Property> {
+        let buffer = strings::to_c(name);
+        unsafe {
+            let handle = ffi::chfl_residue_get_property(self.as_ptr(), buffer.as_ptr());
+            if handle.is_null() {
+                None
+            } else {
+                let raw = RawProperty::from_ptr(handle);
+                Some(Property::from_raw(raw))
+            }
+        }
+    }
+
+    /// Get an iterator over all (name, property) pairs for this frame
+    ///
+    /// # Examples
+    /// ```
+    /// # use chemfiles::{Residue, Property};
+    /// let mut residue = Residue::new("ALA");
+    /// residue.set("foo", Property::Double(22.2));
+    /// residue.set("bar", Property::Bool(false));
+    ///
+    /// for (name, property) in residue.properties() {
+    ///     if name == "foo" {
+    ///         assert_eq!(property, Property::Double(22.2));
+    ///     } else if name == "bar" {
+    ///         assert_eq!(property, Property::Bool(false));
+    ///     }
+    /// }
+    /// ```
+    pub fn properties(&self) -> PropertiesIter {
+        let mut count = 0;
+        unsafe {
+            check_success(ffi::chfl_residue_properties_count(self.as_ptr(), &mut count));
+        }
+
+        #[allow(clippy::cast_possible_truncation)]
+        let size = count as usize;
+        let mut c_names = vec![std::ptr::null_mut(); size];
+        unsafe {
+            check_success(ffi::chfl_residue_list_properties(
+                self.as_ptr(),
+                c_names.as_mut_ptr(),
+                count,
+            ));
+        }
+
+        let mut names = Vec::new();
+        for ptr in c_names {
+            names.push(strings::from_c(ptr));
+        }
+
+        PropertiesIter {
+            names: names.into_iter(),
+            getter: Box::new(move |name| self.get(name).expect("failed to get property")),
+        }
+    }
+}
+
+impl Drop for Residue {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = ffi::chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        let copy = residue.clone();
+        assert_eq!(copy.size(), 0);
+
+        residue.add_atom(3);
+        residue.add_atom(7);
+        assert_eq!(residue.size(), 2);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn name() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.name(), "A");
+    }
+
+    #[test]
+    fn id() {
+        let residue = Residue::new("A");
+        assert_eq!(residue.id(), None);
+
+        let residue = Residue::with_id("A", 42);
+        assert_eq!(residue.id(), Some(42));
+
+        let residue = Residue::with_id("A", -3);
+        assert_eq!(residue.id(), Some(-3));
+    }
+
+    #[test]
+    fn atoms() {
+        let mut residue = Residue::new("A");
+        assert_eq!(residue.size(), 0);
+
+        residue.add_atom(0);
+        residue.add_atom(3);
+        residue.add_atom(45);
+        assert_eq!(residue.size(), 3);
+
+        assert!(residue.contains(3));
+        assert!(!residue.contains(5));
+
+        assert_eq!(residue.atoms(), vec![0, 3, 45]);
+    }
+
+    #[test]
+    fn property() {
+        let mut residue = Residue::new("ALA");
+
+        residue.set("foo", -22.0);
+        assert_eq!(residue.get("foo"), Some(Property::Double(-22.0)));
+        assert_eq!(residue.get("bar"), None);
+
+        residue.set("bar", Property::String("here".into()));
+        for (name, property) in residue.properties() {
+            if name == "foo" {
+                assert_eq!(property, Property::Double(-22.0));
+            } else if name == "bar" {
+                assert_eq!(property, Property::String("here".into()));
+            }
+        }
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/selection.rs.html b/0.10.40/src/chemfiles/selection.rs.html new file mode 100644 index 000000000..b7ae837fb --- /dev/null +++ b/0.10.40/src/chemfiles/selection.rs.html @@ -0,0 +1,861 @@ +selection.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use chemfiles_sys as ffi;
+
+use crate::errors::{check, check_not_null, check_success, Error, Status};
+use crate::frame::Frame;
+use crate::strings;
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+/// A `Match` is a set of atomic indexes matching a given selection. It can
+/// mostly be used like a `&[usize]`.
+pub struct Match {
+    size: usize,
+    atoms: [usize; 4],
+}
+
+#[allow(clippy::len_without_is_empty)]
+impl Match {
+    /// Get the length of the Match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// ```
+    pub fn len(&self) -> usize {
+        self.size
+    }
+
+    /// Create a new match containing the atoms in the `atoms` slice.
+    ///
+    /// # Panics
+    ///
+    /// If the slice contains more than 4 elements, which is the maximal size
+    /// of a match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// assert_eq!(atomic_match.len(), 3);
+    /// assert_eq!(atomic_match[0], 3);
+    /// assert_eq!(atomic_match[1], 4);
+    /// assert_eq!(atomic_match[2], 5);
+    /// ```
+    pub fn new(atoms: &[usize]) -> Match {
+        assert!(atoms.len() <= 4);
+        let size = atoms.len();
+        let mut matches = [usize::max_value(); 4];
+        for (i, atom) in atoms.iter().enumerate() {
+            matches[i] = *atom;
+        }
+        Match { size, atoms: matches }
+    }
+
+    /// Iterate over the atomic indexes in the match.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use chemfiles::Match;
+    /// let atomic_match = Match::new(&[3, 4, 5]);
+    /// let mut iter = atomic_match.iter();
+    ///
+    /// assert_eq!(iter.next(), Some(&3));
+    /// assert_eq!(iter.next(), Some(&4));
+    /// assert_eq!(iter.next(), Some(&5));
+    /// assert_eq!(iter.next(), None);
+    /// ```
+    pub fn iter(&self) -> std::slice::Iter<usize> {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+impl std::ops::Index<usize> for Match {
+    type Output = usize;
+    fn index(&self, i: usize) -> &Self::Output {
+        assert!(i < self.len());
+        &self.atoms[i]
+    }
+}
+
+impl<'a> IntoIterator for &'a Match {
+    type Item = &'a usize;
+    type IntoIter = std::slice::Iter<'a, usize>;
+
+    fn into_iter(self) -> Self::IntoIter {
+        self.atoms[..self.len()].iter()
+    }
+}
+
+/// A `Selection` allow to select atoms in a `Frame`, from a selection
+/// language. The selection language is built by combining basic operations.
+/// Each basic operation follows the `<selector>[(<variable>)] <operator>
+/// <value>` structure, where `<operator>` is a comparison operator in
+/// `== != < <= > >=`.
+#[derive(Debug)]
+pub struct Selection {
+    handle: *mut ffi::CHFL_SELECTION,
+}
+
+impl Clone for Selection {
+    fn clone(&self) -> Selection {
+        unsafe {
+            let new_handle = ffi::chfl_selection_copy(self.as_ptr());
+            Selection::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Drop for Selection {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = ffi::chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+impl Selection {
+    /// Create a `Selection` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut ffi::CHFL_SELECTION) -> Selection {
+        check_not_null(ptr);
+        Selection { handle: ptr }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const ffi::CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut ffi::CHFL_SELECTION {
+        self.handle
+    }
+
+    /// Create a new selection from the given selection string.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the selection string is invalid.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// ```
+    pub fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection, Error> {
+        let buffer = strings::to_c(selection.into());
+        unsafe {
+            let handle = ffi::chfl_selection(buffer.as_ptr());
+            if handle.is_null() {
+                Err(Error {
+                    status: Status::SelectionError,
+                    message: Error::last_error(),
+                })
+            } else {
+                Ok(Selection::from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get the size of the selection, i.e. the number of atoms we are selecting
+    /// together.
+    ///
+    /// This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond'
+    /// context, 3 for the 'three' and 'angles' context and 4 for the 'four'
+    /// and 'dihedral' context.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// assert_eq!(selection.size(), 2);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(ffi::chfl_selection_size(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Get the selection string used to create this selection.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Selection;
+    /// let selection = Selection::new("name H").unwrap();
+    /// assert_eq!(selection.string(), "name H");
+    /// ```
+    pub fn string(&self) -> String {
+        let get_string = |ptr, len| unsafe { ffi::chfl_selection_string(self.as_ptr(), ptr, len) };
+        let selection = strings::call_autogrow_buffer(1024, get_string).expect("failed to get selection string");
+        return strings::from_c(selection.as_ptr());
+    }
+
+    /// Evaluate a selection for a given frame, and return the corresponding
+    /// matches.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("pairs: name(#1) H and name(#2) O").unwrap();
+    /// let matches = selection.evaluate(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    ///
+    /// assert_eq!(matches[0].len(), 2);
+    /// assert_eq!(matches[0][0], 0);
+    /// assert_eq!(matches[0][1], 1);
+    ///
+    /// assert_eq!(matches[1].len(), 2);
+    /// assert_eq!(matches[1][0], 2);
+    /// assert_eq!(matches[1][1], 1);
+    /// ```
+    pub fn evaluate(&mut self, frame: &Frame) -> Vec<Match> {
+        #![allow(clippy::cast_possible_truncation)]
+        let mut count = 0;
+        unsafe {
+            check(ffi::chfl_selection_evaluate(
+                self.as_mut_ptr(),
+                frame.as_ptr(),
+                &mut count,
+            ))
+            .expect("failed to evaluate selection");
+        }
+
+        let size = count as usize;
+        let mut chfl_matches = vec![ffi::chfl_match { size: 0, atoms: [0; 4] }; size];
+        unsafe {
+            check(ffi::chfl_selection_matches(
+                self.handle,
+                chfl_matches.as_mut_ptr(),
+                count,
+            ))
+            .expect("failed to extract matches");
+        }
+
+        return chfl_matches
+            .into_iter()
+            .map(|chfl_match| Match {
+                size: chfl_match.size as usize,
+                atoms: [
+                    chfl_match.atoms[0] as usize,
+                    chfl_match.atoms[1] as usize,
+                    chfl_match.atoms[2] as usize,
+                    chfl_match.atoms[3] as usize,
+                ],
+            })
+            .collect();
+    }
+
+    /// Evaluates a selection of size 1 on a given `frame`. This function
+    /// returns the list of atomic indexes in the frame matching this selection.
+    ///
+    /// # Panics
+    ///
+    /// If the selection size is not 1
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Selection, Frame, Atom};
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("H"), [1.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("O"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("H"), [-1.0, 0.0, 0.0], None);
+    ///
+    /// let mut selection = Selection::new("name H").unwrap();
+    /// let matches = selection.list(&frame);
+    ///
+    /// assert_eq!(matches.len(), 2);
+    /// assert_eq!(matches[0], 0);
+    /// assert_eq!(matches[1], 2);
+    /// ```
+    pub fn list(&mut self, frame: &Frame) -> Vec<usize> {
+        assert!(
+            self.size() == 1,
+            "can not call `Selection::list` on a multiple selection"
+        );
+        return self.evaluate(frame).into_iter().map(|m| m[0]).collect();
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::{Atom, Topology};
+
+    #[test]
+    fn clone() {
+        let selection = Selection::new("name H").unwrap();
+
+        let copy = selection.clone();
+        assert_eq!(selection.size(), 1);
+        assert_eq!(copy.size(), 1);
+    }
+
+    fn testing_frame() -> Frame {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("H"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("O"));
+        topology.add_atom(&Atom::new("H"));
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(2, 3);
+
+        let mut frame = Frame::new();
+        frame.resize(4);
+        frame.set_topology(&topology).unwrap();
+        return frame;
+    }
+
+    mod matches {
+        use super::*;
+
+        #[test]
+        fn index() {
+            let m = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+            assert_eq!(m[2], 3);
+            assert_eq!(m[3], 4);
+
+            let m = Match::new(&[1, 2]);
+            assert_eq!(m[0], 1);
+            assert_eq!(m[1], 2);
+        }
+
+        #[test]
+        fn iter() {
+            let match_ = Match::new(&[1, 2, 3, 4]);
+            assert_eq!(match_.iter().copied().collect::<Vec<usize>>(), vec![1, 2, 3, 4]);
+
+            let v = [1, 2, 3, 4];
+            for (i, &m) in match_.iter().enumerate() {
+                assert_eq!(v[i], m);
+            }
+        }
+
+        #[test]
+        #[should_panic]
+        fn out_of_bound() {
+            let m = Match::new(&[1, 2]);
+            let _ = m[2];
+        }
+
+        #[test]
+        #[should_panic]
+        fn too_big() {
+            let _ = Match::new(&[1, 2, 3, 5, 4]);
+        }
+    }
+
+    #[test]
+    fn size() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.size(), 1);
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 3);
+
+        let selection = Selection::new("four: name(#1) H").unwrap();
+        assert_eq!(selection.size(), 4);
+    }
+
+    #[test]
+    fn string() {
+        let selection = Selection::new("name H").unwrap();
+        assert_eq!(selection.string(), "name H");
+
+        let selection = Selection::new("angles: name(#1) H").unwrap();
+        assert_eq!(selection.string(), "angles: name(#1) H");
+    }
+
+    #[test]
+    fn invalid() {
+        let error = Selection::new("foo").unwrap_err();
+        assert_eq!(error.message, "unexpected identifier 'foo' in mathematical expression");
+        assert_eq!(error.status, Status::SelectionError);
+    }
+
+    #[test]
+    fn evaluate() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.evaluate(&frame);
+        assert_eq!(res, &[Match::new(&[0]), Match::new(&[3])]);
+
+        let mut selection = Selection::new("angles: all").unwrap();
+        let res = selection.evaluate(&frame);
+        for m in &[Match::new(&[0, 1, 2]), Match::new(&[1, 2, 3])] {
+            assert!(res.iter().any(|r| r == m));
+        }
+    }
+
+    #[test]
+    fn list() {
+        let frame = testing_frame();
+
+        let mut selection = Selection::new("name H").unwrap();
+        let res = selection.list(&frame);
+        assert_eq!(res, vec![0, 3]);
+    }
+
+    #[test]
+    #[should_panic = "can not call `Selection::list` on a multiple selection"]
+    fn list_on_size_1_selection() {
+        let frame = testing_frame();
+        let mut selection = Selection::new("pairs: name(#1) H").unwrap();
+        let _list = selection.list(&frame);
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/strings.rs.html b/0.10.40/src/chemfiles/strings.rs.html new file mode 100644 index 000000000..294ee9160 --- /dev/null +++ b/0.10.40/src/chemfiles/strings.rs.html @@ -0,0 +1,117 @@ +strings.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+
+//! String conversions between C and Rust
+use std::ffi::{CStr, CString};
+use std::os::raw::c_char;
+
+use crate::errors::{check, Error};
+
+/// Create a Rust string from a C string. Clones all characters in `buffer`.
+pub fn from_c(buffer: *const c_char) -> String {
+    unsafe {
+        let rust_str = CStr::from_ptr(buffer).to_str().expect("Invalid Rust string from C");
+        return String::from(rust_str);
+    }
+}
+
+/// Create a C string from a Rust string.
+pub fn to_c<S>(string: S) -> CString
+where
+    S: Into<Vec<u8>>,
+{
+    CString::new(string).expect("Invalid C string from Rust")
+}
+
+/// Check if a string buffer was big enough when passed to a C function
+fn buffer_was_big_enough(buffer: &[c_char]) -> bool {
+    let len = buffer.len();
+    if len < 2 {
+        false
+    } else {
+        // The C code should always set the last element to 0
+        debug_assert_eq!(buffer[len - 1], 0);
+        buffer[len - 2] == 0
+    }
+}
+
+/// Call `callback` C function with a string buffer and it length, using
+/// `initial` as the buffer initial size. If the buffer was filled and the
+/// result truncated by the C library, grow the buffer and try again until we
+/// get all the data. Then return the filled buffer to the caller.
+pub fn call_autogrow_buffer<F>(initial: usize, callback: F) -> Result<Vec<c_char>, Error>
+where
+    F: Fn(*mut c_char, u64) -> chemfiles_sys::chfl_status,
+{
+    let mut size = initial;
+    let mut buffer = vec![0; size];
+    check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+
+    while !buffer_was_big_enough(&buffer) {
+        // Grow the buffer and retry
+        size *= 2;
+        buffer.resize(size, 0);
+        check(callback(buffer.as_mut_ptr(), buffer.len() as u64))?;
+    }
+
+    Ok(buffer)
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/topology.rs.html b/0.10.40/src/chemfiles/topology.rs.html new file mode 100644 index 000000000..eee5eab35 --- /dev/null +++ b/0.10.40/src/chemfiles/topology.rs.html @@ -0,0 +1,2007 @@ +topology.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+1000
+1001
+1002
+1003
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::marker::PhantomData;
+use std::ops::{Deref, Drop};
+
+use chemfiles_sys as ffi;
+
+use crate::errors::{check, check_not_null, check_success, Error};
+use crate::{Atom, AtomMut, AtomRef};
+use crate::{Residue, ResidueRef};
+
+/// Possible bond order associated with bonds
+#[repr(C)]
+#[non_exhaustive]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+pub enum BondOrder {
+    /// Unknown or unspecified bond order
+    Unknown = ffi::chfl_bond_order::CHFL_BOND_UNKNOWN as isize,
+    /// Single bond
+    Single = ffi::chfl_bond_order::CHFL_BOND_SINGLE as isize,
+    /// Double bond
+    Double = ffi::chfl_bond_order::CHFL_BOND_DOUBLE as isize,
+    /// Triple bond
+    Triple = ffi::chfl_bond_order::CHFL_BOND_TRIPLE as isize,
+    /// Quadruple bond (present in some metals)
+    Quadruple = ffi::chfl_bond_order::CHFL_BOND_QUADRUPLE as isize,
+    /// Quintuplet bond (present in some metals)
+    Quintuplet = ffi::chfl_bond_order::CHFL_BOND_QUINTUPLET as isize,
+    /// Amide bond (required by some file formats)
+    Amide = ffi::chfl_bond_order::CHFL_BOND_AMIDE as isize,
+    /// Aromatic bond (required by some file formats)
+    Aromatic = ffi::chfl_bond_order::CHFL_BOND_AROMATIC as isize,
+}
+
+impl BondOrder {
+    pub(crate) fn as_raw(self) -> ffi::chfl_bond_order {
+        match self {
+            BondOrder::Unknown => ffi::chfl_bond_order::CHFL_BOND_UNKNOWN,
+            BondOrder::Single => ffi::chfl_bond_order::CHFL_BOND_SINGLE,
+            BondOrder::Double => ffi::chfl_bond_order::CHFL_BOND_DOUBLE,
+            BondOrder::Triple => ffi::chfl_bond_order::CHFL_BOND_TRIPLE,
+            BondOrder::Quadruple => ffi::chfl_bond_order::CHFL_BOND_QUADRUPLE,
+            BondOrder::Quintuplet => ffi::chfl_bond_order::CHFL_BOND_QUINTUPLET,
+            BondOrder::Amide => ffi::chfl_bond_order::CHFL_BOND_AMIDE,
+            BondOrder::Aromatic => ffi::chfl_bond_order::CHFL_BOND_AROMATIC,
+        }
+    }
+}
+
+impl From<ffi::chfl_bond_order> for BondOrder {
+    fn from(order: ffi::chfl_bond_order) -> BondOrder {
+        match order {
+            ffi::chfl_bond_order::CHFL_BOND_UNKNOWN => BondOrder::Unknown,
+            ffi::chfl_bond_order::CHFL_BOND_SINGLE => BondOrder::Single,
+            ffi::chfl_bond_order::CHFL_BOND_DOUBLE => BondOrder::Double,
+            ffi::chfl_bond_order::CHFL_BOND_TRIPLE => BondOrder::Triple,
+            ffi::chfl_bond_order::CHFL_BOND_QUADRUPLE => BondOrder::Quadruple,
+            ffi::chfl_bond_order::CHFL_BOND_QUINTUPLET => BondOrder::Quintuplet,
+            ffi::chfl_bond_order::CHFL_BOND_AMIDE => BondOrder::Amide,
+            ffi::chfl_bond_order::CHFL_BOND_AROMATIC => BondOrder::Aromatic,
+        }
+    }
+}
+
+/// A `Topology` contains the definition of all the atoms in the system, and
+/// the liaisons between the atoms (bonds, angles, dihedrals, ...). It will
+/// also contain all the residues information if it is available.
+#[derive(Debug)]
+pub struct Topology {
+    handle: *mut ffi::CHFL_TOPOLOGY,
+}
+
+/// An analog to a reference to a topology (`&Topology`)
+#[derive(Debug)]
+pub struct TopologyRef<'a> {
+    inner: Topology,
+    marker: PhantomData<&'a Topology>,
+}
+
+impl<'a> Deref for TopologyRef<'a> {
+    type Target = Topology;
+    fn deref(&self) -> &Topology {
+        &self.inner
+    }
+}
+
+impl Clone for Topology {
+    fn clone(&self) -> Topology {
+        unsafe {
+            let new_handle = ffi::chfl_topology_copy(self.as_ptr());
+            Topology::from_ptr(new_handle)
+        }
+    }
+}
+
+impl Topology {
+    /// Create a `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer,
+    /// except for it being non-null.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut ffi::CHFL_TOPOLOGY) -> Topology {
+        check_not_null(ptr);
+        Topology { handle: ptr }
+    }
+
+    /// Create a borrowed `Topology` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the
+    /// pointer, except for it being non-null, and the caller is responsible
+    /// for setting the right lifetime
+    #[inline]
+    #[allow(clippy::ptr_cast_constness)]
+    pub(crate) unsafe fn ref_from_ptr<'a>(ptr: *const ffi::CHFL_TOPOLOGY) -> TopologyRef<'a> {
+        TopologyRef {
+            inner: Topology::from_ptr(ptr as *mut ffi::CHFL_TOPOLOGY),
+            marker: PhantomData,
+        }
+    }
+
+    /// Get the underlying C pointer as a const pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const ffi::CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut ffi::CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer FROM A SHARED REFERENCE.
+    ///
+    /// For uses with functions of the C API using mut pointers for both read
+    /// and write access. Users should check that this does not lead to multiple
+    /// mutable borrows
+    #[inline]
+    #[allow(non_snake_case)]
+    pub(crate) fn as_mut_ptr_MANUALLY_CHECKING_BORROW(&self) -> *mut ffi::CHFL_TOPOLOGY {
+        self.handle
+    }
+
+    /// Create a new empty topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    /// ```
+    pub fn new() -> Topology {
+        unsafe { Topology::from_ptr(ffi::chfl_topology()) }
+    }
+
+    /// Get a reference of the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// let atom = topology.atom(4);
+    /// assert_eq!(atom.name(), "");
+    /// ```
+    pub fn atom(&self, index: usize) -> AtomRef {
+        unsafe {
+            let handle = ffi::chfl_atom_from_topology(self.as_mut_ptr_MANUALLY_CHECKING_BORROW(), index as u64);
+            Atom::ref_from_ptr(handle)
+        }
+    }
+
+    /// Get a mutable reference to the atom at the given `index` in this topology.
+    ///
+    /// # Panics
+    ///
+    /// If `index` is out of bounds.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(6);
+    ///
+    /// assert_eq!(topology.atom(4).name(), "");
+    ///
+    /// topology.atom_mut(4).set_name("Fe");
+    /// assert_eq!(topology.atom(4).name(), "Fe");
+    /// ```
+    pub fn atom_mut(&mut self, index: usize) -> AtomMut {
+        unsafe {
+            let handle = ffi::chfl_atom_from_topology(self.as_mut_ptr(), index as u64);
+            Atom::ref_mut_from_ptr(handle)
+        }
+    }
+
+    /// Get the current number of atoms in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn size(&self) -> usize {
+        let mut size = 0;
+        unsafe {
+            check_success(ffi::chfl_topology_atoms_count(self.as_ptr(), &mut size));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return size as usize;
+    }
+
+    /// Resize this topology to hold `natoms` atoms, inserting dummy atoms if
+    /// the new size if bigger than the old one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.size(), 0);
+    ///
+    /// topology.resize(6);
+    /// assert_eq!(topology.size(), 6);
+    /// ```
+    pub fn resize(&mut self, natoms: usize) {
+        unsafe {
+            check_success(ffi::chfl_topology_resize(self.as_mut_ptr(), natoms as u64));
+        }
+    }
+
+    /// Add an `Atom` at the end of this topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Atom};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("Mg"));
+    ///
+    /// let atom = topology.atom(0);
+    /// assert_eq!(atom.name(), "Mg");
+    /// ```
+    pub fn add_atom(&mut self, atom: &Atom) {
+        unsafe {
+            check_success(ffi::chfl_topology_add_atom(self.as_mut_ptr(), atom.as_ptr()));
+        }
+    }
+
+    /// Remove an `Atom` from this topology by `index`. This modify all the
+    /// other atoms indexes.
+    ///
+    /// # Panics
+    ///
+    /// If the `index` is out of bounds
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(9);
+    /// assert_eq!(topology.size(), 9);
+    ///
+    /// topology.remove(7);
+    /// assert_eq!(topology.size(), 8);
+    /// ```
+    pub fn remove(&mut self, index: usize) {
+        unsafe {
+            check_success(ffi::chfl_topology_remove(self.as_mut_ptr(), index as u64));
+        }
+    }
+
+    /// Get the number of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds_count(), 3);
+    /// ```
+    pub fn bonds_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(ffi::chfl_topology_bonds_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.angles_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles_count(), 2);
+    /// ```
+    pub fn angles_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(ffi::chfl_topology_angles_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.dihedrals_count(), 1);
+    /// ```
+    pub fn dihedrals_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(ffi::chfl_topology_dihedrals_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the number of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.dihedrals_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    /// assert_eq!(topology.impropers_count(), 1);
+    /// ```
+    pub fn impropers_count(&self) -> usize {
+        let mut count = 0;
+        unsafe {
+            check_success(ffi::chfl_topology_impropers_count(self.as_ptr(), &mut count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return count as usize;
+    }
+
+    /// Get the list of bonds in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.bonds(), vec![[0, 1], [1, 2], [2, 3]]);
+    /// ```
+    pub fn bonds(&self) -> Vec<[usize; 2]> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![[u64::max_value(); 2]; size];
+        unsafe {
+            check_success(ffi::chfl_topology_bonds(self.as_ptr(), bonds.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return bonds
+            .into_iter()
+            .map(|bond| [bond[0] as usize, bond[1] as usize])
+            .collect();
+    }
+
+    /// Get the list of angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    /// assert_eq!(topology.angles(), vec![[0, 1, 2], [1, 2, 3]]);
+    /// ```
+    pub fn angles(&self) -> Vec<[usize; 3]> {
+        let size = self.angles_count();
+        let count = size as u64;
+        let mut angles = vec![[u64::max_value(); 3]; size];
+        unsafe {
+            check_success(ffi::chfl_topology_angles(self.as_ptr(), angles.as_mut_ptr(), count));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return angles
+            .into_iter()
+            .map(|angle| [angle[0] as usize, angle[1] as usize, angle[2] as usize])
+            .collect();
+    }
+
+    /// Get the list of dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(2, 1);
+    /// topology.add_bond(2, 3);
+    ///
+    /// assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3]]);
+    /// ```
+    pub fn dihedrals(&self) -> Vec<[usize; 4]> {
+        let size = self.dihedrals_count();
+        let count = size as u64;
+        let mut dihedrals = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(ffi::chfl_topology_dihedrals(
+                self.as_ptr(),
+                dihedrals.as_mut_ptr(),
+                count,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return dihedrals
+            .into_iter()
+            .map(|dihedral| {
+                [
+                    dihedral[0] as usize,
+                    dihedral[1] as usize,
+                    dihedral[2] as usize,
+                    dihedral[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Get the list of improper dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// topology.add_bond(0, 3);
+    ///
+    /// assert_eq!(topology.impropers(), vec![[1, 0, 2, 3]]);
+    /// ```
+    pub fn impropers(&self) -> Vec<[usize; 4]> {
+        let size = self.impropers_count();
+        let count = size as u64;
+        let mut impropers = vec![[u64::max_value(); 4]; size];
+        unsafe {
+            check_success(ffi::chfl_topology_impropers(
+                self.as_ptr(),
+                impropers.as_mut_ptr(),
+                count,
+            ));
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return impropers
+            .into_iter()
+            .map(|improper| {
+                [
+                    improper[0] as usize,
+                    improper[1] as usize,
+                    improper[2] as usize,
+                    improper[3] as usize,
+                ]
+            })
+            .collect();
+    }
+
+    /// Remove all existing bonds, angles, dihedral angles and improper
+    /// dihedral angles in the topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    /// assert_eq!(topology.angles().len(), 1);
+    ///
+    /// topology.clear_bonds();
+    /// assert!(topology.bonds().is_empty());
+    /// assert!(topology.angles().is_empty());
+    /// ```
+    pub fn clear_bonds(&mut self) {
+        unsafe {
+            check_success(ffi::chfl_topology_clear_bonds(self.as_mut_ptr()));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology.
+    ///
+    /// The bond order is set to `BondOrder::Unknown`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+    /// ```
+    pub fn add_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(ffi::chfl_topology_add_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Add a bond between the atoms at indexes `i` and `j` in the topology
+    /// with the given bond `order`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn add_bond_with_order(&mut self, i: usize, j: usize, order: BondOrder) {
+        unsafe {
+            check_success(ffi::chfl_topology_bond_with_order(
+                self.as_mut_ptr(),
+                i as u64,
+                j as u64,
+                order.as_raw(),
+            ));
+        }
+    }
+
+    /// Get the bond order for the bond between the atoms at indexes `i` and
+    /// `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(2);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// assert_eq!(topology.bond_order(0, 1), BondOrder::Double);
+    /// ```
+    pub fn bond_order(&self, i: usize, j: usize) -> BondOrder {
+        let mut order = ffi::chfl_bond_order::CHFL_BOND_UNKNOWN;
+        unsafe {
+            check_success(ffi::chfl_topology_bond_order(
+                self.as_ptr(),
+                i as u64,
+                j as u64,
+                &mut order,
+            ));
+        }
+        return order.into();
+    }
+
+    /// Get the bond order for all the bonds in the topology
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, BondOrder};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(3);
+    ///
+    /// topology.add_bond_with_order(0, 1, BondOrder::Double);
+    /// topology.add_bond_with_order(0, 2, BondOrder::Single);
+    ///
+    /// assert_eq!(topology.bond_orders(), &[BondOrder::Double, BondOrder::Single]);
+    /// ```
+    pub fn bond_orders(&self) -> Vec<BondOrder> {
+        let size = self.bonds_count();
+        let count = size as u64;
+        let mut bonds = vec![BondOrder::Unknown; size];
+        unsafe {
+            check_success(ffi::chfl_topology_bond_orders(
+                self.as_ptr(),
+                // Casting BondOrder to ffi::chfl_bond_order is safe, as they are
+                // both `repr(C)` enums with the same values.
+                bonds.as_mut_ptr().cast(),
+                count,
+            ));
+        }
+        return bonds;
+    }
+
+    /// Remove any existing bond between the atoms at indexes `i` and `j` in
+    /// this topology.
+    ///
+    /// This function does nothing if there is no bond between `i` and `j`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Topology;
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.bonds_count(), 0);
+    /// topology.resize(4);
+    ///
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    /// assert_eq!(topology.bonds_count(), 2);
+    ///
+    /// topology.remove_bond(0, 1);
+    /// assert_eq!(topology.bonds_count(), 1);
+    ///
+    /// // Removing a bond that does not exists is fine
+    /// topology.remove_bond(0, 2);
+    /// assert_eq!(topology.bonds_count(), 1);
+    /// ```
+    pub fn remove_bond(&mut self, i: usize, j: usize) {
+        unsafe {
+            check_success(ffi::chfl_topology_remove_bond(self.as_mut_ptr(), i as u64, j as u64));
+        }
+    }
+
+    /// Get a reference to the residue at index `index` from this topology.
+    ///
+    /// The residue index in the topology is not always the same as the residue
+    /// `id`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn residue(&self, index: usize) -> Option<ResidueRef> {
+        unsafe {
+            let handle = ffi::chfl_residue_from_topology(self.as_ptr(), index as u64);
+            if handle.is_null() {
+                None
+            } else {
+                Some(Residue::ref_from_ptr(handle))
+            }
+        }
+    }
+
+    /// Get a copy of the residue containing the atom at index `index` in this
+    /// topology, if any.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.resize(8);
+    ///
+    /// let mut residue = Residue::new("water");
+    /// residue.add_atom(0);
+    /// residue.add_atom(1);
+    /// residue.add_atom(2);
+    /// topology.add_residue(&residue).unwrap();
+    ///
+    /// let residue = topology.residue_for_atom(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    ///
+    /// assert!(topology.residue_for_atom(6).is_none());
+    /// ```
+    pub fn residue_for_atom(&self, index: usize) -> Option<ResidueRef> {
+        let handle = unsafe { ffi::chfl_residue_for_atom(self.as_ptr(), index as u64) };
+        if handle.is_null() {
+            None
+        } else {
+            unsafe { Some(Residue::ref_from_ptr(handle)) }
+        }
+    }
+
+    /// Get the number of residues in this topology.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// assert_eq!(topology.residues_count(), 0);
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    /// assert_eq!(topology.residues_count(), 2);
+    /// ```
+    pub fn residues_count(&self) -> u64 {
+        let mut count = 0;
+        unsafe {
+            check_success(ffi::chfl_topology_residues_count(self.as_ptr(), &mut count));
+        }
+        return count;
+    }
+
+    /// Add a residue to this topology.
+    ///
+    /// # Errors
+    ///
+    /// This function fails is the residue `id` is not already in the topology,
+    /// or if the residue contains atoms that are already in another residue.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    /// topology.add_residue(&Residue::new("water")).unwrap();
+    ///
+    /// let residue = topology.residue(0).unwrap();
+    /// assert_eq!(residue.name(), "water");
+    /// ```
+    pub fn add_residue(&mut self, residue: &Residue) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_topology_add_residue(self.as_mut_ptr(), residue.as_ptr())) }
+    }
+
+    /// Check if the two residues `first` and `second` from the `topology` are
+    /// linked together, *i.e.* if there is a bond between one atom in the
+    /// first residue and one atom in the second one.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Topology, Residue};
+    /// let mut topology = Topology::new();
+    ///
+    /// topology.add_residue(&Residue::with_id("water", 0)).unwrap();
+    /// topology.add_residue(&Residue::with_id("protein", 1)).unwrap();
+    ///
+    /// let first = topology.residue(0).unwrap();
+    /// let second = topology.residue(1).unwrap();
+    /// assert_eq!(topology.are_linked(&first, &second), false);
+    /// ```
+    pub fn are_linked(&self, first: &Residue, second: &Residue) -> bool {
+        let mut linked = 0;
+        unsafe {
+            check_success(ffi::chfl_topology_residues_linked(
+                self.as_ptr(),
+                first.as_ptr(),
+                second.as_ptr(),
+                &mut linked,
+            ));
+        }
+        return linked != 0;
+    }
+}
+
+impl Drop for Topology {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = ffi::chfl_free(self.as_ptr().cast());
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn clone() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        let copy = topology.clone();
+        assert_eq!(copy.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+        assert_eq!(copy.size(), 0);
+    }
+
+    #[test]
+    fn size() {
+        let mut topology = Topology::new();
+        assert_eq!(topology.size(), 0);
+
+        topology.resize(10);
+        assert_eq!(topology.size(), 10);
+
+        topology.remove(7);
+        assert_eq!(topology.size(), 9);
+
+        topology.add_atom(&Atom::new("Hg"));
+        assert_eq!(topology.size(), 10);
+    }
+
+    #[test]
+    fn atoms() {
+        let mut topology = Topology::new();
+
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(3).name(), "Fe");
+    }
+
+    #[test]
+    fn remove() {
+        let mut topology = Topology::new();
+        topology.add_atom(&Atom::new("Hg"));
+        topology.add_atom(&Atom::new("Mn"));
+        topology.add_atom(&Atom::new("W"));
+        topology.add_atom(&Atom::new("Fe"));
+
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "W");
+
+        topology.remove(1);
+        assert_eq!(topology.atom(0).name(), "Hg");
+        assert_eq!(topology.atom(2).name(), "Fe");
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove() {
+        let mut topology = Topology::new();
+        topology.resize(18);
+        topology.remove(33);
+    }
+
+    #[test]
+    fn bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.bonds_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(9, 2);
+        topology.add_bond_with_order(3, 7, BondOrder::Aromatic);
+        assert_eq!(topology.bonds_count(), 3);
+
+        assert_eq!(topology.bonds(), vec![[0, 1], [2, 9], [3, 7]]);
+        let expected = vec![BondOrder::Unknown, BondOrder::Unknown, BondOrder::Aromatic];
+        assert_eq!(topology.bond_orders(), expected);
+
+        assert_eq!(topology.bond_order(0, 1), BondOrder::Unknown);
+        assert_eq!(topology.bond_order(3, 7), BondOrder::Aromatic);
+
+        topology.remove_bond(3, 7);
+        // Removing unexisting bond is OK if both indexes are in bounds
+        topology.remove_bond(8, 7);
+        assert_eq!(topology.bonds_count(), 2);
+
+        topology.clear_bonds();
+        assert_eq!(topology.bonds_count(), 0);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_remove_bond() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.remove_bond(300, 7);
+    }
+
+    #[test]
+    #[should_panic]
+    fn out_of_bounds_bonds_with_order() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        topology.add_bond_with_order(300, 7, BondOrder::Unknown);
+    }
+
+    #[test]
+    fn angles() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.angles_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 7);
+        topology.add_bond(3, 5);
+        assert_eq!(topology.angles_count(), 2);
+
+        assert_eq!(topology.angles(), vec![[0, 1, 2], [5, 3, 7]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.angles_count(), 0);
+    }
+
+    #[test]
+    fn dihedrals() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.dihedrals_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(1, 2);
+        topology.add_bond(3, 2);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(7, 10);
+        assert_eq!(topology.dihedrals_count(), 2);
+
+        assert_eq!(topology.dihedrals(), vec![[0, 1, 2, 3], [5, 4, 7, 10]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.dihedrals_count(), 0);
+    }
+
+    #[test]
+    fn impropers() {
+        let mut topology = Topology::new();
+        topology.resize(12);
+        assert_eq!(topology.impropers_count(), 0);
+
+        topology.add_bond(0, 1);
+        topology.add_bond(0, 2);
+        topology.add_bond(0, 3);
+        topology.add_bond(4, 7);
+        topology.add_bond(4, 5);
+        topology.add_bond(4, 8);
+        assert_eq!(topology.impropers_count(), 2);
+
+        assert_eq!(topology.impropers(), vec![[1, 0, 2, 3], [5, 4, 7, 8]]);
+
+        topology.clear_bonds();
+        assert_eq!(topology.impropers_count(), 0);
+    }
+
+    #[test]
+    fn residues() {
+        let mut topology = Topology::new();
+        topology.resize(4);
+        assert_eq!(topology.residues_count(), 0);
+
+        let mut residue = Residue::new("Foo");
+        residue.add_atom(0);
+        residue.add_atom(2);
+
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 1);
+
+        assert_eq!(topology.residue(0).unwrap().name(), "Foo");
+        {
+            let residue = topology.residue_for_atom(2).unwrap();
+            assert_eq!(residue.name(), "Foo");
+        }
+
+        let mut residue = Residue::new("Bar");
+        residue.add_atom(3);
+        topology.add_residue(&residue).unwrap();
+        assert_eq!(topology.residues_count(), 2);
+
+        let first = topology.residue(0).unwrap();
+        let second = topology.residue(0).unwrap();
+        assert!(topology.are_linked(&first, &second));
+
+        // missing residue
+        assert!(topology.residue_for_atom(1).is_none());
+        // out of bounds
+        assert!(topology.residue_for_atom(67).is_none());
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/src/chemfiles/trajectory.rs.html b/0.10.40/src/chemfiles/trajectory.rs.html new file mode 100644 index 000000000..cff34ab18 --- /dev/null +++ b/0.10.40/src/chemfiles/trajectory.rs.html @@ -0,0 +1,1265 @@ +trajectory.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+
// Chemfiles, a modern library for chemistry file reading and writing
+// Copyright (C) 2015-2018 Guillaume Fraux -- BSD licensed
+use std::convert::TryInto;
+use std::os::raw::c_char;
+use std::path::Path;
+
+use chemfiles_sys as ffi;
+
+use crate::errors::{check, check_success, Error, Status};
+use crate::strings;
+use crate::{Frame, Topology, UnitCell};
+
+/// The `Trajectory` type is the main entry point when using chemfiles. A
+/// `Trajectory` behave a bit like a file, allowing to read and/or write
+/// `Frame`.
+#[derive(Debug)]
+pub struct Trajectory {
+    handle: *mut ffi::CHFL_TRAJECTORY,
+}
+
+impl Drop for Trajectory {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = ffi::chfl_trajectory_close(self.as_ptr());
+        }
+    }
+}
+
+impl Trajectory {
+    /// Create a `Trajectory` from a C pointer.
+    ///
+    /// This function is unsafe because no validity check is made on the pointer.
+    #[inline]
+    pub(crate) unsafe fn from_ptr(ptr: *mut ffi::CHFL_TRAJECTORY) -> Result<Trajectory, Error> {
+        if ptr.is_null() {
+            Err(Error {
+                status: Status::FileError,
+                message: Error::last_error(),
+            })
+        } else {
+            Ok(Trajectory { handle: ptr })
+        }
+    }
+
+    /// Get the underlying C pointer as a pointer.
+    #[inline]
+    pub(crate) fn as_ptr(&self) -> *const ffi::CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Get the underlying C pointer as a mutable pointer.
+    #[inline]
+    pub(crate) fn as_mut_ptr(&mut self) -> *mut ffi::CHFL_TRAJECTORY {
+        self.handle
+    }
+
+    /// Open the file at the given `path` in the given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// ```
+    pub fn open<P>(path: P, mode: char) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path
+            .as_ref()
+            .to_str()
+            .ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = ffi::chfl_trajectory_open(path.as_ptr(), mode as c_char);
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Open the file at the given `path` using a specific file `format` and the
+    /// given `mode`.
+    ///
+    /// Valid modes are `'r'` for read, `'w'` for write and `'a'` for append.
+    ///
+    /// Specifying a format is needed when the file format does not match the
+    /// extension, or when there is not standard extension for this format. If
+    /// `format` is an empty string, the format will be guessed from the
+    /// extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the file is not accessible for the given mode, if
+    /// it is incorrectly formatted for the corresponding format, or in case of
+    /// I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open_with_format("water.zeo", 'r', "XYZ").unwrap();
+    /// ```
+    pub fn open_with_format<'a, P, S>(filename: P, mode: char, format: S) -> Result<Trajectory, Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let filename = filename
+            .as_ref()
+            .to_str()
+            .ok_or_else(|| Error::utf8_path_error(filename.as_ref()))?;
+
+        let filename = strings::to_c(filename);
+        let format = strings::to_c(format.into());
+        unsafe {
+            #[allow(clippy::cast_possible_wrap)]
+            let handle = ffi::chfl_trajectory_with_format(filename.as_ptr(), mode as c_char, format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Write to a memory buffer as though it was a formatted file.
+    ///
+    /// The `format` parameter should follow the same rules as in the main
+    /// `Trajectory` constructor, except that compression specification
+    /// is not supported.
+    ///
+    /// The `memory_buffer` function can be used to retrieve the data written
+    /// to memory of the `Trajectory`.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the format do not support in-memory writers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::Trajectory;
+    /// let trajectory_memory = Trajectory::memory_writer("SMI");
+    ///
+    /// // Binary formats typically do not support this feature
+    /// assert!(Trajectory::memory_writer("XTC").is_err());
+    /// ```
+    pub fn memory_writer<'a, S>(format: S) -> Result<Trajectory, Error>
+    where
+        S: Into<&'a str>,
+    {
+        let format = strings::to_c(format.into());
+        unsafe {
+            let handle = ffi::chfl_trajectory_memory_writer(format.as_ptr());
+            Trajectory::from_ptr(handle)
+        }
+    }
+
+    /// Read the next step of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of atom
+    /// in the next step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read(&mut frame).unwrap();
+    /// ```
+    pub fn read(&mut self, frame: &mut Frame) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_trajectory_read(self.as_mut_ptr(), frame.as_mut_ptr())) }
+    }
+
+    /// Read a specific `step` of this trajectory into a `frame`.
+    ///
+    /// If the number of atoms in frame does not correspond to the number of
+    /// atom at this step, the frame is resized.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.read_step(10, &mut frame).unwrap();
+    /// ```
+    pub fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error> {
+        unsafe {
+            check(ffi::chfl_trajectory_read_step(
+                self.as_mut_ptr(),
+                step as u64,
+                frame.as_mut_ptr(),
+            ))
+        }
+    }
+
+    /// Write a `frame` to this trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Frame};
+    /// let mut trajectory = Trajectory::open("water.pdb", 'w').unwrap();
+    /// let mut frame = Frame::new();
+    ///
+    /// trajectory.write(&mut frame).unwrap();
+    /// ```
+    pub fn write(&mut self, frame: &Frame) -> Result<(), Error> {
+        unsafe { check(ffi::chfl_trajectory_write(self.as_mut_ptr(), frame.as_ptr())) }
+    }
+
+    /// Set the `topology` associated with this trajectory. This topology will
+    /// be used when reading and writing the files, replacing any topology in
+    /// the frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, Atom, Topology};
+    /// let mut topology = Topology::new();
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_atom(&Atom::new("O"));
+    /// topology.add_atom(&Atom::new("H"));
+    /// topology.add_bond(0, 1);
+    /// topology.add_bond(1, 2);
+    ///
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_topology(&topology);
+    /// ```
+    pub fn set_topology(&mut self, topology: &Topology) {
+        unsafe {
+            check_success(ffi::chfl_trajectory_set_topology(self.as_mut_ptr(), topology.as_ptr()));
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in `format`;
+    /// and extracting the topology of this frame.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_file("topology.pdb").unwrap();
+    /// ```
+    pub fn set_topology_file<P>(&mut self, path: P) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+    {
+        let path = path
+            .as_ref()
+            .to_str()
+            .ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let path = strings::to_c(path);
+        unsafe {
+            check(ffi::chfl_trajectory_topology_file(
+                self.as_mut_ptr(),
+                path.as_ptr(),
+                std::ptr::null(),
+            ))
+        }
+    }
+
+    /// Set the topology associated with this trajectory by reading the first
+    /// frame of the file at the given `path` using the file format in
+    /// `format`; and extracting the topology of this frame.
+    ///
+    /// If `format` is an empty string, the format will be guessed from the
+    /// `path` extension.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the topology file is incorrectly formatted for
+    /// the corresponding format, or in case of I/O errors from the OS.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.nc", 'r').unwrap();
+    /// trajectory.set_topology_with_format("topology.mol", "PDB").unwrap();
+    /// ```
+    pub fn set_topology_with_format<'a, P, S>(&mut self, path: P, format: S) -> Result<(), Error>
+    where
+        P: AsRef<Path>,
+        S: Into<&'a str>,
+    {
+        let path = path
+            .as_ref()
+            .to_str()
+            .ok_or_else(|| Error::utf8_path_error(path.as_ref()))?;
+
+        let format = strings::to_c(format.into());
+        let path = strings::to_c(path);
+        unsafe {
+            check(ffi::chfl_trajectory_topology_file(
+                self.as_mut_ptr(),
+                path.as_ptr(),
+                format.as_ptr(),
+            ))
+        }
+    }
+
+    /// Set the unit `cell` associated with a trajectory. This cell will be
+    /// used when reading and writing the files, replacing any unit cell in the
+    /// frames or files.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::{Trajectory, UnitCell};
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    /// trajectory.set_cell(&UnitCell::new([10.0, 11.0, 12.5]));
+    /// ```
+    pub fn set_cell(&mut self, cell: &UnitCell) {
+        unsafe {
+            check_success(ffi::chfl_trajectory_set_cell(self.as_mut_ptr(), cell.as_ptr()));
+        }
+    }
+
+    /// Get the number of steps (the number of frames) in a trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let mut trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// println!("This trajectory contains {} steps", trajectory.nsteps());
+    /// ```
+    // FIXME should this take &self instead? The file can be modified by this
+    // function, but the format should reset the state.
+    pub fn nsteps(&mut self) -> usize {
+        let mut res = 0;
+        unsafe {
+            check(ffi::chfl_trajectory_nsteps(self.as_mut_ptr(), &mut res))
+                .expect("failed to get the number of steps in this trajectory");
+        }
+        #[allow(clippy::cast_possible_truncation)]
+        return res as usize;
+    }
+
+    /// Obtain the memory buffer written to by the trajectory.
+    ///
+    /// # Errors
+    ///
+    /// This fails if the trajectory was not opened with
+    /// `Trajectory::memory_writer`.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{Atom, BondOrder, Frame, Trajectory};
+    /// let mut trajectory_memory = Trajectory::memory_writer("SMI").unwrap();
+    ///
+    /// let mut frame = Frame::new();
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_atom(&Atom::new("C"), [0.0, 0.0, 0.0], None);
+    /// frame.add_bond_with_order(0, 1, BondOrder::Single);
+    ///
+    /// trajectory_memory.write(&frame).unwrap();
+    ///
+    /// let result = trajectory_memory.memory_buffer();
+    /// assert_eq!(result.unwrap(), "CC\n");
+    /// ```
+    #[allow(clippy::cast_possible_truncation)]
+    pub fn memory_buffer(&self) -> Result<&str, Error> {
+        let mut ptr: *const c_char = std::ptr::null();
+        let mut count: u64 = 0;
+        let buffer = unsafe {
+            check(ffi::chfl_trajectory_memory_buffer(self.as_ptr(), &mut ptr, &mut count))?;
+            std::slice::from_raw_parts(ptr.cast(), count.try_into().expect("failed to convert u64 to usize"))
+        };
+
+        let string = std::str::from_utf8(buffer)?;
+        Ok(string)
+    }
+
+    /// Get file path for this trajectory.
+    ///
+    /// # Example
+    /// ```no_run
+    /// # use chemfiles::Trajectory;
+    /// let trajectory = Trajectory::open("water.xyz", 'r').unwrap();
+    ///
+    /// assert_eq!(trajectory.path(), "water.xyz");
+    /// ```
+    pub fn path(&self) -> String {
+        let get_string = |ptr, len| unsafe { ffi::chfl_trajectory_path(self.as_ptr(), ptr, len) };
+        let path = strings::call_autogrow_buffer(1024, get_string).expect("failed to get path string");
+        return strings::from_c(path.as_ptr());
+    }
+}
+
+/// `MemoryTrajectoryReader` is a handle for a `Trajectory` in memory.
+pub struct MemoryTrajectoryReader<'data> {
+    inner: Trajectory,
+    phantom: std::marker::PhantomData<&'data [u8]>,
+}
+
+impl<'data> MemoryTrajectoryReader<'data> {
+    /// Read a memory buffer as though it was a formatted file.
+    ///
+    /// The memory buffer used to store the file is given using the `data`
+    /// argument. The `format` parameter is required and should follow the same
+    /// rules as in the main `Trajectory` constructor.
+    ///
+    /// # Errors
+    ///
+    /// This function fails if the data is incorrectly formatted for the
+    /// corresponding format, or if the format do not support in-memory readers.
+    ///
+    /// # Example
+    /// ```
+    /// # use chemfiles::{MemoryTrajectoryReader, Frame};
+    /// let aromatics = "c1ccccc1\nc1ccco1\nc1ccccn1\n";
+    /// let mut trajectory = MemoryTrajectoryReader::new(aromatics.as_bytes(), "SMI").unwrap();
+    /// let mut frame = Frame::new();
+    /// trajectory.read(&mut frame).unwrap();
+    /// assert_eq!(frame.size(), 6);
+    /// ```
+    pub fn new<Data, Format>(data: Data, format: Format) -> Result<MemoryTrajectoryReader<'data>, Error>
+    where
+        Data: Into<&'data [u8]>,
+        Format: AsRef<str>,
+    {
+        let data = data.into();
+        let format = strings::to_c(format.as_ref());
+        let trajectory = unsafe {
+            let handle = ffi::chfl_trajectory_memory_reader(data.as_ptr().cast(), data.len() as u64, format.as_ptr());
+            Trajectory::from_ptr(handle)
+        };
+        Ok(MemoryTrajectoryReader {
+            inner: trajectory?,
+            phantom: std::marker::PhantomData,
+        })
+    }
+}
+
+impl<'a> std::ops::Deref for MemoryTrajectoryReader<'a> {
+    type Target = Trajectory;
+
+    #[inline]
+    fn deref(&self) -> &Self::Target {
+        &self.inner
+    }
+}
+
+impl<'a> std::ops::DerefMut for MemoryTrajectoryReader<'a> {
+    #[inline]
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut self.inner
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use std::io::Read;
+    use std::path::Path;
+
+    use approx::assert_ulps_eq;
+
+    use crate::{Atom, CellShape, Frame, Topology, UnitCell};
+
+    #[test]
+    fn read() {
+        let root = Path::new(file!()).parent().unwrap().join("..");
+        let filename = root.join("data").join("water.xyz");
+        let mut file = Trajectory::open(filename.to_str().unwrap(), 'r').unwrap();
+
+        if cfg!(target_family = "unix") {
+            assert_eq!(file.path(), "src/../data/water.xyz");
+        } else if cfg!(target_family = "windows") {
+            assert_eq!(file.path(), "src\\..\\data\\water.xyz");
+        } else {
+            panic!("please add test for this OS!");
+        }
+
+        assert_eq!(file.nsteps(), 100);
+
+        let mut frame = Frame::new();
+        assert!(file.read(&mut frame).is_ok());
+
+        assert_eq!(frame.size(), 297);
+        assert_ulps_eq!(frame.positions()[0][0], 0.417219);
+        assert_ulps_eq!(frame.positions()[0][1], 8.303366);
+        assert_ulps_eq!(frame.positions()[0][2], 11.737172);
+        assert_ulps_eq!(frame.positions()[124][0], 5.099554);
+        assert_ulps_eq!(frame.positions()[124][1], -0.045104);
+        assert_ulps_eq!(frame.positions()[124][2], 14.153846);
+
+        assert_eq!(frame.atom(0).name(), "O");
+
+        file.set_cell(&UnitCell::new([30.0, 30.0, 30.0]));
+        assert!(file.read_step(41, &mut frame).is_ok());
+        let cell = frame.cell().clone();
+        assert_eq!(cell.lengths(), [30.0, 30.0, 30.0]);
+
+        assert_ulps_eq!(frame.positions()[0][0], 0.761277);
+        assert_ulps_eq!(frame.positions()[0][1], 8.106125);
+        assert_ulps_eq!(frame.positions()[0][2], 10.622949);
+        assert_ulps_eq!(frame.positions()[124][0], 5.13242);
+        assert_ulps_eq!(frame.positions()[124][1], 0.079862);
+        assert_ulps_eq!(frame.positions()[124][2], 14.194161);
+
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 0);
+        }
+
+        assert!(frame.guess_bonds().is_ok());
+        {
+            let topology = frame.topology();
+            assert_eq!(topology.size(), 297);
+            assert_eq!(topology.bonds_count(), 180);
+            assert_eq!(topology.angles_count(), 84);
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("Cs");
+        for _ in 0..297 {
+            topology.add_atom(&atom);
+        }
+
+        file.set_topology(&topology);
+        assert!(file.read_step(10, &mut frame).is_ok());
+        assert_eq!(frame.atom(42).name(), "Cs");
+
+        let filename = root.join("data").join("topology.xyz");
+        assert!(file.set_topology_file(filename.to_str().unwrap()).is_ok());
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.atom(100).name(), "Rd");
+
+        let filename = root.join("data").join("helium.xyz.but.not.really");
+        let filename = filename.to_str().unwrap();
+        let mut file = Trajectory::open_with_format(filename, 'r', "XYZ").unwrap();
+        assert!(file.read(&mut frame).is_ok());
+        assert_eq!(frame.size(), 125);
+    }
+
+    fn write_file<P>(path: P)
+    where
+        P: AsRef<Path>,
+    {
+        let mut file = Trajectory::open(path, 'w').unwrap();
+        let mut frame = Frame::new();
+        frame.resize(4);
+
+        for position in frame.positions_mut() {
+            *position = [1.0, 2.0, 3.0];
+        }
+
+        let mut topology = Topology::new();
+        let atom = Atom::new("X");
+        for _ in 0..4 {
+            topology.add_atom(&atom);
+        }
+        frame.set_topology(&topology).unwrap();
+        assert!(file.write(&frame).is_ok());
+    }
+
+    #[test]
+    fn write() {
+        let filename = "test-tmp.xyz";
+        write_file(filename);
+
+        let expected_content = "4
+Properties=species:S:1:pos:R:3
+X 1 2 3
+X 1 2 3
+X 1 2 3
+X 1 2 3"
+            .lines()
+            .collect::<Vec<_>>();
+
+        let mut file = std::fs::File::open(filename).unwrap();
+        let mut content = String::new();
+        let _ = file.read_to_string(&mut content).unwrap();
+
+        assert_eq!(expected_content, content.lines().collect::<Vec<_>>());
+        std::fs::remove_file(filename).unwrap();
+    }
+
+    #[test]
+    fn memory() {
+        // formats in decreasing order of their memory buffer length to check null termination
+        for format in &["CSSR", "GRO", "XYZ"] {
+            let mut frame_write = Frame::new();
+            frame_write.add_atom(&Atom::new("H"), [1.5, 3.0, -10.0], None);
+            frame_write.add_atom(&Atom::new("O"), [2.3, -1.4, 50.0], None);
+            frame_write.add_atom(&Atom::new("H"), [-1.5, 10.0, 0.0], None);
+            let cell = UnitCell::new([10.0, 11.0, 12.5]);
+
+            let mut trajectory_write = Trajectory::memory_writer(*format).unwrap();
+            trajectory_write.set_cell(&cell);
+            trajectory_write.write(&frame_write).unwrap();
+
+            let buffer = trajectory_write.memory_buffer().unwrap();
+            let mut trajectory_read = MemoryTrajectoryReader::new(buffer.as_bytes(), *format).unwrap();
+            let mut frame_read = Frame::new();
+            trajectory_read.read(&mut frame_read).unwrap();
+
+            assert_eq!(trajectory_read.nsteps(), 1);
+            assert_eq!(frame_read.cell().shape(), CellShape::Orthorhombic);
+            assert_eq!(frame_read.size(), 3);
+            assert_eq!(frame_read.atom(1).name(), "O");
+            crate::assert_vector3d_eq(&frame_read.positions()[2], &[-1.5, 10.0, 0.0], 1e-4);
+        }
+    }
+}
+
\ No newline at end of file diff --git a/0.10.40/static.files/COPYRIGHT-23e9bde6c69aea69.txt b/0.10.40/static.files/COPYRIGHT-23e9bde6c69aea69.txt new file mode 100644 index 000000000..1447df792 --- /dev/null +++ b/0.10.40/static.files/COPYRIGHT-23e9bde6c69aea69.txt @@ -0,0 +1,50 @@ +# REUSE-IgnoreStart + +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. + +# REUSE-IgnoreEnd diff --git a/0.10.40/static.files/FiraSans-LICENSE-db4b642586e02d97.txt b/0.10.40/static.files/FiraSans-LICENSE-db4b642586e02d97.txt new file mode 100644 index 000000000..d7e9c149b --- /dev/null +++ b/0.10.40/static.files/FiraSans-LICENSE-db4b642586e02d97.txt @@ -0,0 +1,98 @@ +// REUSE-IgnoreStart + +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/0.10.40/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 b/0.10.40/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 new file mode 100644 index 000000000..7a1e5fc54 Binary files /dev/null and b/0.10.40/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 differ diff --git a/0.10.40/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 b/0.10.40/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 new file mode 100644 index 000000000..e766e06cc Binary files /dev/null and b/0.10.40/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 differ diff --git a/0.10.40/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt b/0.10.40/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/0.10.40/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/0.10.40/static.files/LICENSE-MIT-65090b722b3f6c56.txt b/0.10.40/static.files/LICENSE-MIT-65090b722b3f6c56.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/0.10.40/static.files/LICENSE-MIT-65090b722b3f6c56.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/0.10.40/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 b/0.10.40/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 new file mode 100644 index 000000000..1866ad4bc Binary files /dev/null and b/0.10.40/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 differ diff --git a/0.10.40/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt b/0.10.40/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt new file mode 100644 index 000000000..4b3edc29e --- /dev/null +++ b/0.10.40/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt @@ -0,0 +1,103 @@ +// REUSE-IgnoreStart + +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/0.10.40/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 b/0.10.40/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 new file mode 100644 index 000000000..462c34efc Binary files /dev/null and b/0.10.40/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 differ diff --git a/0.10.40/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt b/0.10.40/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt new file mode 100644 index 000000000..0d2941e14 --- /dev/null +++ b/0.10.40/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt @@ -0,0 +1,97 @@ +// REUSE-IgnoreStart + +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/0.10.40/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 b/0.10.40/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 new file mode 100644 index 000000000..10b558e0b Binary files /dev/null and b/0.10.40/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 differ diff --git a/0.10.40/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 b/0.10.40/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 new file mode 100644 index 000000000..5ec64eef0 Binary files /dev/null and b/0.10.40/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 differ diff --git a/0.10.40/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 b/0.10.40/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 new file mode 100644 index 000000000..181a07f63 Binary files /dev/null and b/0.10.40/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 differ diff --git a/0.10.40/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 b/0.10.40/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 new file mode 100644 index 000000000..2ae08a7be Binary files /dev/null and b/0.10.40/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 differ diff --git a/0.10.40/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md b/0.10.40/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md new file mode 100644 index 000000000..175fa4f47 --- /dev/null +++ b/0.10.40/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md @@ -0,0 +1,98 @@ + + +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. +Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + + diff --git a/0.10.40/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 b/0.10.40/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 new file mode 100644 index 000000000..0263fc304 Binary files /dev/null and b/0.10.40/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 differ diff --git a/0.10.40/static.files/ayu-614652228113ac93.css b/0.10.40/static.files/ayu-614652228113ac93.css new file mode 100644 index 000000000..8fd09c9e4 --- /dev/null +++ b/0.10.40/static.files/ayu-614652228113ac93.css @@ -0,0 +1 @@ + :root{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--settings-input-border-color:#999;--settings-button-color:#fff;--settings-button-border-focus:#e0e0e0;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;--sidebar-link-color:#53b1db;--sidebar-current-link-background-color:transparent;--search-result-link-focus-background-color:#3c3c3c;--search-result-border-color:#aaa3;--search-color:#fff;--search-error-code-background-color:#4f4c4c;--search-results-alias-color:#c5c5c5;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:none;--search-tab-button-not-selected-background:transparent !important;--search-tab-button-selected-border-top-color:none;--search-tab-button-selected-background:#141920 !important;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ff7733;--code-highlight-kw-2-color:#ff7733;--code-highlight-lifetime-color:#ff7733;--code-highlight-prelude-color:#69f2df;--code-highlight-prelude-val-color:#ff7733;--code-highlight-number-color:#b8cc52;--code-highlight-string-color:#b8cc52;--code-highlight-literal-color:#ff7733;--code-highlight-attribute-color:#e6e1cf;--code-highlight-self-color:#36a3d9;--code-highlight-macro-color:#a37acc;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#788797;--code-highlight-doc-comment-color:#a1ac88;--src-line-numbers-span-color:#5c6773;--src-line-number-highlighted-background-color:rgba(255,236,164,0.06);--test-arrow-color:#788797;--test-arrow-background-color:rgba(57,175,215,0.09);--test-arrow-hover-color:#c5c5c5;--test-arrow-hover-background-color:rgba(57,175,215,0.368);--target-background-color:rgba(255,236,164,0.06);--target-border-color:rgba(255,180,76,0.85);--kbd-color:#c5c5c5;--kbd-background:#314559;--kbd-box-shadow-color:#5c6773;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);--crate-search-div-hover-filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);--crate-search-hover-border:#e0e0e0;--source-sidebar-background-selected:#14191f;--source-sidebar-background-hover:#14191f;--table-alt-row-background-color:#191f26;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:rgb(91,59,1);--scrape-example-code-line-highlight-focus:rgb(124,75,15);--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(15,20,25,1);--scrape-example-code-wrapper-background-end:rgba(15,20,25,0);}h1,h2,h3,h4,h1 a,.sidebar h2 a,.sidebar h3 a,#source-sidebar>.title{color:#fff;}h4{border:none;}.docblock code{color:#ffb454;}.docblock a>code{color:#39AFD7 !important;}.code-header,.docblock pre>code,pre,pre>code,.item-info code,.rustdoc.source .example-wrap{color:#e6e1cf;}.sidebar .current,.sidebar a:hover,#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus,#source-sidebar div.files>a.selected{color:#ffb44c;}.sidebar-elems .location{color:#ff7733;}.src-line-numbers .line-highlighted{color:#708090;padding-right:7px;border-right:1px solid #ffb44c;}.search-results a:hover,.search-results a:focus{color:#fff !important;background-color:#3c3c3c;}.search-results a{color:#0096cf;}.search-results a div.desc{color:#c5c5c5;}.result-name .primitive>i,.result-name .keyword>i{color:#788797;}#search-tabs>button.selected{border-bottom:1px solid #ffb44c !important;border-top:none;}#search-tabs>button:not(.selected){border:none;background-color:transparent !important;}#search-tabs>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}#settings-menu>a img{filter:invert(100);} \ No newline at end of file diff --git a/0.10.40/static.files/clipboard-7571035ce49a181d.svg b/0.10.40/static.files/clipboard-7571035ce49a181d.svg new file mode 100644 index 000000000..8adbd9963 --- /dev/null +++ b/0.10.40/static.files/clipboard-7571035ce49a181d.svg @@ -0,0 +1 @@ + diff --git a/0.10.40/static.files/dark-1097f8e92a01e3cf.css b/0.10.40/static.files/dark-1097f8e92a01e3cf.css new file mode 100644 index 000000000..1e5e7d194 --- /dev/null +++ b/0.10.40/static.files/dark-1097f8e92a01e3cf.css @@ -0,0 +1 @@ +:root{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--source-sidebar-background-selected:#333;--source-sidebar-background-hover:#444;--table-alt-row-background-color:#2A2A2A;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:rgb(91,59,1);--scrape-example-code-line-highlight-focus:rgb(124,75,15);--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);} \ No newline at end of file diff --git a/0.10.40/static.files/favicon-16x16-8b506e7a72182f1c.png b/0.10.40/static.files/favicon-16x16-8b506e7a72182f1c.png new file mode 100644 index 000000000..ea4b45cae Binary files /dev/null and b/0.10.40/static.files/favicon-16x16-8b506e7a72182f1c.png differ diff --git a/0.10.40/static.files/favicon-2c020d218678b618.svg b/0.10.40/static.files/favicon-2c020d218678b618.svg new file mode 100644 index 000000000..8b34b5119 --- /dev/null +++ b/0.10.40/static.files/favicon-2c020d218678b618.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/0.10.40/static.files/favicon-32x32-422f7d1d52889060.png b/0.10.40/static.files/favicon-32x32-422f7d1d52889060.png new file mode 100644 index 000000000..69b8613ce Binary files /dev/null and b/0.10.40/static.files/favicon-32x32-422f7d1d52889060.png differ diff --git a/0.10.40/static.files/light-0f8c037637f9eb3e.css b/0.10.40/static.files/light-0f8c037637f9eb3e.css new file mode 100644 index 000000000..21c3a859b --- /dev/null +++ b/0.10.40/static.files/light-0f8c037637f9eb3e.css @@ -0,0 +1 @@ +:root{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#F5F5F5;--sidebar-background-color-hover:#E0E0E0;--code-block-background-color:#F5F5F5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#ffffff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--source-sidebar-background-selected:#fff;--source-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#F5F5F5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);} \ No newline at end of file diff --git a/0.10.40/static.files/main-0795b7d26be81095.js b/0.10.40/static.files/main-0795b7d26be81095.js new file mode 100644 index 000000000..87b433898 --- /dev/null +++ b/0.10.40/static.files/main-0795b7d26be81095.js @@ -0,0 +1,12 @@ +"use strict";window.RUSTDOC_TOOLTIP_HOVER_MS=300;window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS=450;function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function elemIsInParent(elem,parent){while(elem&&elem!==document.body){if(elem===parent){return true}elem=elem.parentElement}return false}function blurHandler(event,parentElem,hideCallback){if(!elemIsInParent(document.activeElement,parentElem)&&!elemIsInParent(event.relatedTarget,parentElem)){hideCallback()}}window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");function setMobileTopbar(){const mobileLocationTitle=document.querySelector(".mobile-topbar h2");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileLocationTitle&&locationTitle){mobileLocationTitle.innerHTML=locationTitle.innerHTML}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function loadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="stylesheet";document.getElementsByTagName("head")[0].appendChild(link)}function preLoadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="preload";link.as="style";document.getElementsByTagName("head")[0].appendChild(link)}(function(){const isHelpPage=window.location.pathname.endsWith("/help.html");function loadScript(url){const script=document.createElement("script");script.src=url;document.head.append(script)}getSettingsButton().onclick=event=>{if(event.ctrlKey||event.altKey||event.metaKey){return}window.hideAllModals(false);addClass(getSettingsButton(),"rotate");event.preventDefault();loadCss(getVar("static-root-path")+getVar("settings-css"));loadScript(getVar("static-root-path")+getVar("settings-js"));preLoadCss(getVar("static-root-path")+getVar("theme-light-css"));preLoadCss(getVar("static-root-path")+getVar("theme-dark-css"));preLoadCss(getVar("static-root-path")+getVar("theme-ayu-css"));setTimeout(()=>{const themes=getVar("themes").split(",");for(const theme of themes){if(theme!==""){preLoadCss(getVar("root-path")+theme+".css")}}},0)};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},removeQueryParameters:()=>{document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.hash)}},hideResults:()=>{switchDisplayedElement(null);searchState.removeQueryParameters()},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(getVar("static-root-path")+getVar("search-js"));loadScript(resourcePath("search-index",".js"))}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){searchState.setLoadingSearch();loadSearch()}},setLoadingSearch:()=>{const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search)},};const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}const pageId=window.location.hash.replace(/^#/,"");if(savedHash!==pageId){savedHash=pageId;if(pageId!==""){expandSection(pageId)}}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();searchState.hideResults();ev.preventDefault();searchState.defocus();window.hideAllModals(true)}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"&&document.activeElement.type!=="radio"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":ev.preventDefault();searchState.focus();break;case"+":ev.preventDefault();expandAllDocs();break;case"-":ev.preventDefault();collapseAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const h3=document.createElement("h3");h3.innerHTML=`${longty}`;const ul=document.createElement("ul");ul.className="block "+shortty;for(const name of filtered){let path;if(shortty==="mod"){path=name+"/index.html"}else{path=shortty+"."+name+".html"}const current_page=document.location.href.split("/").pop();const link=document.createElement("a");link.href=path;if(path===current_page){link.className="current"}link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebar.appendChild(h3);sidebar.appendChild(ul)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("union","unions","Unions");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Definitions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector(".main-heading h1 > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=new Set((script?script.getAttribute("data-ignore-extern-crates"):"").split(","));for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.has(lib)){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const h3=document.createElement("h3");h3.innerHTML="Crates";const ul=document.createElement("ul");ul.className="block crate";for(const crate of window.ALL_CRATES){const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";if(window.rootPath!=="./"&&crate===window.currentCrate){link.className="current"}link.textContent=crate;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(h3);sidebarElems.appendChild(ul)}function expandAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hasClass(e,"type-contents-toggle")&&!hasClass(e,"more-examples-toggle")){e.open=true}});innerToggle.title="collapse all docs";innerToggle.children[0].innerText="\u2212"}function collapseAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});innerToggle.title="expand all docs";innerToggle.children[0].innerText="+"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}if(hasClass(innerToggle,"will-expand")){expandAllDocs()}else{collapseAllDocs()}}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}})}());window.rustdoc_add_line_numbers_to_examples=()=>{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");if(line_numbers.length>0){return}const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");for(const node of line_numbers){parent.removeChild(node)}})};if(getSettingValue("line-numbers")==="true"){window.rustdoc_add_line_numbers_to_examples()}function showSidebar(){window.hideAllModals(false);const sidebar=document.getElementsByClassName("sidebar")[0];addClass(sidebar,"shown")}function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}window.addEventListener("resize",()=>{if(window.CURRENT_TOOLTIP_ELEMENT){const base=window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE;const force_visible=base.TOOLTIP_FORCE_VISIBLE;hideTooltip(false);if(force_visible){showTooltip(base);base.TOOLTIP_FORCE_VISIBLE=true}}});const mainElem=document.getElementById(MAIN_ID);if(mainElem){mainElem.addEventListener("click",hideSidebar)}onEachLazy(document.querySelectorAll("a[href^='#']"),el=>{el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})});onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});function showTooltip(e){const notable_ty=e.getAttribute("data-notable-ty");if(!window.NOTABLE_TRAITS&¬able_ty){const data=document.getElementById("notable-traits-data");if(data){window.NOTABLE_TRAITS=JSON.parse(data.innerText)}else{throw new Error("showTooltip() called with notable without any notable traits!")}}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE===e){clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);return}window.hideAllModals(false);const wrapper=document.createElement("div");if(notable_ty){wrapper.innerHTML="
"+window.NOTABLE_TRAITS[notable_ty]+"
"}else{if(e.getAttribute("title")!==null){e.setAttribute("data-title",e.getAttribute("title"));e.removeAttribute("title")}if(e.getAttribute("data-title")!==null){const titleContent=document.createElement("div");titleContent.className="content";titleContent.appendChild(document.createTextNode(e.getAttribute("data-title")));wrapper.appendChild(titleContent)}}wrapper.className="tooltip popover";const focusCatcher=document.createElement("div");focusCatcher.setAttribute("tabindex","0");focusCatcher.onfocus=hideTooltip;wrapper.appendChild(focusCatcher);const pos=e.getBoundingClientRect();wrapper.style.top=(pos.top+window.scrollY+pos.height)+"px";wrapper.style.left=0;wrapper.style.right="auto";wrapper.style.visibility="hidden";const body=document.getElementsByTagName("body")[0];body.appendChild(wrapper);const wrapperPos=wrapper.getBoundingClientRect();const finalPos=pos.left+window.scrollX-wrapperPos.width+24;if(finalPos>0){wrapper.style.left=finalPos+"px"}else{wrapper.style.setProperty("--popover-arrow-offset",(wrapperPos.right-pos.right+4)+"px")}wrapper.style.visibility="";window.CURRENT_TOOLTIP_ELEMENT=wrapper;window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE=e;clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);wrapper.onpointerenter=function(ev){if(ev.pointerType!=="mouse"){return}clearTooltipHoverTimeout(e)};wrapper.onpointerleave=function(ev){if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!elemIsInParent(ev.relatedTarget,e)){setTooltipHoverTimeout(e,false);addClass(wrapper,"fade-out")}}}function setTooltipHoverTimeout(element,show){clearTooltipHoverTimeout(element);if(!show&&!window.CURRENT_TOOLTIP_ELEMENT){return}if(show&&window.CURRENT_TOOLTIP_ELEMENT){return}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE!==element){return}element.TOOLTIP_HOVER_TIMEOUT=setTimeout(()=>{if(show){showTooltip(element)}else if(!element.TOOLTIP_FORCE_VISIBLE){hideTooltip(false)}},show?window.RUSTDOC_TOOLTIP_HOVER_MS:window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS)}function clearTooltipHoverTimeout(element){if(element.TOOLTIP_HOVER_TIMEOUT!==undefined){removeClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out");clearTimeout(element.TOOLTIP_HOVER_TIMEOUT);delete element.TOOLTIP_HOVER_TIMEOUT}}function tooltipBlurHandler(event){if(window.CURRENT_TOOLTIP_ELEMENT&&!elemIsInParent(document.activeElement,window.CURRENT_TOOLTIP_ELEMENT)&&!elemIsInParent(event.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT)&&!elemIsInParent(document.activeElement,window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)&&!elemIsInParent(event.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)){setTimeout(()=>hideTooltip(false),0)}}function hideTooltip(focus){if(window.CURRENT_TOOLTIP_ELEMENT){if(window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE){if(focus){window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.focus()}window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE=false}const body=document.getElementsByTagName("body")[0];body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);window.CURRENT_TOOLTIP_ELEMENT=null}}onEachLazy(document.getElementsByClassName("tooltip"),e=>{e.onclick=function(){this.TOOLTIP_FORCE_VISIBLE=this.TOOLTIP_FORCE_VISIBLE?false:true;if(window.CURRENT_TOOLTIP_ELEMENT&&!this.TOOLTIP_FORCE_VISIBLE){hideTooltip(true)}else{showTooltip(this);window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex","0");window.CURRENT_TOOLTIP_ELEMENT.focus();window.CURRENT_TOOLTIP_ELEMENT.onblur=tooltipBlurHandler}return false};e.onpointerenter=function(ev){if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(this,true)};e.onpointermove=function(ev){if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(this,true)};e.onpointerleave=function(ev){if(ev.pointerType!=="mouse"){return}if(!this.TOOLTIP_FORCE_VISIBLE&&!elemIsInParent(ev.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT)){setTooltipHoverTimeout(e,false);addClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out")}}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar()}else{hideSidebar()}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");const channel=getVar("channel");book_info.className="top";book_info.innerHTML=`You can find more information in \ +the rustdoc book.`;const shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=[`For a full list of all search features, take a look here.`,"Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + -> vec or String, enum:Cow -> bool)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for functions that accept or return \ + slices and \ + arrays by writing \ + square brackets (e.g., -> [u8] or [] -> Option)","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);const container=document.createElement("div");if(!isHelpPage){container.className="popover"}container.id="help";container.style.display="none";const side_by_side=document.createElement("div");side_by_side.className="side-by-side";side_by_side.appendChild(div_shortcuts);side_by_side.appendChild(div_infos);container.appendChild(book_info);container.appendChild(side_by_side);container.appendChild(rustdoc_version);if(isHelpPage){const help_section=document.createElement("section");help_section.appendChild(container);document.getElementById("main-content").appendChild(help_section);container.style.display="block"}else{const help_button=getHelpButton();help_button.appendChild(container);container.onblur=helpBlurHandler;help_button.onblur=helpBlurHandler;help_button.children[0].onblur=helpBlurHandler}return container}window.hideAllModals=function(switchFocus){hideSidebar();window.hidePopoverMenus();hideTooltip(switchFocus)};window.hidePopoverMenus=function(){onEachLazy(document.querySelectorAll(".search-form .popover"),elem=>{elem.style.display="none"})};function getHelpMenu(buildNeeded){let menu=getHelpButton().querySelector(".popover");if(!menu&&buildNeeded){menu=buildHelpMenu()}return menu}function showHelp(){getHelpButton().querySelector("a").focus();const menu=getHelpMenu(true);if(menu.style.display==="none"){window.hideAllModals();menu.style.display=""}}if(isHelpPage){showHelp();document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault()})}else{document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault();const menu=getHelpMenu(true);const shouldShowHelp=menu.style.display==="none";if(shouldShowHelp){showHelp()}else{window.hidePopoverMenus()}})}setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){let reset_button_timeout=null;const but=document.getElementById("copy-path");if(!but){return}but.onclick=()=>{const parent=but.parentElement;const path=[];onEach(parent.childNodes,child=>{if(child.tagName==="A"){path.push(child.textContent)}});const el=document.createElement("textarea");el.value=path.join("::");el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);but.children[0].style.display="none";let tmp;if(but.childNodes.length<2){tmp=document.createTextNode("✓");but.appendChild(tmp)}else{onEachLazy(but.childNodes,e=>{if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent="✓"}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent="";reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/0.10.40/static.files/normalize-76eba96aa4d2e634.css b/0.10.40/static.files/normalize-76eba96aa4d2e634.css new file mode 100644 index 000000000..469959f13 --- /dev/null +++ b/0.10.40/static.files/normalize-76eba96aa4d2e634.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/0.10.40/static.files/noscript-13285aec31fa243e.css b/0.10.40/static.files/noscript-13285aec31fa243e.css new file mode 100644 index 000000000..c32e0cb13 --- /dev/null +++ b/0.10.40/static.files/noscript-13285aec31fa243e.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path{display:none;}nav.sub{display:none;}.source .sidebar{display:none;}.notable-traits{display:none;} \ No newline at end of file diff --git a/0.10.40/static.files/rust-logo-151179464ae7ed46.svg b/0.10.40/static.files/rust-logo-151179464ae7ed46.svg new file mode 100644 index 000000000..62424d8ff --- /dev/null +++ b/0.10.40/static.files/rust-logo-151179464ae7ed46.svg @@ -0,0 +1,61 @@ + + + diff --git a/0.10.40/static.files/rustdoc-9bb858ba049f1f21.css b/0.10.40/static.files/rustdoc-9bb858ba049f1f21.css new file mode 100644 index 000000000..73eacd803 --- /dev/null +++ b/0.10.40/static.files/rustdoc-9bb858ba049f1f21.css @@ -0,0 +1,8 @@ + :root{--nav-sub-mobile-padding:8px;--search-typename-width:6.75rem;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{box-sizing:border-box;}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:25px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}.docblock>h2:first-child,.docblock>h3:first-child,.docblock>h4:first-child,.docblock>h5:first-child,.docblock>h6:first-child{margin-top:0;}.main-heading h1{margin:0;padding:0;flex-grow:1;overflow-wrap:break-word;overflow-wrap:anywhere;}.main-heading{display:flex;flex-wrap:wrap;padding-bottom:6px;margin-bottom:15px;}.content h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h1,h2{line-height:1.25;padding-top:3px;padding-bottom:9px;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;margin:0;padding:0;white-space:pre-wrap;}#crate-search,h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,.search-input,.search-results .result-name,.item-name>a,.out-of-band,span.since,a.srclink,#help-button>a,summary.hideme,.scraped-example-list,ul.all-items{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}#toggle-all-docs,a.anchor,.small-section-header a,#source-sidebar a,.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,h1 a,.search-results a,.stab,.result-name i{color:var(--main-color);}span.enum,a.enum,span.struct,a.struct,span.union,a.union,span.primitive,a.primitive,span.type,a.type,span.foreigntype,a.foreigntype{color:var(--type-link-color);}span.trait,a.trait,span.traitalias,a.traitalias{color:var(--trait-link-color);}span.associatedtype,a.associatedtype,span.constant,a.constant,span.static,a.static{color:var(--assoc-item-link-color);}span.fn,a.fn,span.method,a.method,span.tymethod,a.tymethod{color:var(--function-link-color);}span.attr,a.attr,span.derive,a.derive,span.macro,a.macro{color:var(--macro-link-color);}span.mod,a.mod{color:var(--mod-link-color);}span.keyword,a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);text-decoration:none;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p{margin:0 0 .75em 0;}p:last-child{margin:0;}button{padding:1px 6px;cursor:pointer;}button#toggle-all-docs{padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.source main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}details:not(.toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;line-height:1.5;}pre.item-decl{overflow-x:auto;}.item-decl .type-contents-toggle{contain:initial;}.source .content pre{padding:20px;}.rustdoc.source .example-wrap pre.src-line-numbers{padding:20px 0 20px 4px;}img{max-width:100%;}.sub-logo-container,.logo-container{line-height:0;display:block;}.sub-logo-container{margin-right:32px;}.sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.rust-logo{filter:var(--rust-logo-filter);}.sidebar{font-size:0.875rem;flex:0 0 200px;overflow-y:scroll;overscroll-behavior:contain;position:sticky;height:100vh;top:0;left:0;}.rustdoc.source .sidebar{flex-basis:50px;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;z-index:1;}.sidebar,.mobile-topbar,.sidebar-menu-toggle,#src-sidebar-toggle,#source-sidebar{background-color:var(--sidebar-background-color);}#src-sidebar-toggle>button:hover,#src-sidebar-toggle>button:focus{background-color:var(--sidebar-background-color-hover);}.source .sidebar>*:not(#src-sidebar-toggle){visibility:hidden;}.source-sidebar-expanded .source .sidebar{overflow-y:auto;flex-basis:300px;}.source-sidebar-expanded .source .sidebar>*:not(#src-sidebar-toggle){visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.sidebar .logo-container{margin-top:10px;margin-bottom:10px;text-align:center;}.version{overflow-wrap:break-word;}.logo-container>img{height:100px;width:100px;}ul.block,.block li{padding:0;margin:0;list-style:none;}.sidebar-elems a,.sidebar>h2 a{display:block;padding:0.25rem;margin-left:-0.25rem;}.sidebar h2{overflow-wrap:anywhere;padding:0;margin:0.7rem 0;}.sidebar h3{font-size:1.125rem;padding:0;margin:0;}.sidebar-elems,.sidebar>h2{padding-left:24px;}.sidebar a{color:var(--sidebar-link-color);}.sidebar .current,.sidebar a:hover:not(.logo-container){background-color:var(--sidebar-current-link-background-color);}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.mobile-topbar{display:none;}.rustdoc .example-wrap{display:flex;position:relative;margin-bottom:10px;}.rustdoc .example-wrap:last-child{margin-bottom:0px;}.rustdoc .example-wrap pre{margin:0;flex-grow:1;}.rustdoc:not(.source) .example-wrap pre{overflow:auto hidden;}.rustdoc .example-wrap pre.example-line-numbers,.rustdoc .example-wrap pre.src-line-numbers{flex-grow:0;min-width:fit-content;overflow:initial;text-align:right;-webkit-user-select:none;user-select:none;padding:14px 8px;color:var(--src-line-numbers-span-color);}.rustdoc .example-wrap pre.src-line-numbers{padding:14px 0;}.src-line-numbers a,.src-line-numbers span{color:var(--src-line-numbers-span-color);padding:0 8px;}.src-line-numbers :target{background-color:transparent;border-right:none;padding:0 8px;}.src-line-numbers .line-highlighted{background-color:var(--src-line-number-highlighted-background-color);}.search-loading{text-align:center;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock :not(pre)>code,.docblock-short code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.out-of-band{flex-grow:0;font-size:1.125rem;}.docblock code,.docblock-short code,pre,.rustdoc.source .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}.docblock table{margin:.5em 0;border-collapse:collapse;}.docblock table td,.docblock table th{padding:.5em;border:1px solid var(--border-color);}.docblock table tbody tr:nth-child(2n){background:var(--table-alt-row-background-color);}.method .where,.fn .where,.where.fmt-newline{display:block;white-space:pre-wrap;font-size:0.875rem;}.item-info{display:block;margin-left:24px;}.item-info code{font-size:0.875rem;}#main-content>.item-info{margin-left:0;}nav.sub{flex-grow:1;flex-flow:row nowrap;margin:4px 0 25px 0;display:flex;align-items:center;}.search-form{position:relative;display:flex;height:34px;flex-grow:1;}.source nav.sub{margin:0 0 15px 0;}.small-section-header{display:block;position:relative;}.small-section-header:hover>.anchor,.impl:hover>.anchor,.trait-impl:hover>.anchor,.variant:hover>.anchor{display:initial;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.main-heading a:hover,.example-wrap .rust a:hover,.all-items a:hover,.docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.item-info a{text-decoration:underline;}.crate.block a.current{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;padding:0;margin:0;}.item-table>li{display:table-row;}.item-table>li>div{display:table-cell;}.item-table>li>.item-name{padding-right:1.25rem;}.search-results-title{margin-top:0;white-space:nowrap;display:flex;align-items:baseline;}#crate-search-div{position:relative;min-width:5em;}#crate-search{min-width:115px;padding:0 23px 0 4px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);color:inherit;line-height:1.5;font-weight:500;}#crate-search:hover,#crate-search:focus{border-color:var(--crate-search-hover-border);}@-moz-document url-prefix(){#crate-search{padding-left:0px;padding-right:19px;}}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url('data:image/svg+xml, \ + ');filter:var(--crate-search-div-filter);}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:var(--crate-search-div-hover-filter);}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;flex-grow:1;background-color:var(--button-background-color);color:var(--search-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;}.search-results.active{display:block;}.search-results>a{display:flex;margin-left:2px;margin-right:2px;border-bottom:1px solid var(--search-result-border-color);gap:1em;}.search-results>a>div.desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:2;}.search-results a:hover,.search-results a:focus{background-color:var(--search-result-link-focus-background-color);}.search-results .result-name{display:flex;align-items:center;justify-content:start;flex:3;}.search-results .result-name span.alias{color:var(--search-results-alias-color);}.search-results .result-name .grey{color:var(--search-results-grey-color);}.search-results .result-name .typename{color:var(--search-results-grey-color);font-size:0.875rem;width:var(--search-typename-width);}.search-results .result-name .path{word-break:break-all;max-width:calc(100% - var(--search-typename-width));display:inline-block;}.popover{position:absolute;top:100%;right:0;z-index:2;margin-top:7px;border-radius:3px;border:1px solid var(--border-color);background-color:var(--main-background-color);color:var(--main-color);--popover-arrow-offset:11px;}.popover::before{content:'';position:absolute;right:var(--popover-arrow-offset);border:solid var(--border-color);border-width:1px 1px 0 0;background-color:var(--main-background-color);padding:4px;transform:rotate(-45deg);top:-5px;}#help.popover{max-width:600px;--popover-arrow-offset:48px;}#help dt{float:left;clear:left;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{min-height:36px;display:flex;padding:3px;margin-bottom:5px;align-items:center;vertical-align:text-bottom;}.item-name .stab{margin-left:0.3125em;}.stab{padding:0 2px;font-size:0.875rem;font-weight:normal;color:var(--main-color);background-color:var(--stab-background-color);width:fit-content;white-space:pre-wrap;border-radius:3px;display:inline;}.stab.portability>code{background:none;color:var(--stab-code-color);}.stab .emoji{font-size:1.25rem;margin-right:0.3rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;float:right;}.rightside:not(a),.out-of-band{color:var(--right-side-color);}pre.rust{tab-size:4;-moz-tab-size:4;}pre.rust .kw{color:var(--code-highlight-kw-color);}pre.rust .kw-2{color:var(--code-highlight-kw-2-color);}pre.rust .lifetime{color:var(--code-highlight-lifetime-color);}pre.rust .prelude-ty{color:var(--code-highlight-prelude-color);}pre.rust .prelude-val{color:var(--code-highlight-prelude-val-color);}pre.rust .string{color:var(--code-highlight-string-color);}pre.rust .number{color:var(--code-highlight-number-color);}pre.rust .bool-val{color:var(--code-highlight-literal-color);}pre.rust .self{color:var(--code-highlight-self-color);}pre.rust .attr{color:var(--code-highlight-attribute-color);}pre.rust .macro,pre.rust .macro-nonterminal{color:var(--code-highlight-macro-color);}pre.rust .question-mark{font-weight:bold;color:var(--code-highlight-question-mark-color);}pre.rust .comment{color:var(--code-highlight-comment-color);}pre.rust .doccomment{color:var(--code-highlight-doc-comment-color);}.rustdoc.source .example-wrap pre.rust a{background:var(--codeblock-link-background);}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;left:-25px;top:5px;margin:0;line-height:1;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}a.test-arrow{visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;color:var(--test-arrow-color);background-color:var(--test-arrow-background-color);}a.test-arrow:hover{color:var(--test-arrow-hover-color);background-color:var(--test-arrow-hover-background-color);}.example-wrap:hover .test-arrow{visibility:visible;}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;display:block;}.out-of-band>span.since{font-size:1.25rem;}.sub-variant h4{font-size:1rem;font-weight:400;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}:target{padding-right:3px;background-color:var(--target-background-color);border-right:3px solid var(--target-border-color);}.code-header a.tooltip{color:inherit;margin-right:15px;position:relative;}.code-header a.tooltip:hover{color:var(--link-color);}a.tooltip:hover::after{position:absolute;top:calc(100% - 10px);left:-15px;right:-15px;height:20px;content:"\00a0";}.fade-out{opacity:0;transition:opacity 0.45s cubic-bezier(0,0,0.1,1.0);}.popover.tooltip .content{margin:0.25em 0.5em;}.popover.tooltip .content pre,.popover.tooltip .content code{background:transparent;margin:0;padding:0;font-size:1.25rem;white-space:pre-wrap;}.popover.tooltip .content>h3:first-child{margin:0 0 5px 0;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#search-tabs{display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#search-tabs button{text-align:center;font-size:1.125rem;border:0;border-top:2px solid;flex:1;line-height:1.5;color:inherit;}#search-tabs button:not(.selected){background-color:var(--search-tab-button-not-selected-background);border-top-color:var(--search-tab-button-not-selected-border-top-color);}#search-tabs button:hover,#search-tabs button.selected{background-color:var(--search-tab-button-selected-background);border-top-color:var(--search-tab-button-selected-border-top-color);}#search-tabs .count{font-size:1rem;color:var(--search-tab-title-count-color);}#search .error code{border-radius:3px;background-color:var(--search-error-code-background-color);}.search-corrections{font-weight:normal;}#src-sidebar-toggle{position:sticky;top:0;left:0;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:stretch;align-items:stretch;z-index:10;}#source-sidebar{width:100%;overflow:auto;}#source-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid var(--border-color);margin-bottom:6px;}#source-sidebar div.files>a:hover,details.dir-entry summary:hover,#source-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:var(--source-sidebar-background-hover);}#source-sidebar div.files>a.selected{background-color:var(--source-sidebar-background-selected);}#src-sidebar-toggle>button{font-size:inherit;font-weight:bold;background:none;color:inherit;text-align:center;border:none;outline:none;flex:1 1;-webkit-appearance:none;opacity:1;}#settings-menu,#help-button{margin-left:4px;display:flex;}#settings-menu>a,#help-button>a{display:flex;align-items:center;justify-content:center;background-color:var(--button-background-color);border:1px solid var(--border-color);border-radius:2px;color:var(--settings-button-color);font-size:20px;width:33px;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>a:hover,#help-button>a:focus{border-color:var(--settings-button-border-focus);}#copy-path{color:var(--copy-path-button-color);background:var(--main-background-color);height:34px;margin-left:10px;padding:0;padding-left:2px;border:0;width:33px;}#copy-path>img{filter:var(--copy-path-img-filter);}#copy-path:hover>img{filter:var(--copy-path-img-hover-filter);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;color:var(--kbd-color);background-color:var(--kbd-background);box-shadow:inset 0 -1px 0 var(--kbd-box-shadow-color);}ul.all-items>li{list-style:none;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 -4px;padding:0 0 0 4px;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.toggle{contain:layout;position:relative;}details.toggle>summary.hideme{cursor:pointer;font-size:1rem;}details.toggle>summary{list-style:none;outline:none;}details.toggle>summary::-webkit-details-marker,details.toggle>summary::marker{display:none;}details.toggle>summary.hideme>span{margin-left:9px;}details.toggle>summary::before{background:url('data:image/svg+xml,') no-repeat top left;content:"";cursor:pointer;width:16px;height:16px;display:inline-block;vertical-align:middle;opacity:.5;filter:var(--toggle-filter);}details.toggle>summary.hideme>span,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.toggle>summary.hideme::after{content:"";}details.toggle>summary:focus::before,details.toggle>summary:hover::before{opacity:1;}details.toggle>summary:focus-visible::before{outline:1px dotted #000;outline-offset:1px;}details.non-exhaustive{margin-bottom:8px;}details.toggle>summary.hideme::before{position:relative;}details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.toggle[open] >summary.hideme{position:absolute;}details.toggle[open] >summary.hideme>span{display:none;}details.toggle[open] >summary::before{background:url('data:image/svg+xml,') no-repeat top left;}details.toggle[open] >summary::after{content:"Collapse";}.docblock summary>*{display:inline-block;}.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{display:block;}main{padding-left:15px;padding-top:0px;}.main-heading{flex-direction:column;}.out-of-band{text-align:left;margin-left:initial;padding:initial;}.out-of-band .since::before{content:"Since ";}.sidebar .logo-container,.sidebar .location{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;z-index:11;height:calc(100vh - 45px);width:200px;}.source main,.rustdoc.source .sidebar{top:0;padding:0;height:100vh;border:0;}.sidebar.shown,.source-sidebar-expanded .source .sidebar,.rustdoc:not(.source) .sidebar:focus-within{left:0;}.mobile-topbar h2{padding-bottom:0;margin:auto 0.5em auto auto;overflow:hidden;font-size:24px;}.mobile-topbar h2 a{display:block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin:5px 0 5px 20px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;color:var(--main-color);}.sidebar-elems{margin-top:1em;}.anchor{display:none !important;}#search-tabs .count{display:block;}#main-content>details.toggle>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}#src-sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;border:1px solid;border-left:0;}.source-sidebar-expanded #src-sidebar-toggle{left:unset;top:unset;width:unset;border-top-right-radius:unset;border-bottom-right-radius:unset;position:sticky;border:0;border-bottom:1px solid;}#copy-path,#help-button{display:none;}.item-table,.item-row,.item-table>li,.item-table>li>div,.search-results>a,.search-results>a>div{display:block;}.search-results>a{padding:5px 0px;}.search-results>a>div.desc,.item-table>li>div.desc{padding-left:2em;}.search-results .result-name{display:block;}.search-results .result-name .typename{width:initial;margin-right:0;}.search-results .result-name .typename,.search-results .result-name .path{display:inline;}.source-sidebar-expanded .source .sidebar{max-width:100vw;width:100vw;}details.toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>details.toggle:not(.top-doc)>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}.impl-items>.item-info{margin-left:34px;}.source nav.sub{margin:0;padding:var(--nav-sub-mobile-padding);}}@media (min-width:701px){.scraped-example-title{position:absolute;z-index:10;background:var(--main-background-color);bottom:8px;right:5px;padding:2px 4px;box-shadow:0 0 4px var(--main-background-color);}}@media print{nav.sidebar,nav.sub,.out-of-band,a.srclink,#copy-path,details.toggle[open] >summary::before,details.toggle>summary::before,details.toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}nav.sub{flex-direction:column;}.search-form{align-self:stretch;}.sub-logo-container>img{height:35px;width:35px;margin-bottom:var(--nav-sub-mobile-padding);}}.variant,.implementors-toggle>summary,.impl,#implementors-list>.docblock,.impl-items>section,.impl-items>.toggle>summary,.methods>section,.methods>.toggle>summary{margin-bottom:0.75em;}.variants>.docblock,.implementors-toggle>.docblock,.impl-items>.toggle[open]:not(:last-child),.methods>.toggle[open]:not(:last-child),.implementors-toggle[open]:not(:last-child){margin-bottom:2em;}#trait-implementations-list .impl-items>.toggle:not(:last-child),#synthetic-implementations-list .impl-items>.toggle:not(:last-child),#blanket-implementations-list .impl-items>.toggle:not(:last-child){margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;border:1px solid var(--scrape-example-help-border-color);border-radius:50px;color:var(--scrape-example-help-color);}.scraped-example-list .scrape-help:hover{border-color:var(--scrape-example-help-hover-border-color);color:var(--scrape-example-help-hover-color);}.scraped-example{position:relative;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:calc(1.5em * 5 + 10px);}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;padding-bottom:0;max-height:calc(1.5em * 5 + 10px);}.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre{max-height:calc(1.5em * 10 + 10px);}.scraped-example .code-wrapper .next,.scraped-example .code-wrapper .prev,.scraped-example .code-wrapper .expand{color:var(--main-color);position:absolute;top:0.25em;z-index:1;padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.scraped-example .code-wrapper .prev{right:2.25em;}.scraped-example .code-wrapper .next{right:1.25em;}.scraped-example .code-wrapper .expand{right:0.25em;}.scraped-example:not(.expanded) .code-wrapper::before,.scraped-example:not(.expanded) .code-wrapper::after{content:" ";width:100%;height:5px;position:absolute;z-index:1;}.scraped-example:not(.expanded) .code-wrapper::before{top:0;background:linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded) .code-wrapper::after{bottom:0;background:linear-gradient(to top,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example .code-wrapper .example-wrap{width:100%;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .example-wrap .rust span.highlight{background:var(--scrape-example-code-line-highlight);}.scraped-example .example-wrap .rust span.highlight.focus{background:var(--scrape-example-code-line-highlight-focus);}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;cursor:pointer;}.more-scraped-examples{margin-left:25px;position:relative;}.toggle-line{position:absolute;top:5px;bottom:0;right:calc(100% + 10px);padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;background:var(--scrape-example-toggle-line-background);}.toggle-line:hover .toggle-line-inner{background:var(--scrape-example-toggle-line-hover-background);}.more-scraped-examples .scraped-example,.example-links{margin-top:20px;}.more-scraped-examples .scraped-example:first-child{margin-top:5px;}.example-links ul{margin-bottom:0;} \ No newline at end of file diff --git a/0.10.40/static.files/scrape-examples-ef1e698c1d417c0c.js b/0.10.40/static.files/scrape-examples-ef1e698c1d417c0c.js new file mode 100644 index 000000000..ba830e374 --- /dev/null +++ b/0.10.40/static.files/scrape-examples-ef1e698c1d417c0c.js @@ -0,0 +1 @@ +"use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelector(".src-line-numbers");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines.children[line].offsetTop}else{const wrapper=elt.querySelector(".code-wrapper");const halfHeight=wrapper.offsetHeight/2;const offsetTop=lines.children[loc[0]].offsetTop;const lastLine=lines.children[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight}lines.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset)}function updateScrapedExample(example,isHidden){const locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");if(locs.length>1){const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title};example.querySelector(".prev").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length})});example.querySelector(".next").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length})})}const expandButton=example.querySelector(".expand");if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");scrollToLoc(example,locs[0][0],isHidden)}else{addClass(example,"expanded")}})}scrollToLoc(example,locs[0][0],isHidden)}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>updateScrapedExample(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false})});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>updateScrapedExample(el,true))})},{once:true})})})() \ No newline at end of file diff --git a/0.10.40/static.files/search-f6292fe389d70017.js b/0.10.40/static.files/search-f6292fe389d70017.js new file mode 100644 index 000000000..c91355a61 --- /dev/null +++ b/0.10.40/static.files/search-f6292fe389d70017.js @@ -0,0 +1,5 @@ +"use strict";(function(){const itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias",];const longItemTypes=["module","extern crate","re-export","struct","enum","function","type alias","static","trait","","trait method","method","struct field","enum variant","macro","primitive type","assoc type","constant","assoc const","union","foreign type","keyword","existential type","attribute macro","derive macro","trait alias",];const TY_PRIMITIVE=itemTypes.indexOf("primitive");const TY_KEYWORD=itemTypes.indexOf("keyword");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";function hasOwnPropertyRustdoc(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("search-tabs").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});const isTypeSearch=(nb>0||iter===1);iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb;const correctionsElem=document.getElementsByClassName("search-corrections");if(isTypeSearch){removeClass(correctionsElem[0],"hidden")}else{addClass(correctionsElem[0],"hidden")}}else if(nb!==0){printTab(0)}}const editDistanceState={current:[],prev:[],prevPrev:[],calculate:function calculate(a,b,limit){if(a.lengthlimit){return limit+1}while(b.length>0&&b[0]===a[0]){a=a.substring(1);b=b.substring(1)}while(b.length>0&&b[b.length-1]===a[a.length-1]){a=a.substring(0,a.length-1);b=b.substring(0,b.length-1)}if(b.length===0){return minDist}const aLength=a.length;const bLength=b.length;for(let i=0;i<=bLength;++i){this.current[i]=0;this.prev[i]=i;this.prevPrev[i]=Number.MAX_VALUE}for(let i=1;i<=aLength;++i){this.current[0]=i;const aIdx=i-1;for(let j=1;j<=bLength;++j){const bIdx=j-1;const substitutionCost=a[aIdx]===b[bIdx]?0:1;this.current[j]=Math.min(this.prev[j]+1,this.current[j-1]+1,this.prev[j-1]+substitutionCost);if((i>1)&&(j>1)&&(a[aIdx]===b[bIdx-1])&&(a[aIdx-1]===b[bIdx])){this.current[j]=Math.min(this.current[j],this.prevPrev[j-2]+1)}}const prevPrevTmp=this.prevPrev;this.prevPrev=this.prev;this.prev=this.current;this.current=prevPrevTmp}const distance=this.prev[bLength];return distance<=limit?distance:(limit+1)},};function editDistance(a,b,limit){return editDistanceState.calculate(a,b,limit)}function initSearch(rawSearchIndex){const MAX_RESULTS=200;const NO_TYPE_FILTER=-1;let searchIndex;let currentResults;let typeNameIdMap;const ALIASES=new Map();let typeNameIdOfArray;let typeNameIdOfSlice;let typeNameIdOfArrayOrSlice;function buildTypeMapIndex(name){if(name===""||name===null){return-1}if(typeNameIdMap.has(name)){return typeNameIdMap.get(name)}else{const id=typeNameIdMap.size;typeNameIdMap.set(name,id);return id}}function isWhitespace(c){return" \t\n\r".indexOf(c)!==-1}function isSpecialStartCharacter(c){return"<\"".indexOf(c)!==-1}function isEndCharacter(c){return",>-]".indexOf(c)!==-1}function isStopCharacter(c){return isEndCharacter(c)}function isErrorCharacter(c){return"()".indexOf(c)!==-1}function itemTypeFromName(typename){const index=itemTypes.findIndex(i=>i===typename);if(index<0){throw["Unknown type filter ",typename]}return index}function getStringElem(query,parserState,isInGenerics){if(isInGenerics){throw["Unexpected ","\""," in generics"]}else if(query.literalSearch){throw["Cannot have more than one literal search element"]}else if(parserState.totalElems-parserState.genericsElems>0){throw["Cannot use literal search when there is more than one element"]}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw["Unclosed ","\""]}else if(parserState.userQuery[end]!=="\""){throw["Unexpected ",parserState.userQuery[end]," in a string element"]}else if(start===end){throw["Cannot have empty string element"]}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","}function isPathSeparator(c){return c===":"||isWhitespace(c)}function prevIs(parserState,lookingFor){let pos=parserState.pos;while(pos>0){const c=parserState.userQuery[pos-1];if(c===lookingFor){return true}else if(!isWhitespace(c)){break}pos-=1}return false}function isLastElemGeneric(elems,parserState){return(elems.length>0&&elems[elems.length-1].generics.length>0)||prevIs(parserState,">")}function skipWhitespace(parserState){while(parserState.pos0){throw["Cannot have more than one element if you use quotes"]}const typeFilter=parserState.typeFilter;parserState.typeFilter=null;if(name==="!"){if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive never type ","!"," and ",typeFilter," both specified",]}if(generics.length!==0){throw["Never type ","!"," does not accept generic parameters",]}return{name:"never",id:-1,fullPath:["never"],pathWithoutLast:[],pathLast:"never",generics:[],typeFilter:"primitive",}}if(path.startsWith("::")){throw["Paths cannot start with ","::"]}else if(path.endsWith("::")){throw["Paths cannot end with ","::"]}else if(path.includes("::::")){throw["Unexpected ","::::"]}else if(path.includes(" ::")){throw["Unexpected "," ::"]}else if(path.includes(":: ")){throw["Unexpected ",":: "]}const pathSegments=path.split(/::|\s+/);if(pathSegments.length===0||(pathSegments.length===1&&pathSegments[0]==="")){if(generics.length>0||prevIs(parserState,">")){throw["Found generics without a path"]}else{throw["Unexpected ",parserState.userQuery[parserState.pos]]}}for(const[i,pathSegment]of pathSegments.entries()){if(pathSegment==="!"){if(i!==0){throw["Never type ","!"," is not associated item"]}pathSegments[i]="never"}}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1}return{name:name.trim(),id:-1,fullPath:pathSegments,pathWithoutLast:pathSegments.slice(0,pathSegments.length-1),pathLast:pathSegments[pathSegments.length-1],generics:generics,typeFilter,}}function getIdentEndPosition(parserState){const start=parserState.pos;let end=parserState.pos;let foundExclamation=-1;while(parserState.pos=end){throw["Found generics without a path"]}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}if(isStringElem){skipWhitespace(parserState)}if(start>=end&&generics.length===0){return}elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;let start=parserState.pos;const oldTypeFilter=parserState.typeFilter;parserState.typeFilter=null;let extra="";if(endChar===">"){extra="<"}else if(endChar==="]"){extra="["}else if(endChar===""){extra="->"}else{extra=endChar}while(parserState.pos"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(endChar!==""){throw["Expected ",","," or ",endChar,...extra,", found ",c,]}throw["Expected ",",",...extra,", found ",c,]}const posBefore=parserState.pos;start=parserState.pos;getNextElem(query,parserState,elems,endChar!=="");if(endChar!==""&&parserState.pos>=parserState.length){throw["Unclosed ",extra]}if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}if(parserState.pos>=parserState.length&&endChar!==""){throw["Unclosed ",extra]}parserState.pos+=1;parserState.typeFilter=oldTypeFilter}function checkExtraTypeFilterCharacters(start,parserState){const query=parserState.userQuery.slice(start,parserState.pos).trim();for(const c in query){if(!isIdentCharacter(query[c])){throw["Unexpected ",query[c]," in type filter (before ",":",")",]}}}function parseInput(query,parserState){let foundStopChar=true;let start=parserState.pos;while(parserState.pos"){if(isReturnArrow(parserState)){break}throw["Unexpected ",c," (did you mean ","->","?)"]}throw["Unexpected ",c]}else if(c===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}else if(query.elems.length===0){throw["Expected type filter before ",":"]}else if(query.literalSearch){throw["Cannot use quotes on type filter"]}const typeFilterElem=query.elems.pop();checkExtraTypeFilterCharacters(start,parserState);parserState.typeFilter=typeFilterElem.name;parserState.pos+=1;parserState.totalElems-=1;query.literalSearch=false;foundStopChar=true;continue}else if(isWhitespace(c)){skipWhitespace(parserState);continue}if(!foundStopChar){let extra="";if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(parserState.typeFilter!==null){throw["Expected ",","," or ","->",...extra,", found ",c,]}throw["Expected ",",",", ",":"," or ","->",...extra,", found ",c,]}const before=query.elems.length;start=parserState.pos;getNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}while(parserState.pos"]}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),elems:[],returned:[],foundElems:0,literalSearch:false,error:null,correction:null,}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return null}function parseQuery(userQuery){function convertTypeFilterOnElem(elem){if(elem.typeFilter!==null){let typeFilter=elem.typeFilter;if(typeFilter==="const"){typeFilter="constant"}elem.typeFilter=itemTypeFromName(typeFilter)}else{elem.typeFilter=NO_TYPE_FILTER}for(const elem2 of elem.generics){convertTypeFilterOnElem(elem2)}}userQuery=userQuery.trim();const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);for(const elem of query.elems){convertTypeFilterOnElem(elem)}for(const elem of query.returned){convertTypeFilterOnElem(elem)}}catch(err){query=newParsedQuery(userQuery);query.error=err;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,searchWords,filterCrates,currentCrate){const results_others=new Map(),results_in_args=new Map(),results_returned=new Map();function transformResults(results){const duplicates=new Set();const out=[];for(const result of results){if(result.id>-1){const obj=searchIndex[result.id];obj.dist=result.dist;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates.has(obj.fullPath)){continue}duplicates.add(obj.fullPath);obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){if(results.size===0){return[]}const userQuery=parsedQuery.userQuery;const result_list=[];for(const result of results.values()){result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};result_list.push(result)}result_list.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.path_dist;b=bbb.path_dist;if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}a=(aaa.dist);b=(bbb.dist);if(a!==b){return a-b}a=aaa.item.deprecated;b=bbb.item.deprecated;if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});let nameSplit=null;if(parsedQuery.elems.length===1){const hasPath=typeof parsedQuery.elems[0].path==="undefined";nameSplit=hasPath?null:parsedQuery.elems[0].path}for(const result of result_list){if(result.dontValidate){continue}const name=result.item.name.toLowerCase(),path=result.item.path.toLowerCase(),parent=result.item.parent;if(!isType&&!validateResult(name,path,nameSplit,parent)){result.id=-1}}return transformResults(result_list)}function checkGenerics(fnType,queryElem){return unifyFunctionTypes(fnType.generics,queryElem.generics)}function unifyFunctionTypes(fnTypes,queryElems){if(queryElems.length===0){return true}if(!fnTypes||fnTypes.length===0){return false}const queryElemSet=new Map();const addQueryElemToQueryElemSet=function addQueryElemToQueryElemSet(queryElem){let currentQueryElemList;if(queryElemSet.has(queryElem.id)){currentQueryElemList=queryElemSet.get(queryElem.id)}else{currentQueryElemList=[];queryElemSet.set(queryElem.id,currentQueryElemList)}currentQueryElemList.push(queryElem)};for(const queryElem of queryElems){addQueryElemToQueryElemSet(queryElem)}const fnTypeSet=new Map();const addFnTypeToFnTypeSet=function addFnTypeToFnTypeSet(fnType){const queryContainsArrayOrSliceElem=queryElemSet.has(typeNameIdOfArrayOrSlice);if(fnType.id===-1||!(queryElemSet.has(fnType.id)||(fnType.id===typeNameIdOfSlice&&queryContainsArrayOrSliceElem)||(fnType.id===typeNameIdOfArray&&queryContainsArrayOrSliceElem))){for(const innerFnType of fnType.generics){addFnTypeToFnTypeSet(innerFnType)}return}let currentQueryElemList=queryElemSet.get(fnType.id)||[];let matchIdx=currentQueryElemList.findIndex(queryElem=>{return typePassesFilter(queryElem.typeFilter,fnType.ty)&&checkGenerics(fnType,queryElem)});if(matchIdx===-1&&(fnType.id===typeNameIdOfSlice||fnType.id===typeNameIdOfArray)&&queryContainsArrayOrSliceElem){currentQueryElemList=queryElemSet.get(typeNameIdOfArrayOrSlice)||[];matchIdx=currentQueryElemList.findIndex(queryElem=>{return typePassesFilter(queryElem.typeFilter,fnType.ty)&&checkGenerics(fnType,queryElem)})}if(matchIdx===-1){for(const innerFnType of fnType.generics){addFnTypeToFnTypeSet(innerFnType)}return}let currentFnTypeList;if(fnTypeSet.has(fnType.id)){currentFnTypeList=fnTypeSet.get(fnType.id)}else{currentFnTypeList=[];fnTypeSet.set(fnType.id,currentFnTypeList)}currentFnTypeList.push(fnType)};for(const fnType of fnTypes){addFnTypeToFnTypeSet(fnType)}const doHandleQueryElemList=(currentFnTypeList,queryElemList)=>{if(queryElemList.length===0){return true}const queryElem=queryElemList.pop();const l=currentFnTypeList.length;for(let i=0;i{if(!fnTypeSet.has(id)){if(id===typeNameIdOfArrayOrSlice){return handleQueryElemList(typeNameIdOfSlice,queryElemList)||handleQueryElemList(typeNameIdOfArray,queryElemList)}return false}const currentFnTypeList=fnTypeSet.get(id);if(currentFnTypeList.length0?checkIfInList(row.generics,elem):false}const matchesExact=row.id===elem.id;const matchesArrayOrSlice=elem.id===typeNameIdOfArrayOrSlice&&(row.id===typeNameIdOfSlice||row.id===typeNameIdOfArray);if((matchesExact||matchesArrayOrSlice)&&typePassesFilter(elem.typeFilter,row.ty)){if(elem.generics.length>0){return checkGenerics(row,elem)}return true}return checkIfInList(row.generics,elem)}function checkPath(contains,ty,maxEditDistance){if(contains.length===0){return 0}let ret_dist=maxEditDistance+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;if(clength>length){return maxEditDistance+1}for(let i=0;ilength){break}let dist_total=0;let aborted=false;for(let x=0;xmaxEditDistance){aborted=true;break}dist_total+=dist}if(!aborted){ret_dist=Math.min(ret_dist,Math.round(dist_total/clength))}}return ret_dist}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,deprecated:item.deprecated,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES.has(filterCrates)&&ALIASES.get(filterCrates).has(lowerQuery)){const query_aliases=ALIASES.get(filterCrates).get(lowerQuery);for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{for(const[crate,crateAliasesIndex]of ALIASES){if(crateAliasesIndex.has(lowerQuery)){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=crateAliasesIndex.get(lowerQuery);for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}}}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,dist,path_dist,maxEditDistance){const inBounds=dist<=maxEditDistance||index!==-1;if(dist===0||(!parsedQuery.literalSearch&&inBounds)){if(results.has(fullId)){const result=results.get(fullId);if(result.dontValidate||result.dist<=dist){return}}results.set(fullId,{id:id,index:index,dontValidate:parsedQuery.literalSearch,dist:dist,path_dist:path_dist,})}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned,maxEditDistance){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let index=-1,path_dist=0;const fullId=row.id;const searchWord=searchWords[pos];const in_args=row.type&&row.type.inputs&&checkIfInList(row.type.inputs,elem);if(in_args){addIntoResults(results_in_args,fullId,pos,-1,0,0,maxEditDistance)}const returned=row.type&&row.type.output&&checkIfInList(row.type.output,elem);if(returned){addIntoResults(results_returned,fullId,pos,-1,0,0,maxEditDistance)}if(!typePassesFilter(elem.typeFilter,row.ty)){return}const row_index=row.normalizedName.indexOf(elem.pathLast);const word_index=searchWord.indexOf(elem.pathLast);if(row_index===-1){index=word_index}else if(word_index===-1){index=row_index}else if(word_index1){path_dist=checkPath(elem.pathWithoutLast,row,maxEditDistance);if(path_dist>maxEditDistance){return}}if(parsedQuery.literalSearch){if(searchWord===elem.name){addIntoResults(results_others,fullId,pos,index,0,path_dist)}return}const dist=editDistance(searchWord,elem.pathLast,maxEditDistance);if(index===-1&&dist+path_dist>maxEditDistance){return}addIntoResults(results_others,fullId,pos,index,dist,path_dist,maxEditDistance)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)||!row.type){return}if(!unifyFunctionTypes(row.type.inputs,parsedQuery.elems)){return}if(!unifyFunctionTypes(row.type.output,parsedQuery.returned)){return}addIntoResults(results,row.id,pos,0,0,0,Number.MAX_VALUE)}function innerRunQuery(){let elem,i,nSearchWords,in_returned,row;let queryLen=0;for(const elem of parsedQuery.elems){queryLen+=elem.name.length}for(const elem of parsedQuery.returned){queryLen+=elem.name.length}const maxEditDistance=Math.floor(queryLen/3);function convertNameToId(elem){if(typeNameIdMap.has(elem.name)){elem.id=typeNameIdMap.get(elem.name)}else if(!parsedQuery.literalSearch){let match=-1;let matchDist=maxEditDistance+1;let matchName="";for(const[name,id]of typeNameIdMap){const dist=editDistance(name,elem.name,maxEditDistance);if(dist<=matchDist&&dist<=maxEditDistance){if(dist===matchDist&&matchName>name){continue}match=id;matchDist=dist;matchName=name}}if(match!==-1){parsedQuery.correction=matchName}elem.id=match}for(const elem2 of elem.generics){convertNameToId(elem2)}}for(const elem of parsedQuery.elems){convertNameToId(elem)}for(const elem of parsedQuery.returned){convertNameToId(elem)}if(parsedQuery.foundElems===1){if(parsedQuery.elems.length===1){elem=parsedQuery.elems[0];for(i=0,nSearchWords=searchWords.length;i0){for(i=0,nSearchWords=searchWords.length;i-1||path.indexOf(key)>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(key)>-1)||editDistance(name,key,maxEditDistance)<=maxEditDistance)){return false}}return true}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#search-tabs button").item(searchState.currentTab);searchState.focusedByTab[searchState.currentTab]=null;if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor="#"+type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="#variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){let extraClass="";if(display===true){extraClass=" active"}const output=document.createElement("div");let length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];const longType=longItemTypes[item.ty];const typeName=longType.length!==0?`${longType}`:"?";length+=1;const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const resultName=document.createElement("div");resultName.className="result-name";if(item.is_alias){const alias=document.createElement("span");alias.className="alias";const bold=document.createElement("b");bold.innerText=item.alias;alias.appendChild(bold);alias.insertAdjacentHTML("beforeend"," - see ");resultName.appendChild(alias)}resultName.insertAdjacentHTML("beforeend",`\ +${typeName}\ +
\ + ${item.displayPath}${name}\ +
`);link.appendChild(resultName);const description=document.createElement("div");description.className="desc";description.insertAdjacentHTML("beforeend",item.desc);link.appendChild(description);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true")){window.onunload=()=>{};searchState.removeQueryParameters();const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";const crates_list=Object.keys(rawSearchIndex);if(crates_list.length>1){crates=" in 
"}let output=`

Results${crates}

`;if(results.query.error!==null){const error=results.query.error;error.forEach((value,index)=>{value=value.split("<").join("<").split(">").join(">");if(index%2!==0){error[index]=`${value.replaceAll(" ", " ")}`}else{error[index]=value}});output+=`

Query parser error: "${error.join("")}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}if(results.query.correction!==null){const orig=results.query.returned.length>0?results.query.returned[0].name:results.query.elems[0].name;output+="

"+`Type "${orig}" not found. `+"Showing results for closest type name "+`"${results.query.correction}" instead.

`}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("search-tabs").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function updateSearchHistory(url){if(!browserSupportsHistoryApi()){return}const params=searchState.getQueryStringParams();if(!history.state&&!params.search){history.pushState(null,"",url)}else{history.replaceState(null,"",url)}}function search(e,forced){if(e){e.preventDefault()}const query=parseQuery(searchState.input.value.trim());let filterCrates=getFilterCrates();if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}searchState.setLoadingSearch();const params=searchState.getQueryStringParams();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";updateSearchHistory(buildUrl(query.original,filterCrates));showResults(execQuery(query,searchWords,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;return types.map(type=>{let pathIndex,generics;if(typeof type==="number"){pathIndex=type;generics=[]}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths)}return{id:pathIndex===0?-1:buildTypeMapIndex(lowercasePaths[pathIndex-1].name),ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:generics,}})}function buildFunctionSearchType(functionSearchType,lowercasePaths){const INPUTS_DATA=0;const OUTPUT_DATA=1;if(functionSearchType===0){return null}let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){const pathIndex=functionSearchType[INPUTS_DATA];inputs=[{id:pathIndex===0?-1:buildTypeMapIndex(lowercasePaths[pathIndex-1].name),ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:[],}]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){const pathIndex=functionSearchType[OUTPUT_DATA];output=[{id:pathIndex===0?-1:buildTypeMapIndex(lowercasePaths[pathIndex-1].name),ty:pathIndex===0?null:lowercasePaths[pathIndex-1].ty,generics:[],}]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths)}}else{output=[]}return{inputs,output,}}function buildIndex(rawSearchIndex){searchIndex=[];const searchWords=[];typeNameIdMap=new Map();const charA="A".charCodeAt(0);let currentIndex=0;let id=0;typeNameIdOfArray=buildTypeMapIndex("array");typeNameIdOfSlice=buildTypeMapIndex("slice");typeNameIdOfArrayOrSlice=buildTypeMapIndex("[]");for(const crate in rawSearchIndex){if(!hasOwnPropertyRustdoc(rawSearchIndex,crate)){continue}let crateSize=0;const crateCorpus=rawSearchIndex[crate];searchWords.push(crate);const crateRow={crate:crate,ty:1,name:crate,path:"",desc:crateCorpus.doc,parent:undefined,type:null,id:id,normalizedName:crate.indexOf("_")===-1?crate:crate.replace(/_/g,""),deprecated:null,};id+=1;searchIndex.push(crateRow);currentIndex+=1;const itemTypes=crateCorpus.t;const itemNames=crateCorpus.n;const itemPaths=new Map(crateCorpus.q);const itemDescs=crateCorpus.d;const itemParentIdxs=crateCorpus.i;const itemFunctionSearchTypes=crateCorpus.f;const deprecatedItems=new Set(crateCorpus.c);const paths=crateCorpus.p;const aliases=crateCorpus.a;const lowercasePaths=[];let len=paths.length;for(let i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:buildFunctionSearchType(itemFunctionSearchTypes[i],lowercasePaths),id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),deprecated:deprecatedItems.has(i),};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){const currentCrateAliases=new Map();ALIASES.set(crate,currentCrateAliases);for(const alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}let currentNameAliases;if(currentCrateAliases.has(alias_name)){currentNameAliases=currentCrateAliases.get(alias_name)}else{currentNameAliases=[];currentCrateAliases.set(alias_name,currentNameAliases)}for(const local_alias of aliases[alias_name]){currentNameAliases.push(local_alias+currentIndex)}}}currentIndex+=crateSize}return searchWords}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="all crates"){const query=searchState.input.value.trim();updateSearchHistory(buildUrl(query,null))}currentResults=null;search(undefined,true)}const searchWords=buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}return searchWords}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch({})}})() \ No newline at end of file diff --git a/0.10.40/static.files/settings-8c76f75bfb6bd192.css b/0.10.40/static.files/settings-8c76f75bfb6bd192.css new file mode 100644 index 000000000..5241bb861 --- /dev/null +++ b/0.10.40/static.files/settings-8c76f75bfb6bd192.css @@ -0,0 +1,3 @@ +.setting-line{margin:1.2em 0.6em;}.setting-radio input,.setting-check input{margin-right:0.3em;height:1.2rem;width:1.2rem;border:2px solid var(--settings-input-border-color);outline:none;-webkit-appearance:none;cursor:pointer;}.setting-radio input{border-radius:50%;}.setting-radio span,.setting-check span{padding-bottom:1px;}.setting-radio{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:inline-flex;align-items:center;cursor:pointer;}.setting-radio+.setting-radio{margin-left:0.5em;}.setting-check{margin-right:20px;display:flex;align-items:center;cursor:pointer;}.setting-radio input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-check input:checked{background-color:var(--settings-input-color);border-width:1px;content:url('data:image/svg+xml,\ + \ + ');}.setting-radio input:focus,.setting-check input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-radio input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-radio input:hover,.setting-check input:hover{border-color:var(--settings-input-color) !important;} \ No newline at end of file diff --git a/0.10.40/static.files/settings-de11bff964e9d4e5.js b/0.10.40/static.files/settings-de11bff964e9d4e5.js new file mode 100644 index 000000000..cc508a861 --- /dev/null +++ b/0.10.40/static.files/settings-de11bff964e9d4e5.js @@ -0,0 +1,17 @@ +"use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function changeSetting(settingName,value){if(settingName==="theme"){const useSystem=value==="system preference"?"true":"false";updateLocalStorage("use-system-theme",useSystem)}updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":updateTheme();updateLightAndDark();break;case"line-numbers":if(value===true){window.rustdoc_add_line_numbers_to_examples()}else{window.rustdoc_remove_line_numbers_from_examples()}break}}function showLightAndDark(){removeClass(document.getElementById("preferred-light-theme"),"hidden");removeClass(document.getElementById("preferred-dark-theme"),"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme"),"hidden");addClass(document.getElementById("preferred-dark-theme"),"hidden")}function updateLightAndDark(){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||(useSystem===null&&getSettingValue("theme")===null)){showLightAndDark()}else{hideLightAndDark()}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.querySelectorAll("input[type=\"checkbox\"]"),toggle=>{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=function(){changeSetting(this.id,this.checked)}});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){settingValue=useSystem==="false"?"light":"system preference"}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",ev=>{changeSetting(ev.target.name,ev.target.value)})})}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ +
+
${setting_name}
+
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ + `});output+=`\ +
+
`}else{const checked=setting["default"]===true?" checked":"";output+=`\ +
\ + \ +
`}}return output}function buildSettingsPage(){const theme_names=getVar("themes").split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover"}el.innerHTML=innerHTML;if(isSettingsPage){document.getElementById(MAIN_ID).appendChild(el)}else{el.setAttribute("tabindex","-1");getSettingsButton().appendChild(el)}return el}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display=""}function settingsBlurHandler(event){blurHandler(event,getSettingsButton(),window.hidePopoverMenus)}if(isSettingsPage){getSettingsButton().onclick=function(event){event.preventDefault()}}else{const settingsButton=getSettingsButton();const settingsMenu=document.getElementById("settings");settingsButton.onclick=function(event){if(elemIsInParent(event.target,settingsMenu)){return}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals();if(shouldDisplaySettings){displaySettings()}};settingsButton.onblur=settingsBlurHandler;settingsButton.querySelector("a").onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler});settingsMenu.onblur=settingsBlurHandler}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings()}removeClass(getSettingsButton(),"rotate")},0)})() \ No newline at end of file diff --git a/0.10.40/static.files/source-script-106908c7a7964ba4.js b/0.10.40/static.files/source-script-106908c7a7964ba4.js new file mode 100644 index 000000000..191bf6d99 --- /dev/null +++ b/0.10.40/static.files/source-script-106908c7a7964ba4.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=getVar("root-path");const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;const RUSTDOC_MOBILE_BREAKPOINT=700;function closeSidebarIfMobile(){if(window.innerWidth"){addClass(document.documentElement,"source-sidebar-expanded");child.innerText="<";updateLocalStorage("source-sidebar-show","true")}else{removeClass(document.documentElement,"source-sidebar-expanded");child.innerText=">";updateLocalStorage("source-sidebar-show","false")}}function createSidebarToggle(){const sidebarToggle=document.createElement("div");sidebarToggle.id="src-sidebar-toggle";const inner=document.createElement("button");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}inner.onclick=toggleSidebar;sidebarToggle.appendChild(inner);return sidebarToggle}function createSourceSidebar(){const container=document.querySelector("nav.sidebar");const sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);const sidebar=document.createElement("div");sidebar.id="source-sidebar";let hasFoundFile=false;const title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(sourcesIndex).forEach(key=>{sourcesIndex[key][NAME_OFFSET]=key;hasFoundFile=createDirEntry(sourcesIndex[key],sidebar,"",hasFoundFile)});container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}const lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSourceLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("a"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSourceHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSourceLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",()=>{const match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSourceLines(match)}});onEachLazy(document.getElementsByClassName("src-line-numbers"),el=>{el.addEventListener("click",handleSourceHighlight)});highlightSourceLines();window.createSourceSidebar=createSourceSidebar})() \ No newline at end of file diff --git a/0.10.40/static.files/storage-59fd9b8ccb335783.js b/0.10.40/static.files/storage-59fd9b8ccb335783.js new file mode 100644 index 000000000..ca5481acb --- /dev/null +++ b/0.10.40/static.files/storage-59fd9b8ccb335783.js @@ -0,0 +1 @@ +"use strict";const darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");return settingsElement&&settingsElement.dataset?settingsElement.dataset:null})();function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current===null&&settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def}}return current}const localStoredTheme=getSettingValue("theme");function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(elem&&elem.classList){elem.classList.add(className)}}function removeClass(elem,className){if(elem&&elem.classList){elem.classList.remove(className)}}function onEach(arr,func,reversed){if(arr&&arr.length>0){if(reversed){for(let i=arr.length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(const elem of arr){if(func(elem)){return true}}}}return false}function onEachLazy(lazyArray,func,reversed){return onEach(Array.prototype.slice.call(lazyArray),func,reversed)}function updateLocalStorage(name,value){try{window.localStorage.setItem("rustdoc-"+name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name)}catch(e){return null}}const getVar=(function getVar(name){const el=document.querySelector("head > meta[name='rustdoc-vars']");return el?el.attributes["data-"+name].value:null});function switchTheme(newThemeName,saveTheme){if(saveTheme){updateLocalStorage("theme",newThemeName)}let newHref;if(newThemeName==="light"||newThemeName==="dark"||newThemeName==="ayu"){newHref=getVar("static-root-path")+getVar("theme-"+newThemeName+"-css")}else{newHref=getVar("root-path")+newThemeName+getVar("resource-suffix")+".css"}if(!window.currentTheme){document.write(``);window.currentTheme=document.getElementById("themeStyle")}else if(newHref!==window.currentTheme.href){window.currentTheme.href=newHref}}const updateTheme=(function(){const mql=window.matchMedia("(prefers-color-scheme: dark)");function updateTheme(){if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";updateLocalStorage("use-system-theme","true");switchTheme(mql.matches?darkTheme:lightTheme,true)}else{switchTheme(getSettingValue("theme"),false)}}mql.addEventListener("change",updateTheme);return updateTheme})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"source-sidebar-expanded")}window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0)}}) \ No newline at end of file diff --git a/0.10.40/static.files/wheel-7b819b6101059cd0.svg b/0.10.40/static.files/wheel-7b819b6101059cd0.svg new file mode 100644 index 000000000..83c07f63d --- /dev/null +++ b/0.10.40/static.files/wheel-7b819b6101059cd0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/0.4.0/.lock b/0.4.0/.lock new file mode 100755 index 000000000..e69de29bb diff --git a/0.4.0/COPYRIGHT.txt b/0.4.0/COPYRIGHT.txt new file mode 100644 index 000000000..8773ce6be --- /dev/null +++ b/0.4.0/COPYRIGHT.txt @@ -0,0 +1,64 @@ +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff, FiraSans-Medium.woff): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* Heuristica (Heuristica-Italic.woff): + + Copyright 1989, 1991 Adobe Systems Incorporated. All rights reserved. + Utopia is either a registered trademark or trademark of Adobe Systems + Incorporated in the United States and/or other countries. Used under + license. + + Copyright 2006 Han The Thanh, Vntopia font family, http://vntex.sf.net + + Copyright (c) 2008-2012, Andrey V. Panov (panov@canopus.iacp.dvo.ru), + with Reserved Font Name Heuristica. + + Licensed under the SIL Open Font License, Version 1.1. + See Heuristica-LICENSE.txt. + +* jQuery (jquery-2.1.4.min.js): + + Copyright 2005, 2015 jQuery Foundation, Inc. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.woff, SourceCodePro-Semibold.woff): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif Pro (SourceSerifPro-Regular.woff, SourceSerifPro-Bold.woff): + + Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/), with + Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of + Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerifPro-LICENSE.txt. + +This copyright file is intended to be distributed with rustdoc output. diff --git a/0.4.0/FiraSans-LICENSE.txt b/0.4.0/FiraSans-LICENSE.txt new file mode 100644 index 000000000..b4a39671e --- /dev/null +++ b/0.4.0/FiraSans-LICENSE.txt @@ -0,0 +1,99 @@ +Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ +with Reserved Font Name Fira Sans. + +Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ +with Reserved Font Name Fira Mono. + +Copyright (c) 2014, Telefonica S.A. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.4.0/FiraSans-Medium.woff b/0.4.0/FiraSans-Medium.woff new file mode 100644 index 000000000..562722774 Binary files /dev/null and b/0.4.0/FiraSans-Medium.woff differ diff --git a/0.4.0/FiraSans-Regular.woff b/0.4.0/FiraSans-Regular.woff new file mode 100644 index 000000000..9ff40445b Binary files /dev/null and b/0.4.0/FiraSans-Regular.woff differ diff --git a/0.4.0/Heuristica-Italic.woff b/0.4.0/Heuristica-Italic.woff new file mode 100644 index 000000000..b0cebf01d Binary files /dev/null and b/0.4.0/Heuristica-Italic.woff differ diff --git a/0.4.0/Heuristica-LICENSE.txt b/0.4.0/Heuristica-LICENSE.txt new file mode 100644 index 000000000..dd85e40e6 --- /dev/null +++ b/0.4.0/Heuristica-LICENSE.txt @@ -0,0 +1,101 @@ +Copyright 1989, 1991 Adobe Systems Incorporated. All rights reserved. +Utopia is either a registered trademark or trademark of Adobe Systems +Incorporated in the United States and/or other countries. Used under +license. + +Copyright 2006 Han The Thanh, Vntopia font family, http://vntex.sf.net + +Copyright (c) 2008-2012, Andrey V. Panov (panov@canopus.iacp.dvo.ru), +with Reserved Font Name Heuristica. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.4.0/LICENSE-APACHE.txt b/0.4.0/LICENSE-APACHE.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/0.4.0/LICENSE-APACHE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/0.4.0/LICENSE-MIT.txt b/0.4.0/LICENSE-MIT.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/0.4.0/LICENSE-MIT.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/0.4.0/SourceCodePro-LICENSE.txt b/0.4.0/SourceCodePro-LICENSE.txt new file mode 100644 index 000000000..07542572e --- /dev/null +++ b/0.4.0/SourceCodePro-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.4.0/SourceCodePro-Regular.woff b/0.4.0/SourceCodePro-Regular.woff new file mode 100644 index 000000000..557667090 Binary files /dev/null and b/0.4.0/SourceCodePro-Regular.woff differ diff --git a/0.4.0/SourceCodePro-Semibold.woff b/0.4.0/SourceCodePro-Semibold.woff new file mode 100644 index 000000000..ca972a11d Binary files /dev/null and b/0.4.0/SourceCodePro-Semibold.woff differ diff --git a/0.4.0/SourceSerifPro-Bold.woff b/0.4.0/SourceSerifPro-Bold.woff new file mode 100644 index 000000000..ac1b1b3a0 Binary files /dev/null and b/0.4.0/SourceSerifPro-Bold.woff differ diff --git a/0.4.0/SourceSerifPro-LICENSE.txt b/0.4.0/SourceSerifPro-LICENSE.txt new file mode 100644 index 000000000..b77d653ad --- /dev/null +++ b/0.4.0/SourceSerifPro-LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/0.4.0/SourceSerifPro-Regular.woff b/0.4.0/SourceSerifPro-Regular.woff new file mode 100644 index 000000000..e8c43b852 Binary files /dev/null and b/0.4.0/SourceSerifPro-Regular.woff differ diff --git a/0.4.0/chemfiles/atom/enum.AtomType.html b/0.4.0/chemfiles/atom/enum.AtomType.html new file mode 100644 index 000000000..96f318b3e --- /dev/null +++ b/0.4.0/chemfiles/atom/enum.AtomType.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.AtomType.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/atom/index.html b/0.4.0/chemfiles/atom/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/atom/sidebar-items.js b/0.4.0/chemfiles/atom/sidebar-items.js new file mode 100644 index 000000000..424895982 --- /dev/null +++ b/0.4.0/chemfiles/atom/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["AtomType","Available types of atoms"]],"struct":[["Atom","An Atom is a particle in the current Frame. It can be used to store and retrieve informations about a particle, such as mass, name, atomic number, *etc.*"]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/atom/struct.Atom.html b/0.4.0/chemfiles/atom/struct.Atom.html new file mode 100644 index 000000000..fce480c69 --- /dev/null +++ b/0.4.0/chemfiles/atom/struct.Atom.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Atom.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/cell/enum.CellType.html b/0.4.0/chemfiles/cell/enum.CellType.html new file mode 100644 index 000000000..6b1bd07a6 --- /dev/null +++ b/0.4.0/chemfiles/cell/enum.CellType.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.CellType.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/cell/index.html b/0.4.0/chemfiles/cell/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/cell/sidebar-items.js b/0.4.0/chemfiles/cell/sidebar-items.js new file mode 100644 index 000000000..71dc4b23c --- /dev/null +++ b/0.4.0/chemfiles/cell/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["CellType","Available unit cell types"]],"struct":[["UnitCell","An `UnitCell` represent the box containing the atoms in the system, and its periodicity."]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/cell/struct.UnitCell.html b/0.4.0/chemfiles/cell/struct.UnitCell.html new file mode 100644 index 000000000..cddcfc6bf --- /dev/null +++ b/0.4.0/chemfiles/cell/struct.UnitCell.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.UnitCell.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/enum.AtomType.html b/0.4.0/chemfiles/enum.AtomType.html new file mode 100644 index 000000000..087f28cf2 --- /dev/null +++ b/0.4.0/chemfiles/enum.AtomType.html @@ -0,0 +1,130 @@ + + + + + + + + + + chemfiles::AtomType - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles::AtomType + + [] + + [src]

+
pub enum AtomType {
+    Element,
+    CorseGrain,
+    Dummy,
+    Undefined,
+}

Available types of atoms

+

Variants

+
Element

Element from the periodic table of elements

+
CorseGrain

Corse-grained atom are composed of more than one element: CH3 groups, +amino-acids are corse-grained atoms.

+
Dummy

Dummy site, with no physical reality

+
Undefined

Undefined atom type

+

Trait Implementations

impl From<CHFL_ATOM_TYPE> for AtomType

fn from(atomtype: CHFL_ATOM_TYPE) -> AtomType

+

Derived Implementations

impl Eq for AtomType

impl PartialEq for AtomType

fn eq(&self, __arg_0: &AtomType) -> bool

+

1.0.0fn ne(&self, other: &Rhs) -> bool

+

impl Debug for AtomType

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for AtomType

fn clone(&self) -> AtomType

+

1.0.0fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/enum.CellType.html b/0.4.0/chemfiles/enum.CellType.html new file mode 100644 index 000000000..8314d1919 --- /dev/null +++ b/0.4.0/chemfiles/enum.CellType.html @@ -0,0 +1,127 @@ + + + + + + + + + + chemfiles::CellType - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles::CellType + + [] + + [src]

+
pub enum CellType {
+    Orthorombic,
+    Triclinic,
+    Infinite,
+}

Available unit cell types

+

Variants

+
Orthorombic

Orthorombic cell, with the three angles equals to 90°

+
Triclinic

Triclinic cell, with any values for the angles.

+
Infinite

Infinite cell, to use when there is no cell.

+

Trait Implementations

impl From<CHFL_CELL_TYPE> for CellType

fn from(celltype: CHFL_CELL_TYPE) -> CellType

+

Derived Implementations

impl Eq for CellType

impl PartialEq for CellType

fn eq(&self, __arg_0: &CellType) -> bool

+

1.0.0fn ne(&self, other: &Rhs) -> bool

+

impl Debug for CellType

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for CellType

fn clone(&self) -> CellType

+

1.0.0fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/enum.Error.html b/0.4.0/chemfiles/enum.Error.html new file mode 100644 index 000000000..8f5f86d54 --- /dev/null +++ b/0.4.0/chemfiles/enum.Error.html @@ -0,0 +1,151 @@ + + + + + + + + + + chemfiles::Error - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles::Error + + [] + + [src]

+
pub enum Error {
+    CppStdError {
+        message: String,
+    },
+    ChemfilesCppError {
+        message: String,
+    },
+    MemoryError,
+    FileError,
+    FormatError,
+    UTF8PathError {
+        message: String,
+    },
+}

Possible causes of error in chemfiles

+

Variants

+
CppStdError

Exception in the C++ standard library

+

Fields

+ +
message

A message describing the error cause

+
ChemfilesCppError

Exception in the C++ chemfiles library

+

Fields

+ +
message

A message describing the error cause

+
MemoryError

Error in memory allocations

+
FileError

Error while reading or writing a file

+
FormatError

Error in file formatting, i.e. the file is invalid

+
UTF8PathError

The given path is not valid UTF8

+

Fields

+ +
message

Methods

impl Error

fn message(&self) -> String

+

Get the message associated with this error.

+

fn last_error() -> String

+

Get the last error message.

+

Trait Implementations

impl From<CHFL_STATUS> for Error

fn from(status: CHFL_STATUS) -> Error

+

Derived Implementations

impl PartialEq for Error

fn eq(&self, __arg_0: &Error) -> bool

+

fn ne(&self, __arg_0: &Error) -> bool

+

impl Debug for Error

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for Error

fn clone(&self) -> Error

+

1.0.0fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/enum.ErrorKind.html b/0.4.0/chemfiles/enum.ErrorKind.html new file mode 100644 index 000000000..256308760 --- /dev/null +++ b/0.4.0/chemfiles/enum.ErrorKind.html @@ -0,0 +1,136 @@ + + + + + + + + + + chemfiles::ErrorKind - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles::ErrorKind + + [] + + [src]

+
pub enum ErrorKind {
+    CppStdError,
+    ChemfilesCppError,
+    MemoryError,
+    FileError,
+    FormatError,
+    SelectionError,
+    UTF8PathError,
+    NullPtr,
+}

Possible causes of error in chemfiles

+

Variants

+
CppStdError

Exception in the C++ standard library

+
ChemfilesCppError

Exception in the C++ chemfiles library

+
MemoryError

Error in memory allocations

+
FileError

Error while reading or writing a file

+
FormatError

Error in file formatting, i.e. the file is invalid

+
SelectionError

Error in selection string syntax

+
UTF8PathError

The given path is not valid UTF8

+
NullPtr

We got a null pointer from C++

+

Trait Implementations

Derived Implementations

impl PartialEq for ErrorKind

fn eq(&self, __arg_0: &ErrorKind) -> bool

+

1.0.0fn ne(&self, other: &Rhs) -> bool

+

impl Debug for ErrorKind

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for ErrorKind

fn clone(&self) -> ErrorKind

+

1.0.0fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/enum.LogLevel.html b/0.4.0/chemfiles/enum.LogLevel.html new file mode 100644 index 000000000..379cbe678 --- /dev/null +++ b/0.4.0/chemfiles/enum.LogLevel.html @@ -0,0 +1,129 @@ + + + + + + + + + + chemfiles::LogLevel - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles::LogLevel + + [] + + [src]

+
pub enum LogLevel {
+    Error,
+    Warning,
+    Info,
+    Debug,
+}

Available log levels

+

Variants

+
Error

Only log errors

+
Warning

Log errors and warnings

+
Info

Log errors, warnings and informations

+
Debug

Log everything (errors, warnings, informations and debug informations)

+

Trait Implementations

impl From<CHFL_LOG_LEVEL> for LogLevel

fn from(level: CHFL_LOG_LEVEL) -> LogLevel

+

Derived Implementations

impl PartialEq for LogLevel

fn eq(&self, __arg_0: &LogLevel) -> bool

+

1.0.0fn ne(&self, other: &Rhs) -> bool

+

impl Debug for LogLevel

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for LogLevel

fn clone(&self) -> LogLevel

+

1.0.0fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/errors/enum.Error.html b/0.4.0/chemfiles/errors/enum.Error.html new file mode 100644 index 000000000..af7ef8d07 --- /dev/null +++ b/0.4.0/chemfiles/errors/enum.Error.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.Error.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/errors/enum.ErrorKind.html b/0.4.0/chemfiles/errors/enum.ErrorKind.html new file mode 100644 index 000000000..cd236a770 --- /dev/null +++ b/0.4.0/chemfiles/errors/enum.ErrorKind.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/enum.ErrorKind.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/errors/index.html b/0.4.0/chemfiles/errors/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/errors/sidebar-items.js b/0.4.0/chemfiles/errors/sidebar-items.js new file mode 100644 index 000000000..2b0a9b1b1 --- /dev/null +++ b/0.4.0/chemfiles/errors/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["Error","Possible causes of error in chemfiles"]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/errors/struct.Error.html b/0.4.0/chemfiles/errors/struct.Error.html new file mode 100644 index 000000000..413e6df25 --- /dev/null +++ b/0.4.0/chemfiles/errors/struct.Error.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Error.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/fn.version.html b/0.4.0/chemfiles/fn.version.html new file mode 100644 index 000000000..69c870a2d --- /dev/null +++ b/0.4.0/chemfiles/fn.version.html @@ -0,0 +1,113 @@ + + + + + + + + + + chemfiles::version - Rust + + + + + + + + + + + + + + + + + +
+

Function chemfiles::version + + [] + + [src]

+
pub fn version() -> String

Get the version of the chemfiles library

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/frame/index.html b/0.4.0/chemfiles/frame/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/frame/sidebar-items.js b/0.4.0/chemfiles/frame/sidebar-items.js new file mode 100644 index 000000000..b9a01cc3a --- /dev/null +++ b/0.4.0/chemfiles/frame/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["Frame","A `Frame` holds data from one step of a simulation: the current `Topology`, the positions, and maybe the velocities of the particles in the system."]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/frame/struct.Frame.html b/0.4.0/chemfiles/frame/struct.Frame.html new file mode 100644 index 000000000..0bcf1ad5e --- /dev/null +++ b/0.4.0/chemfiles/frame/struct.Frame.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Frame.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/index.html b/0.4.0/chemfiles/index.html new file mode 100644 index 000000000..735e392fa --- /dev/null +++ b/0.4.0/chemfiles/index.html @@ -0,0 +1,203 @@ + + + + + + + + + + chemfiles - Rust + + + + + + + + + + + + + + + + + +
+

Crate chemfiles + + [] + + [src]

+

Chemfiles is a multi-language library written in modern C++ for reading and +writing from and to molecular trajectory files. These files are created by +your favorite theoretical chemistry program, and contains informations about +atomic or residues names and positions. Some format also have additional +informations, such as velocities, forces, energy, …

+ +

This crate expose the C API of chemfiles to Rust, and make all the +functionalities accessibles. For more informations on the C++ library, +please see its documentation. Specifically, the +following pages are worth reading:

+ + + +

As all the function call the underlying C library, they all can fail and +thus all return a Result<_, Error> value.

+

Modules

+ + + + +
logging +

Logging utilities

+

Structs

+ + + + + + + + + + + + + + + + + + + + +
Atom +

An Atom is a particle in the current Frame. It can be used to store and +retrieve informations about a particle, such as mass, name, atomic number, +etc.

+
Frame +

A Frame holds data from one step of a simulation: the current Topology, +the positions, and maybe the velocities of the particles in the system.

+
Topology +

A Topology contains the definition of all the particles in the system, and +the liaisons between the particles (bonds, angles, dihedrals, ...).

+
Trajectory +

A Trajectory is a chemistry file on the hard drive. It is the main entry +point of chemfiles.

+
UnitCell +

An UnitCell represent the box containing the atoms in the system, and its +periodicity.

+

Enums

+ + + + + + + + + + + + +
AtomType +

Available types of atoms

+
CellType +

Available unit cell types

+
Error +

Possible causes of error in chemfiles

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/logging/enum.LogLevel.html b/0.4.0/chemfiles/logging/enum.LogLevel.html new file mode 100644 index 000000000..59a0b1ccc --- /dev/null +++ b/0.4.0/chemfiles/logging/enum.LogLevel.html @@ -0,0 +1,131 @@ + + + + + + + + + + chemfiles::logging::LogLevel - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles::logging::LogLevel + + [] + + [src]

+
pub enum LogLevel {
+    NONE,
+    ERROR,
+    WARNING,
+    INFO,
+    DEBUG,
+}

Available log levels

+

Variants

+
NONE

Do not log anything

+
ERROR

Only log errors

+
WARNING

Log errors and warnings

+
INFO

Log errors, warnings and informations

+
DEBUG

Log everything (errors, warnings, informations and debug informations)

+

Trait Implementations

impl From<CHFL_LOG_LEVEL> for LogLevel

fn from(level: CHFL_LOG_LEVEL) -> LogLevel

+

Derived Implementations

impl PartialEq for LogLevel

fn eq(&self, __arg_0: &LogLevel) -> bool

+

1.0.0fn ne(&self, other: &Rhs) -> bool

+

impl Debug for LogLevel

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for LogLevel

fn clone(&self) -> LogLevel

+

1.0.0fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/logging/fn.level.html b/0.4.0/chemfiles/logging/fn.level.html new file mode 100644 index 000000000..e450cae34 --- /dev/null +++ b/0.4.0/chemfiles/logging/fn.level.html @@ -0,0 +1,113 @@ + + + + + + + + + + chemfiles::logging::level - Rust + + + + + + + + + + + + + + + + + +
+

Function chemfiles::logging::level + + [] + + [src]

+
pub fn level() -> Result<LogLevel, Error>

Get current logging level

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/logging/fn.log_to_file.html b/0.4.0/chemfiles/logging/fn.log_to_file.html new file mode 100644 index 000000000..3220de507 --- /dev/null +++ b/0.4.0/chemfiles/logging/fn.log_to_file.html @@ -0,0 +1,113 @@ + + + + + + + + + + chemfiles::logging::log_to_file - Rust + + + + + + + + + + + + + + + + + +
+

Function chemfiles::logging::log_to_file + + [] + + [src]

+
pub fn log_to_file<P>(filename: P) -> Result<(), Error> where P: AsRef<Path>

Write logs to the file at path, creating it if needed.

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/logging/fn.log_to_stderr.html b/0.4.0/chemfiles/logging/fn.log_to_stderr.html new file mode 100644 index 000000000..34b6e2f03 --- /dev/null +++ b/0.4.0/chemfiles/logging/fn.log_to_stderr.html @@ -0,0 +1,113 @@ + + + + + + + + + + chemfiles::logging::log_to_stderr - Rust + + + + + + + + + + + + + + + + + +
+

Function chemfiles::logging::log_to_stderr + + [] + + [src]

+
pub fn log_to_stderr() -> Result<(), Error>

Write logs to the standard error stream. This is the default.

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/logging/fn.set_level.html b/0.4.0/chemfiles/logging/fn.set_level.html new file mode 100644 index 000000000..52f72c1ce --- /dev/null +++ b/0.4.0/chemfiles/logging/fn.set_level.html @@ -0,0 +1,113 @@ + + + + + + + + + + chemfiles::logging::set_level - Rust + + + + + + + + + + + + + + + + + +
+

Function chemfiles::logging::set_level + + [] + + [src]

+
pub fn set_level(level: LogLevel) -> Result<(), Error>

Set the logging level to level

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/logging/index.html b/0.4.0/chemfiles/logging/index.html new file mode 100644 index 000000000..f748456c4 --- /dev/null +++ b/0.4.0/chemfiles/logging/index.html @@ -0,0 +1,150 @@ + + + + + + + + + + chemfiles::logging - Rust + + + + + + + + + + + + + + + + + +
+

Module chemfiles::logging + + [] + + [src]

+

Logging utilities

+

Enums

+ + + + +
LogLevel +

Available log levels

+

Functions

+ + + + + + + + + + + + + + + + +
level +

Get current logging level

+
log_to_file +

Write logs to the file at path, creating it if needed.

+
log_to_stderr +

Write logs to the standard error stream. This is the default.

+
set_level +

Set the logging level to level

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/logging/sidebar-items.js b/0.4.0/chemfiles/logging/sidebar-items.js new file mode 100644 index 000000000..39751287f --- /dev/null +++ b/0.4.0/chemfiles/logging/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["LogLevel","Available log levels"]],"fn":[["level","Get current logging level"],["log_to_file","Write logs to the file at `path`, creating it if needed."],["log_to_stderr","Write logs to the standard error stream. This is the default."],["set_level","Set the logging level to `level`"]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/logging/struct.Logger.html b/0.4.0/chemfiles/logging/struct.Logger.html new file mode 100644 index 000000000..b9be72e4e --- /dev/null +++ b/0.4.0/chemfiles/logging/struct.Logger.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Logger.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/selection/index.html b/0.4.0/chemfiles/selection/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/selection/sidebar-items.js b/0.4.0/chemfiles/selection/sidebar-items.js new file mode 100644 index 000000000..4e66c8dc8 --- /dev/null +++ b/0.4.0/chemfiles/selection/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["Match","A `Match` is a set of atomic indexes matching a given selection. It should be used like a `&[usize]`."],["Selection","Select atoms in a `Frame` with a selection language."]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/selection/struct.Match.html b/0.4.0/chemfiles/selection/struct.Match.html new file mode 100644 index 000000000..848ab37f8 --- /dev/null +++ b/0.4.0/chemfiles/selection/struct.Match.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Match.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/selection/struct.Selection.html b/0.4.0/chemfiles/selection/struct.Selection.html new file mode 100644 index 000000000..2268a4ddb --- /dev/null +++ b/0.4.0/chemfiles/selection/struct.Selection.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Selection.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/sidebar-items.js b/0.4.0/chemfiles/sidebar-items.js new file mode 100644 index 000000000..4ff599f70 --- /dev/null +++ b/0.4.0/chemfiles/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["AtomType","Available types of atoms"],["CellType","Available unit cell types"],["Error","Possible causes of error in chemfiles"]],"mod":[["logging","Logging utilities"]],"struct":[["Atom","An Atom is a particle in the current Frame. It can be used to store and retrieve informations about a particle, such as mass, name, atomic number, *etc.*"],["Frame","A `Frame` holds data from one step of a simulation: the current `Topology`, the positions, and maybe the velocities of the particles in the system."],["Topology","A `Topology` contains the definition of all the particles in the system, and the liaisons between the particles (bonds, angles, dihedrals, ...)."],["Trajectory","A Trajectory is a chemistry file on the hard drive. It is the main entry point of chemfiles."],["UnitCell","An `UnitCell` represent the box containing the atoms in the system, and its periodicity."]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/string/index.html b/0.4.0/chemfiles/string/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/string/sidebar-items.js b/0.4.0/chemfiles/string/sidebar-items.js new file mode 100644 index 000000000..48333d31f --- /dev/null +++ b/0.4.0/chemfiles/string/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({}); \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.Atom.html b/0.4.0/chemfiles/struct.Atom.html new file mode 100644 index 000000000..aa3451bd6 --- /dev/null +++ b/0.4.0/chemfiles/struct.Atom.html @@ -0,0 +1,155 @@ + + + + + + + + + + chemfiles::Atom - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::Atom + + [] + + [src]

+
pub struct Atom {
+    // some fields omitted
+}

An Atom is a particle in the current Frame. It can be used to store and +retrieve informations about a particle, such as mass, name, atomic number, +etc.

+

Methods

impl Atom

fn new<'a, S>(name: S) -> Result<Atom, Error> where S: Into<&'a str>

+

Create a new Atom from a name.

+

fn mass(&self) -> Result<f32, Error>

+

Get the Atom mass, in atomic mass units

+

fn set_mass(&mut self, mass: f32) -> Result<(), Error>

+

Set the Atom mass, in atomic mass units

+

fn charge(&self) -> Result<f32, Error>

+

Get the Atom charge, in number of the electron charge e

+

fn set_charge(&mut self, charge: f32) -> Result<(), Error>

+

Set the Atom charge, in number of the electron charge e

+

fn name(&self) -> Result<String, Error>

+

Get the Atom name

+

fn set_name<'a, S>(&mut self, name: S) -> Result<(), Error> where S: Into<&'a str>

+

Set the Atom name

+

fn full_name(&mut self) -> Result<String, Error>

+

Try to get the full name of the Atom. The full name of "He" is +"Helium", and so on. If the name can not be found, returns the empty +string.

+

fn vdw_radius(&self) -> Result<f64, Error>

+

Try to get the Van der Waals radius of the Atom. If the radius can not +be found, returns -1.

+

fn covalent_radius(&self) -> Result<f64, Error>

+

Try to get the covalent radius of the Atom. If the radius can not be +found, returns -1.

+

fn atomic_number(&self) -> Result<i32, Error>

+

Try to get the atomic number of the Atom. If the number can not be +found, returns -1.

+

fn atom_type(&self) -> Result<AtomType, Error>

+

Get the type of the atom

+

fn set_atom_type(&mut self, atom_type: AtomType) -> Result<(), Error>

+

Set the type of the atom

+

unsafe fn from_ptr(ptr: *const CHFL_ATOM) -> Atom

+

Create an Atom from a C pointer. This function is unsafe because no +validity check is made on the pointer.

+

unsafe fn as_ptr(&self) -> *const CHFL_ATOM

+

Get the underlying C pointer. This function is unsafe because no +lifetime guarantee is made on the pointer.

+

Trait Implementations

impl Drop for Atom

fn drop(&mut self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.Error.html b/0.4.0/chemfiles/struct.Error.html new file mode 100644 index 000000000..9bd5b3787 --- /dev/null +++ b/0.4.0/chemfiles/struct.Error.html @@ -0,0 +1,134 @@ + + + + + + + + + + chemfiles::Error - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::Error + + [] + + [src]

+
pub struct Error {
+    pub kind: ErrorKind,
+    pub message: String,
+}

Error type for Chemfiles.

+

Fields

+ + +
kind

The error kind

+
message

A message describing the error cause

+

Methods

impl Error

fn last_error() -> String

+

Get the last error message from the C++ library.

+

fn cleaup()

+

Clear any error from the C++ library

+

Trait Implementations

impl From<CHFL_STATUS> for Error

fn from(status: CHFL_STATUS) -> Error

+

impl Display for Error

fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>

+

impl Error for Error

fn description(&self) -> &str

+

1.0.0fn cause(&self) -> Option<&Error>

+

Derived Implementations

impl PartialEq for Error

fn eq(&self, __arg_0: &Error) -> bool

+

fn ne(&self, __arg_0: &Error) -> bool

+

impl Debug for Error

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Clone for Error

fn clone(&self) -> Error

+

1.0.0fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.Frame.html b/0.4.0/chemfiles/struct.Frame.html new file mode 100644 index 000000000..5718bccc5 --- /dev/null +++ b/0.4.0/chemfiles/struct.Frame.html @@ -0,0 +1,156 @@ + + + + + + + + + + chemfiles::Frame - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::Frame + + [] + + [src]

+
pub struct Frame {
+    // some fields omitted
+}

A Frame holds data from one step of a simulation: the current Topology, +the positions, and maybe the velocities of the particles in the system.

+

Methods

impl Frame

fn new(natoms: usize) -> Result<Frame, Error>

+

Create an empty frame with initial capacity of natoms. It will be +resized by the library as needed.

+

fn atom(&self, index: usize) -> Result<Atom, Error>

+

Get a specific Atom from a frame, given its index in the frame

+

fn natoms(&self) -> Result<usize, Error>

+

Get the current number of atoms in the Frame.

+

fn positions(&self) -> Result<Vec<[f32; 3]>, Error>

+

Get the positions from the Frame.

+

fn set_positions(&mut self, positions: Vec<[f32; 3]>) -> Result<(), Error>

+

Set the positions in the Frame.

+

fn velocities(&self) -> Result<Vec<[f32; 3]>, Error>

+

Get the velocities from the Frame.

+

fn set_velocities(&mut self, velocities: Vec<[f32; 3]>) -> Result<(), Error>

+

Set the velocities in the Frame.

+

fn has_velocities(&self) -> Result<bool, Error>

+

Check if the Frame has velocity information.

+

fn cell(&self) -> Result<UnitCell, Error>

+

Get the UnitCell from the Frame

+

fn set_cell(&mut self, cell: &UnitCell) -> Result<(), Error>

+

Set the UnitCell of the Frame

+

fn topology(&self) -> Result<Topology, Error>

+

Get the Topology from the Frame

+

fn set_topology(&mut self, topology: &Topology) -> Result<(), Error>

+

Set the Topology of the Frame

+

fn step(&self) -> Result<usize, Error>

+

Get the Frame step, i.e. the frame number in the trajectory

+

fn set_step(&mut self, step: usize) -> Result<(), Error>

+

Set the Frame step

+

fn guess_topology(&self, bonds: bool) -> Result<(), Error>

+

Try to guess the bonds, angles and dihedrals in the system. If bonds +is true, guess everything; else only guess the angles and dihedrals from +the topology bond list.

+

unsafe fn from_ptr(ptr: *const CHFL_FRAME) -> Frame

+

Create a Frame from a C pointer. This function is unsafe because +no validity check is made on the pointer.

+

unsafe fn as_ptr(&self) -> *const CHFL_FRAME

+

Get the underlying C pointer. This function is unsafe because no +lifetime guarantee is made on the pointer.

+

Trait Implementations

impl Drop for Frame

fn drop(&mut self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.Logger.html b/0.4.0/chemfiles/struct.Logger.html new file mode 100644 index 000000000..cae9ca340 --- /dev/null +++ b/0.4.0/chemfiles/struct.Logger.html @@ -0,0 +1,137 @@ + + + + + + + + + + chemfiles::Logger - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::Logger + + [] + + [src]

+
pub struct Logger<'a> {
+    // some fields omitted
+}

This struct give access to the logging system.

+ +

As it is a global system, it must be aquired before any operations.

+

Methods

impl<'a> Logger<'a>

fn get() -> Logger<'a>

+

Get an handle to the logging system. This function blocks, waiting for a +mutex to be available. You should probably call this function from one +thread only.

+

fn level(&self) -> Result<LogLevel>

+

Get the current maximal logging level

+

fn set_level(&self, level: LogLevel) -> Result<()>

+

Set the maximal logging level to level

+

fn log_to_file<P>(&self, filename: P) -> Result<()> where P: AsRef<Path>

+

Write logs to the file at path, creating it if needed.

+

fn log_to_stderr(&self) -> Result<()>

+

Redirect the logs to the standard error stream. This is the default.

+

fn log_to_stdout(&self) -> Result<()>

+

Redirect the logs to the standard output.

+

fn log_silent(&self) -> Result<()>

+

Remove all logging output.

+

fn log_callback<F>(&self, callback: F) -> Result<()> where F: Fn(LogLevel, &str) + 'static

+

Redirect all logging to user-provided logging. The callback function will +be called at each loggin operation with the level of the message, and the +the message itself.

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.Match.html b/0.4.0/chemfiles/struct.Match.html new file mode 100644 index 000000000..00d276a7a --- /dev/null +++ b/0.4.0/chemfiles/struct.Match.html @@ -0,0 +1,132 @@ + + + + + + + + + + chemfiles::Match - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::Match + + [] + + [src]

+
pub struct Match(_);

A Match is a set of atomic indexes matching a given selection. It should +be used like a &[usize].

+

Methods

impl Match

fn new(atoms: &[usize]) -> Match

+

Create a new match containing the atoms in the atoms slice.

+ +

Panics

+

If the slice contains more than 4 elements, which is the maximal size +of a match.

+

fn iter<'a>(&'a self) -> Iter<'a, usize>

+

Iterate over the atomic indexes in the match.

+

Trait Implementations

impl Index<usize> for Match

type Output = usize

+

fn index(&self, i: usize) -> &usize

+

impl<'a> IntoIterator for &'a Match

type Item = &'a usize

+

type IntoIter = Iter<'a, usize>

+

fn into_iter(self) -> Iter<'a, usize>

+

Derived Implementations

impl Eq for Match

impl PartialEq for Match

fn eq(&self, __arg_0: &Match) -> bool

+

fn ne(&self, __arg_0: &Match) -> bool

+

impl Copy for Match

impl Clone for Match

fn clone(&self) -> Match

+

1.0.0fn clone_from(&mut self, source: &Self)

+

impl Debug for Match

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.Selection.html b/0.4.0/chemfiles/struct.Selection.html new file mode 100644 index 000000000..43223ed98 --- /dev/null +++ b/0.4.0/chemfiles/struct.Selection.html @@ -0,0 +1,141 @@ + + + + + + + + + + chemfiles::Selection - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::Selection + + [] + + [src]

+
pub struct Selection {
+    // some fields omitted
+}

Select atoms in a Frame with a selection language.

+ +

The selection language is built by combining basic operations. Each basic +operation follows the <selector>[(<variable>)] <operator> <value> +structure, where <operator> is a comparison operator in == != < <= > >=. +Refer to the full +documentation to know +the allowed selectors and how to use them.

+

Methods

impl Selection

fn new<'a, S: Into<&'a str>>(selection: S) -> Result<Selection>

+

Create a new selection from the given selection string.

+

fn size(&self) -> Result<usize>

+

Get the size of the selection, i.e. the number of atoms we are selecting +together.

+ +

This value is 1 for the 'atom' context, 2 for the 'pair' and 'bond' +context, 3 for the 'three' and 'angles' contextes and 4 for the 'four' +and 'dihedral' contextes.

+

fn evaluate(&mut self, frame: &Frame) -> Result<Vec<Match>>

+

Evaluate a selection for a given frame, and return the corresponding +matches.

+

fn list(&mut self, frame: &Frame) -> Result<Vec<usize>>

+

Evaluates a selection of size 1 on a given frame. This function +returns the list of atomic indexes in the frame matching this selection.

+ +

Panics

+

If the selection size is not 1.

+

Trait Implementations

impl Drop for Selection

fn drop(&mut self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.Topology.html b/0.4.0/chemfiles/struct.Topology.html new file mode 100644 index 000000000..199d4d84c --- /dev/null +++ b/0.4.0/chemfiles/struct.Topology.html @@ -0,0 +1,161 @@ + + + + + + + + + + chemfiles::Topology - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::Topology + + [] + + [src]

+
pub struct Topology {
+    // some fields omitted
+}

A Topology contains the definition of all the particles in the system, and +the liaisons between the particles (bonds, angles, dihedrals, ...).

+ +

Only the atoms and the bonds are stored, the angles and the dihedrals are +computed automaticaly.

+

Methods

impl Topology

fn new() -> Result<Topology, Error>

+

Create a new empty topology

+

fn atom(&self, index: usize) -> Result<Atom, Error>

+

Get a specific Atom from a topology, given its index in the topology

+

fn natoms(&self) -> Result<usize, Error>

+

Get the current number of atoms in the topology.

+

fn push(&mut self, atom: &Atom) -> Result<(), Error>

+

Add an Atom at the end of a topology

+

fn remove(&mut self, index: usize) -> Result<(), Error>

+

Remove an Atom from a topology by index. This modify all the other +atoms indexes.

+

fn is_bond(&self, i: usize, j: usize) -> Result<bool, Error>

+

Tell if the atoms at indexes i and j are bonded together

+

fn is_angle(&self, i: usize, j: usize, k: usize) -> Result<bool, Error>

+

Tell if the atoms at indexes i, j and k constitues an angle

+

fn is_dihedral(&self, i: usize, j: usize, k: usize, m: usize) -> Result<bool, Error>

+

Tell if the atoms at indexes i, j, k and m constitues a dihedral +angle

+

fn bonds_count(&self) -> Result<usize, Error>

+

Get the number of bonds in the system

+

fn angles_count(&self) -> Result<usize, Error>

+

Get the number of angles in the system

+

fn dihedrals_count(&self) -> Result<usize, Error>

+

Get the number of dihedral angles in the system

+

fn bonds(&self) -> Result<Vec<[usize; 2]>, Error>

+

Get the list of bonds in the system

+

fn angles(&self) -> Result<Vec<[usize; 3]>, Error>

+

Get the list of angles in the system

+

fn dihedrals(&self) -> Result<Vec<[usize; 4]>, Error>

+

Get the list of dihedral angles in the system

+

fn add_bond(&mut self, i: usize, j: usize) -> Result<(), Error>

+

Add a bond between the atoms at indexes i and j in the system

+

fn remove_bond(&mut self, i: usize, j: usize) -> Result<(), Error>

+

Remove any existing bond between the atoms at indexes i and j in +the system

+

unsafe fn from_ptr(ptr: *const CHFL_TOPOLOGY) -> Topology

+

Create a Topology from a C pointer. This function is unsafe because no +validity check is made on the pointer.

+

unsafe fn as_ptr(&self) -> *const CHFL_TOPOLOGY

+

Get the underlying C pointer. This function is unsafe because no +lifetime guarantee is made on the pointer.

+

Trait Implementations

impl Drop for Topology

fn drop(&mut self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.Trajectory.html b/0.4.0/chemfiles/struct.Trajectory.html new file mode 100644 index 000000000..78248261e --- /dev/null +++ b/0.4.0/chemfiles/struct.Trajectory.html @@ -0,0 +1,152 @@ + + + + + + + + + + chemfiles::Trajectory - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::Trajectory + + [] + + [src]

+
pub struct Trajectory {
+    // some fields omitted
+}

A Trajectory is a chemistry file on the hard drive. It is the main entry +point of chemfiles.

+

Methods

impl Trajectory

fn open<P>(filename: P) -> Result<Trajectory, Error> where P: AsRef<Path>

+

Open a trajectory file in read mode.

+

fn create<P>(filename: P) -> Result<Trajectory, Error> where P: AsRef<Path>

+

Open a trajectory file in write mode.

+

fn open_with_format<'a, P, S>(filename: P, format: S) -> Result<Trajectory, Error> where P: AsRef<Path>, S: Into<&'a str>

+

Open a trajectory file in read mode using a specific format.

+

fn create_with_format<'a, P, S>(filename: P, format: S) -> Result<Trajectory, Error> where P: AsRef<Path>, S: Into<&'a str>

+

Open a trajectory file in write mode.

+

fn read(&mut self, frame: &mut Frame) -> Result<(), Error>

+

Read the next step of the trajectory into a frame

+

fn read_step(&mut self, step: usize, frame: &mut Frame) -> Result<(), Error>

+

Read a specific step of the trajectory in a frame

+

fn write(&mut self, frame: &Frame) -> Result<(), Error>

+

Write a frame to the trajectory.

+

fn set_topology(&mut self, topology: Topology) -> Result<(), Error>

+

Set the topology associated with a trajectory. This topology will be +used when reading and writing the files, replacing any topology in the +frames or files.

+

fn set_topology_file<P>(&mut self, filename: P) -> Result<(), Error> where P: AsRef<Path>

+

Set the topology associated with a trajectory by reading the first frame +of filename; and extracting the topology of this frame.

+

fn set_cell(&mut self, cell: UnitCell) -> Result<(), Error>

+

Set the unit cell associated with a trajectory. This cell will be used +when reading and writing the files, replacing any unit cell in the +frames or files.

+

fn nsteps(&mut self) -> Result<usize, Error>

+

Get the number of steps (the number of frames) in a trajectory.

+

fn sync(&mut self) -> Result<(), Error>

+

Synchronize any buffered content to the hard drive.

+

unsafe fn from_ptr(ptr: *mut CHFL_TRAJECTORY) -> Trajectory

+

Create a Trajectory from a C pointer. This function is unsafe because +no validity check is made on the pointer.

+

unsafe fn as_ptr(&self) -> *const CHFL_TRAJECTORY

+

Get the underlying C pointer. This function is unsafe because no +lifetime guarantee is made on the pointer.

+

Trait Implementations

impl Drop for Trajectory

fn drop(&mut self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/struct.UnitCell.html b/0.4.0/chemfiles/struct.UnitCell.html new file mode 100644 index 000000000..7dd19b457 --- /dev/null +++ b/0.4.0/chemfiles/struct.UnitCell.html @@ -0,0 +1,163 @@ + + + + + + + + + + chemfiles::UnitCell - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles::UnitCell + + [] + + [src]

+
pub struct UnitCell {
+    // some fields omitted
+}

An UnitCell represent the box containing the atoms in the system, and its +periodicity.

+ +

A unit cell is fully represented by three lenghts (a, b, c); and three +angles (alpha, beta, gamma). The angles are stored in degrees, and the +lenghts in Angstroms. A cell also has a matricial representation, by +projecting the three base vector into an orthonormal base. We choose to +represent such matrix as an upper triangular matrix:

+ +
+        | a_x   b_x   c_x |
+        |  0    b_y   c_y |
+        |  0     0    c_z |
+ +

An unit cell also have a cell type, represented by the CellType enum.

+

Methods

impl UnitCell

fn new(a: f64, b: f64, c: f64) -> Result<UnitCell, Error>

+

Create an Orthorombic UnitCell from the three lenghts

+

fn infinite() -> Result<UnitCell, Error>

+

Create an Infinite UnitCell

+

fn triclinic(a: f64, b: f64, c: f64, alpha: f64, beta: f64, gamma: f64) -> Result<UnitCell, Error>

+

Create an Triclinic UnitCell from the three lenghts and three angles

+

fn lengths(&self) -> Result<(f64, f64, f64), Error>

+

Get the three lenghts of an UnitCell, in Angstroms.

+

fn set_lengths(&mut self, a: f64, b: f64, c: f64) -> Result<(), Error>

+

Set the three lenghts of an UnitCell, in Angstroms.

+

fn angles(&self) -> Result<(f64, f64, f64), Error>

+

Get the three angles of an UnitCell, in degrees.

+

fn set_angles(&mut self, alpha: f64, beta: f64, gamma: f64) -> Result<(), Error>

+

Set the three angles of an UnitCell, in degrees. This is only possible +with Triclinic cells.

+

fn matrix(&self) -> Result<[[f64; 3]; 3], Error>

+

Get the unit cell matricial representation.

+

fn cell_type(&self) -> Result<CellType, Error>

+

Get the type of the unit cell

+

fn set_cell_type(&mut self, cell_type: CellType) -> Result<(), Error>

+

Set the type of the unit cell

+

fn periodicity(&self) -> Result<(bool, bool, bool), Error>

+

Get the cell periodic boundary conditions along the three axis

+

fn set_periodicity(&mut self, x: bool, y: bool, z: bool) -> Result<(), Error>

+

Set the cell periodic boundary conditions along the three axis

+

fn volume(&self) -> Result<f64, Error>

+

Get the volume of the unit cell

+

unsafe fn from_ptr(ptr: *const CHFL_CELL) -> UnitCell

+

Create an UnitCell from a C pointer. This function is unsafe because +no validity check is made on the pointer.

+

unsafe fn as_ptr(&self) -> *const CHFL_CELL

+

Get the underlying C pointer. This function is unsafe because no +lifetime guarantee is made on the pointer.

+

Trait Implementations

impl Drop for UnitCell

fn drop(&mut self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles/testing/index.html b/0.4.0/chemfiles/testing/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/testing/sidebar-items.js b/0.4.0/chemfiles/testing/sidebar-items.js new file mode 100644 index 000000000..48333d31f --- /dev/null +++ b/0.4.0/chemfiles/testing/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({}); \ No newline at end of file diff --git a/0.4.0/chemfiles/tests/index.html b/0.4.0/chemfiles/tests/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/tests/sidebar-items.js b/0.4.0/chemfiles/tests/sidebar-items.js new file mode 100644 index 000000000..48333d31f --- /dev/null +++ b/0.4.0/chemfiles/tests/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({}); \ No newline at end of file diff --git a/0.4.0/chemfiles/topology/index.html b/0.4.0/chemfiles/topology/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/topology/sidebar-items.js b/0.4.0/chemfiles/topology/sidebar-items.js new file mode 100644 index 000000000..9522d5650 --- /dev/null +++ b/0.4.0/chemfiles/topology/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["Topology","A `Topology` contains the definition of all the particles in the system, and the liaisons between the particles (bonds, angles, dihedrals, ...)."]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/topology/struct.Topology.html b/0.4.0/chemfiles/topology/struct.Topology.html new file mode 100644 index 000000000..53c3a8234 --- /dev/null +++ b/0.4.0/chemfiles/topology/struct.Topology.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Topology.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/trajectory/index.html b/0.4.0/chemfiles/trajectory/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/0.4.0/chemfiles/trajectory/sidebar-items.js b/0.4.0/chemfiles/trajectory/sidebar-items.js new file mode 100644 index 000000000..7bd8162bc --- /dev/null +++ b/0.4.0/chemfiles/trajectory/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["Trajectory","A Trajectory is a chemistry file on the hard drive. It is the main entry point of chemfiles."]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles/trajectory/struct.Trajectory.html b/0.4.0/chemfiles/trajectory/struct.Trajectory.html new file mode 100644 index 000000000..8d4845dd3 --- /dev/null +++ b/0.4.0/chemfiles/trajectory/struct.Trajectory.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../chemfiles/struct.Trajectory.html...

+ + + \ No newline at end of file diff --git a/0.4.0/chemfiles/type.Result.html b/0.4.0/chemfiles/type.Result.html new file mode 100644 index 000000000..3d5b5ba4a --- /dev/null +++ b/0.4.0/chemfiles/type.Result.html @@ -0,0 +1,113 @@ + + + + + + + + + + chemfiles::Result - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles::Result + + [] + + [src]

+
type Result<T> = Result<T, Error>;

Custom result type for working with errors in chemfiles

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_ATOM_COARSE_GRAINED.html b/0.4.0/chemfiles_sys/constant.CHFL_ATOM_COARSE_GRAINED.html new file mode 100644 index 000000000..773a5bf3d --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_ATOM_COARSE_GRAINED.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_ATOM_COARSE_GRAINED - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_ATOM_COARSE_GRAINED + + [] + + [src]

+
pub const CHFL_ATOM_COARSE_GRAINED: CHFL_ATOM_TYPES = 1
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_ATOM_DUMMY.html b/0.4.0/chemfiles_sys/constant.CHFL_ATOM_DUMMY.html new file mode 100644 index 000000000..d34d4037d --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_ATOM_DUMMY.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_ATOM_DUMMY - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_ATOM_DUMMY + + [] + + [src]

+
pub const CHFL_ATOM_DUMMY: CHFL_ATOM_TYPES = 2
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_ATOM_ELEMENT.html b/0.4.0/chemfiles_sys/constant.CHFL_ATOM_ELEMENT.html new file mode 100644 index 000000000..79d9143f5 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_ATOM_ELEMENT.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_ATOM_ELEMENT - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_ATOM_ELEMENT + + [] + + [src]

+
pub const CHFL_ATOM_ELEMENT: CHFL_ATOM_TYPES = 0
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_ATOM_UNDEFINED.html b/0.4.0/chemfiles_sys/constant.CHFL_ATOM_UNDEFINED.html new file mode 100644 index 000000000..ca979877a --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_ATOM_UNDEFINED.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_ATOM_UNDEFINED - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_ATOM_UNDEFINED + + [] + + [src]

+
pub const CHFL_ATOM_UNDEFINED: CHFL_ATOM_TYPES = 3
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_CELL_INFINITE.html b/0.4.0/chemfiles_sys/constant.CHFL_CELL_INFINITE.html new file mode 100644 index 000000000..4881e8cf7 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_CELL_INFINITE.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_CELL_INFINITE - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_CELL_INFINITE + + [] + + [src]

+
pub const CHFL_CELL_INFINITE: CHFL_CELL_TYPES = 2
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_CELL_ORTHORHOMBIC.html b/0.4.0/chemfiles_sys/constant.CHFL_CELL_ORTHORHOMBIC.html new file mode 100644 index 000000000..8a1fef266 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_CELL_ORTHORHOMBIC.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_CELL_ORTHORHOMBIC - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_CELL_ORTHORHOMBIC + + [] + + [src]

+
pub const CHFL_CELL_ORTHORHOMBIC: CHFL_CELL_TYPES = 0
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_CELL_TRICLINIC.html b/0.4.0/chemfiles_sys/constant.CHFL_CELL_TRICLINIC.html new file mode 100644 index 000000000..2ff7d50dd --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_CELL_TRICLINIC.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_CELL_TRICLINIC - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_CELL_TRICLINIC + + [] + + [src]

+
pub const CHFL_CELL_TRICLINIC: CHFL_CELL_TYPES = 1
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_CXX_ERROR.html b/0.4.0/chemfiles_sys/constant.CHFL_CXX_ERROR.html new file mode 100644 index 000000000..ded9d7f46 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_CXX_ERROR.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_CXX_ERROR - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_CXX_ERROR + + [] + + [src]

+
pub const CHFL_CXX_ERROR: CHFL_STATUS = 6
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_FILE_ERROR.html b/0.4.0/chemfiles_sys/constant.CHFL_FILE_ERROR.html new file mode 100644 index 000000000..861994201 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_FILE_ERROR.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_FILE_ERROR - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_FILE_ERROR + + [] + + [src]

+
pub const CHFL_FILE_ERROR: CHFL_STATUS = 2
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_FORMAT_ERROR.html b/0.4.0/chemfiles_sys/constant.CHFL_FORMAT_ERROR.html new file mode 100644 index 000000000..82ec5a96c --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_FORMAT_ERROR.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_FORMAT_ERROR - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_FORMAT_ERROR + + [] + + [src]

+
pub const CHFL_FORMAT_ERROR: CHFL_STATUS = 3
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_GENERIC_ERROR.html b/0.4.0/chemfiles_sys/constant.CHFL_GENERIC_ERROR.html new file mode 100644 index 000000000..6362140c8 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_GENERIC_ERROR.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_GENERIC_ERROR - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_GENERIC_ERROR + + [] + + [src]

+
pub const CHFL_GENERIC_ERROR: CHFL_STATUS = 5
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_LOG_DEBUG.html b/0.4.0/chemfiles_sys/constant.CHFL_LOG_DEBUG.html new file mode 100644 index 000000000..b61c31809 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_LOG_DEBUG.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_LOG_DEBUG - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_LOG_DEBUG + + [] + + [src]

+
pub const CHFL_LOG_DEBUG: CHFL_LOG_LEVEL = 3
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_LOG_ERROR.html b/0.4.0/chemfiles_sys/constant.CHFL_LOG_ERROR.html new file mode 100644 index 000000000..2ad45249f --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_LOG_ERROR.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_LOG_ERROR - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_LOG_ERROR + + [] + + [src]

+
pub const CHFL_LOG_ERROR: CHFL_LOG_LEVEL = 0
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_LOG_INFO.html b/0.4.0/chemfiles_sys/constant.CHFL_LOG_INFO.html new file mode 100644 index 000000000..6b767cca6 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_LOG_INFO.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_LOG_INFO - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_LOG_INFO + + [] + + [src]

+
pub const CHFL_LOG_INFO: CHFL_LOG_LEVEL = 2
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_LOG_WARNING.html b/0.4.0/chemfiles_sys/constant.CHFL_LOG_WARNING.html new file mode 100644 index 000000000..2a2e3526e --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_LOG_WARNING.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_LOG_WARNING - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_LOG_WARNING + + [] + + [src]

+
pub const CHFL_LOG_WARNING: CHFL_LOG_LEVEL = 1
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_MEMORY_ERROR.html b/0.4.0/chemfiles_sys/constant.CHFL_MEMORY_ERROR.html new file mode 100644 index 000000000..eb5b5e271 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_MEMORY_ERROR.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_MEMORY_ERROR - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_MEMORY_ERROR + + [] + + [src]

+
pub const CHFL_MEMORY_ERROR: CHFL_STATUS = 1
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_SELECTION_ERROR.html b/0.4.0/chemfiles_sys/constant.CHFL_SELECTION_ERROR.html new file mode 100644 index 000000000..2b4acdd9b --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_SELECTION_ERROR.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_SELECTION_ERROR - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_SELECTION_ERROR + + [] + + [src]

+
pub const CHFL_SELECTION_ERROR: CHFL_STATUS = 4
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CHFL_SUCCESS.html b/0.4.0/chemfiles_sys/constant.CHFL_SUCCESS.html new file mode 100644 index 000000000..83618749c --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CHFL_SUCCESS.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_SUCCESS - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_SUCCESS + + [] + + [src]

+
pub const CHFL_SUCCESS: CHFL_STATUS = 0
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.CORSE_GRAIN.html b/0.4.0/chemfiles_sys/constant.CORSE_GRAIN.html new file mode 100644 index 000000000..a27b3649e --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.CORSE_GRAIN.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CORSE_GRAIN - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CORSE_GRAIN + + [] + + [src]

+
pub const CORSE_GRAIN: c_uint = 1
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.DEBUG.html b/0.4.0/chemfiles_sys/constant.DEBUG.html new file mode 100644 index 000000000..7b291f9fd --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.DEBUG.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::DEBUG - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::DEBUG + + [] + + [src]

+
pub const DEBUG: c_uint = 4
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.DUMMY.html b/0.4.0/chemfiles_sys/constant.DUMMY.html new file mode 100644 index 000000000..35cc59029 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.DUMMY.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::DUMMY - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::DUMMY + + [] + + [src]

+
pub const DUMMY: c_uint = 2
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.ELEMENT.html b/0.4.0/chemfiles_sys/constant.ELEMENT.html new file mode 100644 index 000000000..876b7aa1b --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.ELEMENT.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::ELEMENT - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::ELEMENT + + [] + + [src]

+
pub const ELEMENT: c_uint = 0
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.ERROR.html b/0.4.0/chemfiles_sys/constant.ERROR.html new file mode 100644 index 000000000..fdfd279d8 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.ERROR.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::ERROR - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::ERROR + + [] + + [src]

+
pub const ERROR: c_uint = 1
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.INFINITE.html b/0.4.0/chemfiles_sys/constant.INFINITE.html new file mode 100644 index 000000000..ecf0934c6 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.INFINITE.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::INFINITE - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::INFINITE + + [] + + [src]

+
pub const INFINITE: c_uint = 2
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.INFO.html b/0.4.0/chemfiles_sys/constant.INFO.html new file mode 100644 index 000000000..c80d05de6 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.INFO.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::INFO - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::INFO + + [] + + [src]

+
pub const INFO: c_uint = 3
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.NONE.html b/0.4.0/chemfiles_sys/constant.NONE.html new file mode 100644 index 000000000..b1c5b239b --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.NONE.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::NONE - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::NONE + + [] + + [src]

+
pub const NONE: c_uint = 0
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.ORTHOROMBIC.html b/0.4.0/chemfiles_sys/constant.ORTHOROMBIC.html new file mode 100644 index 000000000..4a315d062 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.ORTHOROMBIC.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::ORTHOROMBIC - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::ORTHOROMBIC + + [] + + [src]

+
pub const ORTHOROMBIC: c_uint = 0
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.TRICLINIC.html b/0.4.0/chemfiles_sys/constant.TRICLINIC.html new file mode 100644 index 000000000..b1c32cf60 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.TRICLINIC.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::TRICLINIC - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::TRICLINIC + + [] + + [src]

+
pub const TRICLINIC: c_uint = 1
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.UNDEFINED.html b/0.4.0/chemfiles_sys/constant.UNDEFINED.html new file mode 100644 index 000000000..01912dc16 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.UNDEFINED.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::UNDEFINED - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::UNDEFINED + + [] + + [src]

+
pub const UNDEFINED: c_uint = 3
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/constant.WARNING.html b/0.4.0/chemfiles_sys/constant.WARNING.html new file mode 100644 index 000000000..6e16932c9 --- /dev/null +++ b/0.4.0/chemfiles_sys/constant.WARNING.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::WARNING - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::WARNING + + [] + + [src]

+
pub const WARNING: c_uint = 2
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/enum.CHFL_ATOM.html b/0.4.0/chemfiles_sys/enum.CHFL_ATOM.html new file mode 100644 index 000000000..95b818e48 --- /dev/null +++ b/0.4.0/chemfiles_sys/enum.CHFL_ATOM.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_ATOM - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles_sys::CHFL_ATOM + + [] + + [src]

+
pub enum CHFL_ATOM {}
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/enum.CHFL_CELL.html b/0.4.0/chemfiles_sys/enum.CHFL_CELL.html new file mode 100644 index 000000000..b20b510be --- /dev/null +++ b/0.4.0/chemfiles_sys/enum.CHFL_CELL.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_CELL - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles_sys::CHFL_CELL + + [] + + [src]

+
pub enum CHFL_CELL {}
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/enum.CHFL_FRAME.html b/0.4.0/chemfiles_sys/enum.CHFL_FRAME.html new file mode 100644 index 000000000..7924bc653 --- /dev/null +++ b/0.4.0/chemfiles_sys/enum.CHFL_FRAME.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_FRAME - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles_sys::CHFL_FRAME + + [] + + [src]

+
pub enum CHFL_FRAME {}
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/enum.CHFL_SELECTION.html b/0.4.0/chemfiles_sys/enum.CHFL_SELECTION.html new file mode 100644 index 000000000..2f20ee645 --- /dev/null +++ b/0.4.0/chemfiles_sys/enum.CHFL_SELECTION.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_SELECTION - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles_sys::CHFL_SELECTION + + [] + + [src]

+
pub enum CHFL_SELECTION {}
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/enum.CHFL_TOPOLOGY.html b/0.4.0/chemfiles_sys/enum.CHFL_TOPOLOGY.html new file mode 100644 index 000000000..d78ed0048 --- /dev/null +++ b/0.4.0/chemfiles_sys/enum.CHFL_TOPOLOGY.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_TOPOLOGY - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles_sys::CHFL_TOPOLOGY + + [] + + [src]

+
pub enum CHFL_TOPOLOGY {}
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/enum.CHFL_TRAJECTORY.html b/0.4.0/chemfiles_sys/enum.CHFL_TRAJECTORY.html new file mode 100644 index 000000000..2a34fda0f --- /dev/null +++ b/0.4.0/chemfiles_sys/enum.CHFL_TRAJECTORY.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_TRAJECTORY - Rust + + + + + + + + + + + + + + + + + +
+

Enum chemfiles_sys::CHFL_TRAJECTORY + + [] + + [src]

+
pub enum CHFL_TRAJECTORY {}
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom.html b/0.4.0/chemfiles_sys/fn.chfl_atom.html new file mode 100644 index 000000000..18dd393e5 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom + + [] + + [src]

+
pub unsafe extern fn chfl_atom(name: *const c_char) -> *mut CHFL_ATOM
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_atomic_number.html b/0.4.0/chemfiles_sys/fn.chfl_atom_atomic_number.html new file mode 100644 index 000000000..08de6704d --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_atomic_number.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_atomic_number - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_atomic_number + + [] + + [src]

+
pub unsafe extern fn chfl_atom_atomic_number(atom: *const CHFL_ATOM, number: *mut c_int) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_charge.html b/0.4.0/chemfiles_sys/fn.chfl_atom_charge.html new file mode 100644 index 000000000..d0590b5e9 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_charge.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_charge - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_charge + + [] + + [src]

+
pub unsafe extern fn chfl_atom_charge(atom: *const CHFL_ATOM, charge: *mut c_float) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_covalent_radius.html b/0.4.0/chemfiles_sys/fn.chfl_atom_covalent_radius.html new file mode 100644 index 000000000..e8e3a5958 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_covalent_radius.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_covalent_radius - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_covalent_radius + + [] + + [src]

+
pub unsafe extern fn chfl_atom_covalent_radius(atom: *const CHFL_ATOM, radius: *mut c_double) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_free.html b/0.4.0/chemfiles_sys/fn.chfl_atom_free.html new file mode 100644 index 000000000..7ac2e950c --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_free.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_free - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_free + + [] + + [src]

+
pub unsafe extern fn chfl_atom_free(atom: *mut CHFL_ATOM) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_from_frame.html b/0.4.0/chemfiles_sys/fn.chfl_atom_from_frame.html new file mode 100644 index 000000000..cbe262041 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_from_frame.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_from_frame - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_from_frame + + [] + + [src]

+
pub unsafe extern fn chfl_atom_from_frame(frame: *const CHFL_FRAME, idx: size_t) -> *mut CHFL_ATOM
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_from_topology.html b/0.4.0/chemfiles_sys/fn.chfl_atom_from_topology.html new file mode 100644 index 000000000..4fa44e1e6 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_from_topology.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_from_topology - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_from_topology + + [] + + [src]

+
pub unsafe extern fn chfl_atom_from_topology(topology: *const CHFL_TOPOLOGY, idx: size_t) -> *mut CHFL_ATOM
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_full_name.html b/0.4.0/chemfiles_sys/fn.chfl_atom_full_name.html new file mode 100644 index 000000000..30968a40d --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_full_name.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_full_name - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_full_name + + [] + + [src]

+
pub unsafe extern fn chfl_atom_full_name(atom: *const CHFL_ATOM, name: *mut c_char, buffsize: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_mass.html b/0.4.0/chemfiles_sys/fn.chfl_atom_mass.html new file mode 100644 index 000000000..af259463d --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_mass.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_mass - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_mass + + [] + + [src]

+
pub unsafe extern fn chfl_atom_mass(atom: *const CHFL_ATOM, mass: *mut c_float) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_name.html b/0.4.0/chemfiles_sys/fn.chfl_atom_name.html new file mode 100644 index 000000000..04a762c03 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_name.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_name - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_name + + [] + + [src]

+
pub unsafe extern fn chfl_atom_name(atom: *const CHFL_ATOM, name: *mut c_char, buffsize: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_set_charge.html b/0.4.0/chemfiles_sys/fn.chfl_atom_set_charge.html new file mode 100644 index 000000000..1e4da2951 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_set_charge.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_set_charge - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_set_charge + + [] + + [src]

+
pub unsafe extern fn chfl_atom_set_charge(atom: *mut CHFL_ATOM, charge: c_float) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_set_mass.html b/0.4.0/chemfiles_sys/fn.chfl_atom_set_mass.html new file mode 100644 index 000000000..4cae743fc --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_set_mass.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_set_mass - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_set_mass + + [] + + [src]

+
pub unsafe extern fn chfl_atom_set_mass(atom: *mut CHFL_ATOM, mass: c_float) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_set_name.html b/0.4.0/chemfiles_sys/fn.chfl_atom_set_name.html new file mode 100644 index 000000000..44cb9b6cf --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_set_name.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_set_name - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_set_name + + [] + + [src]

+
pub unsafe extern fn chfl_atom_set_name(atom: *mut CHFL_ATOM, name: *const c_char) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_set_type.html b/0.4.0/chemfiles_sys/fn.chfl_atom_set_type.html new file mode 100644 index 000000000..7d4c96bbd --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_set_type.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_set_type - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_set_type + + [] + + [src]

+
pub unsafe extern fn chfl_atom_set_type(cell: *mut CHFL_ATOM, _type: CHFL_ATOM_TYPE) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_type.html b/0.4.0/chemfiles_sys/fn.chfl_atom_type.html new file mode 100644 index 000000000..bb78faf4b --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_type.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_type - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_type + + [] + + [src]

+
pub unsafe extern fn chfl_atom_type(cell: *const CHFL_ATOM, _type: *mut CHFL_ATOM_TYPE) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_atom_vdw_radius.html b/0.4.0/chemfiles_sys/fn.chfl_atom_vdw_radius.html new file mode 100644 index 000000000..43437e748 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_atom_vdw_radius.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_atom_vdw_radius - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_atom_vdw_radius + + [] + + [src]

+
pub unsafe extern fn chfl_atom_vdw_radius(atom: *const CHFL_ATOM, radius: *mut c_double) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell.html b/0.4.0/chemfiles_sys/fn.chfl_cell.html new file mode 100644 index 000000000..71802be03 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell + + [] + + [src]

+
pub unsafe extern fn chfl_cell(a: c_double, b: c_double, c: c_double) -> *mut CHFL_CELL
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_angles.html b/0.4.0/chemfiles_sys/fn.chfl_cell_angles.html new file mode 100644 index 000000000..a0c330dce --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_angles.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_angles - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_angles + + [] + + [src]

+
pub unsafe extern fn chfl_cell_angles(cell: *const CHFL_CELL, alpha: *mut c_double, beta: *mut c_double, gamma: *mut c_double) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_free.html b/0.4.0/chemfiles_sys/fn.chfl_cell_free.html new file mode 100644 index 000000000..9acdc8c0a --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_free.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_free - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_free + + [] + + [src]

+
pub unsafe extern fn chfl_cell_free(cell: *mut CHFL_CELL) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_from_frame.html b/0.4.0/chemfiles_sys/fn.chfl_cell_from_frame.html new file mode 100644 index 000000000..53bff8e04 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_from_frame.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_from_frame - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_from_frame + + [] + + [src]

+
pub unsafe extern fn chfl_cell_from_frame(frame: *mut CHFL_FRAME) -> *mut CHFL_CELL
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_lengths.html b/0.4.0/chemfiles_sys/fn.chfl_cell_lengths.html new file mode 100644 index 000000000..692db4dfa --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_lengths.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_lengths - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_lengths + + [] + + [src]

+
pub unsafe extern fn chfl_cell_lengths(cell: *const CHFL_CELL, a: *mut c_double, b: *mut c_double, c: *mut c_double) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_matrix.html b/0.4.0/chemfiles_sys/fn.chfl_cell_matrix.html new file mode 100644 index 000000000..74319686b --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_matrix.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_matrix - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_matrix + + [] + + [src]

+
pub unsafe extern fn chfl_cell_matrix(cell: *const CHFL_CELL, mat: *mut [c_double; 3usize]) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_periodicity.html b/0.4.0/chemfiles_sys/fn.chfl_cell_periodicity.html new file mode 100644 index 000000000..1e4858df3 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_periodicity.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_periodicity - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_periodicity + + [] + + [src]

+
pub unsafe extern fn chfl_cell_periodicity(cell: *const CHFL_CELL, x: *mut u8, y: *mut u8, z: *mut u8) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_set_angles.html b/0.4.0/chemfiles_sys/fn.chfl_cell_set_angles.html new file mode 100644 index 000000000..2f409f4c0 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_set_angles.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_set_angles - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_set_angles + + [] + + [src]

+
pub unsafe extern fn chfl_cell_set_angles(cell: *mut CHFL_CELL, alpha: c_double, beta: c_double, gamma: c_double) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_set_lengths.html b/0.4.0/chemfiles_sys/fn.chfl_cell_set_lengths.html new file mode 100644 index 000000000..5b27bfd9f --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_set_lengths.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_set_lengths - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_set_lengths + + [] + + [src]

+
pub unsafe extern fn chfl_cell_set_lengths(cell: *mut CHFL_CELL, a: c_double, b: c_double, c: c_double) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_set_periodicity.html b/0.4.0/chemfiles_sys/fn.chfl_cell_set_periodicity.html new file mode 100644 index 000000000..3b5fa7c6d --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_set_periodicity.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_set_periodicity - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_set_periodicity + + [] + + [src]

+
pub unsafe extern fn chfl_cell_set_periodicity(cell: *mut CHFL_CELL, x: u8, y: u8, z: u8) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_set_type.html b/0.4.0/chemfiles_sys/fn.chfl_cell_set_type.html new file mode 100644 index 000000000..48f31b20c --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_set_type.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_set_type - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_set_type + + [] + + [src]

+
pub unsafe extern fn chfl_cell_set_type(cell: *mut CHFL_CELL, _type: CHFL_CELL_TYPE) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_triclinic.html b/0.4.0/chemfiles_sys/fn.chfl_cell_triclinic.html new file mode 100644 index 000000000..fedd9b25e --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_triclinic.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_triclinic - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_triclinic + + [] + + [src]

+
pub unsafe extern fn chfl_cell_triclinic(a: c_double, b: c_double, c: c_double, alpha: c_double, beta: c_double, gamma: c_double) -> *mut CHFL_CELL
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_type.html b/0.4.0/chemfiles_sys/fn.chfl_cell_type.html new file mode 100644 index 000000000..b2d133813 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_type.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_type - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_type + + [] + + [src]

+
pub unsafe extern fn chfl_cell_type(cell: *const CHFL_CELL, _type: *mut CHFL_CELL_TYPE) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_cell_volume.html b/0.4.0/chemfiles_sys/fn.chfl_cell_volume.html new file mode 100644 index 000000000..212490da5 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_cell_volume.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_cell_volume - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_cell_volume + + [] + + [src]

+
pub unsafe extern fn chfl_cell_volume(cell: *const CHFL_CELL, V: *mut c_double) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_clear_errors.html b/0.4.0/chemfiles_sys/fn.chfl_clear_errors.html new file mode 100644 index 000000000..aee7b77a7 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_clear_errors.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_clear_errors - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_clear_errors + + [] + + [src]

+
pub unsafe extern fn chfl_clear_errors() -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame.html b/0.4.0/chemfiles_sys/fn.chfl_frame.html new file mode 100644 index 000000000..9f77a79fa --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame + + [] + + [src]

+
pub unsafe extern fn chfl_frame(natoms: size_t) -> *mut CHFL_FRAME
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_add_velocities.html b/0.4.0/chemfiles_sys/fn.chfl_frame_add_velocities.html new file mode 100644 index 000000000..bc8b40869 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_add_velocities.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_add_velocities - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_add_velocities + + [] + + [src]

+
pub unsafe extern fn chfl_frame_add_velocities(frame: *mut CHFL_FRAME) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_atoms_count.html b/0.4.0/chemfiles_sys/fn.chfl_frame_atoms_count.html new file mode 100644 index 000000000..452306b16 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_atoms_count.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_atoms_count - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_atoms_count + + [] + + [src]

+
pub unsafe extern fn chfl_frame_atoms_count(frame: *const CHFL_FRAME, natoms: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_free.html b/0.4.0/chemfiles_sys/fn.chfl_frame_free.html new file mode 100644 index 000000000..d806cd685 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_free.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_free - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_free + + [] + + [src]

+
pub unsafe extern fn chfl_frame_free(frame: *mut CHFL_FRAME) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_guess_topology.html b/0.4.0/chemfiles_sys/fn.chfl_frame_guess_topology.html new file mode 100644 index 000000000..3663117ab --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_guess_topology.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_guess_topology - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_guess_topology + + [] + + [src]

+
pub unsafe extern fn chfl_frame_guess_topology(frame: *mut CHFL_FRAME, bonds: u8) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_has_velocities.html b/0.4.0/chemfiles_sys/fn.chfl_frame_has_velocities.html new file mode 100644 index 000000000..e97bd3469 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_has_velocities.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_has_velocities - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_has_velocities + + [] + + [src]

+
pub unsafe extern fn chfl_frame_has_velocities(frame: *const CHFL_FRAME, has_vel: *mut u8) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_positions.html b/0.4.0/chemfiles_sys/fn.chfl_frame_positions.html new file mode 100644 index 000000000..804c0bca3 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_positions.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_positions - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_positions + + [] + + [src]

+
pub unsafe extern fn chfl_frame_positions(frame: *const CHFL_FRAME, data: *mut c_float, size: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_resize.html b/0.4.0/chemfiles_sys/fn.chfl_frame_resize.html new file mode 100644 index 000000000..8f1d72d37 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_resize.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_resize - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_resize + + [] + + [src]

+
pub unsafe extern fn chfl_frame_resize(frame: *mut CHFL_FRAME, natoms: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_set_cell.html b/0.4.0/chemfiles_sys/fn.chfl_frame_set_cell.html new file mode 100644 index 000000000..724aa413c --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_set_cell.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_set_cell - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_set_cell + + [] + + [src]

+
pub unsafe extern fn chfl_frame_set_cell(frame: *mut CHFL_FRAME, cell: *const CHFL_CELL) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_set_positions.html b/0.4.0/chemfiles_sys/fn.chfl_frame_set_positions.html new file mode 100644 index 000000000..e08c279bc --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_set_positions.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_set_positions - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_set_positions + + [] + + [src]

+
pub unsafe extern fn chfl_frame_set_positions(frame: *mut CHFL_FRAME, data: *const c_float, size: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_set_step.html b/0.4.0/chemfiles_sys/fn.chfl_frame_set_step.html new file mode 100644 index 000000000..dd9b7043f --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_set_step.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_set_step - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_set_step + + [] + + [src]

+
pub unsafe extern fn chfl_frame_set_step(frame: *mut CHFL_FRAME, step: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_set_topology.html b/0.4.0/chemfiles_sys/fn.chfl_frame_set_topology.html new file mode 100644 index 000000000..2d834611e --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_set_topology.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_set_topology - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_set_topology + + [] + + [src]

+
pub unsafe extern fn chfl_frame_set_topology(frame: *mut CHFL_FRAME, topology: *const CHFL_TOPOLOGY) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_set_velocities.html b/0.4.0/chemfiles_sys/fn.chfl_frame_set_velocities.html new file mode 100644 index 000000000..288482693 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_set_velocities.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_set_velocities - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_set_velocities + + [] + + [src]

+
pub unsafe extern fn chfl_frame_set_velocities(frame: *mut CHFL_FRAME, data: *const c_float, size: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_step.html b/0.4.0/chemfiles_sys/fn.chfl_frame_step.html new file mode 100644 index 000000000..8528d94aa --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_step.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_step - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_step + + [] + + [src]

+
pub unsafe extern fn chfl_frame_step(frame: *const CHFL_FRAME, step: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_frame_velocities.html b/0.4.0/chemfiles_sys/fn.chfl_frame_velocities.html new file mode 100644 index 000000000..a057c7891 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_frame_velocities.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_frame_velocities - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_frame_velocities + + [] + + [src]

+
pub unsafe extern fn chfl_frame_velocities(frame: *const CHFL_FRAME, data: *mut c_float, size: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_last_error.html b/0.4.0/chemfiles_sys/fn.chfl_last_error.html new file mode 100644 index 000000000..2826dcdb1 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_last_error.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_last_error - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_last_error + + [] + + [src]

+
pub unsafe extern fn chfl_last_error() -> *const c_char
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_log_callback.html b/0.4.0/chemfiles_sys/fn.chfl_log_callback.html new file mode 100644 index 000000000..d8558ba66 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_log_callback.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_log_callback - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_log_callback + + [] + + [src]

+
pub unsafe extern fn chfl_log_callback(callback: chfl_logging_callback_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_log_silent.html b/0.4.0/chemfiles_sys/fn.chfl_log_silent.html new file mode 100644 index 000000000..f44970666 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_log_silent.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_log_silent - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_log_silent + + [] + + [src]

+
pub unsafe extern fn chfl_log_silent() -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_log_stderr.html b/0.4.0/chemfiles_sys/fn.chfl_log_stderr.html new file mode 100644 index 000000000..7a0f069e3 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_log_stderr.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_log_stderr - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_log_stderr + + [] + + [src]

+
pub unsafe extern fn chfl_log_stderr() -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_log_stdout.html b/0.4.0/chemfiles_sys/fn.chfl_log_stdout.html new file mode 100644 index 000000000..23d884bd4 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_log_stdout.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_log_stdout - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_log_stdout + + [] + + [src]

+
pub unsafe extern fn chfl_log_stdout() -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_logfile.html b/0.4.0/chemfiles_sys/fn.chfl_logfile.html new file mode 100644 index 000000000..5f1f6d980 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_logfile.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_logfile - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_logfile + + [] + + [src]

+
pub unsafe extern fn chfl_logfile(file: *const c_char) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_loglevel.html b/0.4.0/chemfiles_sys/fn.chfl_loglevel.html new file mode 100644 index 000000000..a02e6d2e2 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_loglevel.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_loglevel - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_loglevel + + [] + + [src]

+
pub unsafe extern fn chfl_loglevel(level: *mut CHFL_LOG_LEVEL) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_selection.html b/0.4.0/chemfiles_sys/fn.chfl_selection.html new file mode 100644 index 000000000..7556ab14c --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_selection.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_selection - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_selection + + [] + + [src]

+
pub unsafe extern fn chfl_selection(selection: *const c_char) -> *mut CHFL_SELECTION
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_selection_evalutate.html b/0.4.0/chemfiles_sys/fn.chfl_selection_evalutate.html new file mode 100644 index 000000000..5d9428a75 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_selection_evalutate.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_selection_evalutate - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_selection_evalutate + + [] + + [src]

+
pub unsafe extern fn chfl_selection_evalutate(selection: *mut CHFL_SELECTION, frame: *const CHFL_FRAME, n_matches: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_selection_free.html b/0.4.0/chemfiles_sys/fn.chfl_selection_free.html new file mode 100644 index 000000000..a9d0ad184 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_selection_free.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_selection_free - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_selection_free + + [] + + [src]

+
pub unsafe extern fn chfl_selection_free(selection: *mut CHFL_SELECTION) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_selection_matches.html b/0.4.0/chemfiles_sys/fn.chfl_selection_matches.html new file mode 100644 index 000000000..34fe878fa --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_selection_matches.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_selection_matches - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_selection_matches + + [] + + [src]

+
pub unsafe extern fn chfl_selection_matches(selection: *const CHFL_SELECTION, matches: *mut chfl_match_t, n_matches: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_selection_size.html b/0.4.0/chemfiles_sys/fn.chfl_selection_size.html new file mode 100644 index 000000000..d268fafd2 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_selection_size.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_selection_size - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_selection_size + + [] + + [src]

+
pub unsafe extern fn chfl_selection_size(selection: *const CHFL_SELECTION, size: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_set_loglevel.html b/0.4.0/chemfiles_sys/fn.chfl_set_loglevel.html new file mode 100644 index 000000000..9bf70f432 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_set_loglevel.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_set_loglevel - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_set_loglevel + + [] + + [src]

+
pub unsafe extern fn chfl_set_loglevel(level: CHFL_LOG_LEVEL) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_strerror.html b/0.4.0/chemfiles_sys/fn.chfl_strerror.html new file mode 100644 index 000000000..56d12c290 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_strerror.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_strerror - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_strerror + + [] + + [src]

+
pub unsafe extern fn chfl_strerror(status: c_int) -> *const c_char
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology.html b/0.4.0/chemfiles_sys/fn.chfl_topology.html new file mode 100644 index 000000000..68aab5773 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology + + [] + + [src]

+
pub unsafe extern fn chfl_topology() -> *mut CHFL_TOPOLOGY
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_add_bond.html b/0.4.0/chemfiles_sys/fn.chfl_topology_add_bond.html new file mode 100644 index 000000000..62dd7fefb --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_add_bond.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_add_bond - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_add_bond + + [] + + [src]

+
pub unsafe extern fn chfl_topology_add_bond(topology: *mut CHFL_TOPOLOGY, i: size_t, j: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_angles.html b/0.4.0/chemfiles_sys/fn.chfl_topology_angles.html new file mode 100644 index 000000000..673dede0f --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_angles.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_angles - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_angles + + [] + + [src]

+
pub unsafe extern fn chfl_topology_angles(topology: *const CHFL_TOPOLOGY, data: *mut size_t, nangles: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_angles_count.html b/0.4.0/chemfiles_sys/fn.chfl_topology_angles_count.html new file mode 100644 index 000000000..6f3d3c320 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_angles_count.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_angles_count - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_angles_count + + [] + + [src]

+
pub unsafe extern fn chfl_topology_angles_count(topology: *const CHFL_TOPOLOGY, nangles: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_append.html b/0.4.0/chemfiles_sys/fn.chfl_topology_append.html new file mode 100644 index 000000000..df582b89a --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_append.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_append - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_append + + [] + + [src]

+
pub unsafe extern fn chfl_topology_append(topology: *mut CHFL_TOPOLOGY, atom: *const CHFL_ATOM) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_atoms_count.html b/0.4.0/chemfiles_sys/fn.chfl_topology_atoms_count.html new file mode 100644 index 000000000..daa6398e6 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_atoms_count.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_atoms_count - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_atoms_count + + [] + + [src]

+
pub unsafe extern fn chfl_topology_atoms_count(topology: *const CHFL_TOPOLOGY, natoms: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_bonds.html b/0.4.0/chemfiles_sys/fn.chfl_topology_bonds.html new file mode 100644 index 000000000..7332541c0 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_bonds.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_bonds - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_bonds + + [] + + [src]

+
pub unsafe extern fn chfl_topology_bonds(topology: *const CHFL_TOPOLOGY, data: *mut size_t, nbonds: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_bonds_count.html b/0.4.0/chemfiles_sys/fn.chfl_topology_bonds_count.html new file mode 100644 index 000000000..4d770a649 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_bonds_count.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_bonds_count - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_bonds_count + + [] + + [src]

+
pub unsafe extern fn chfl_topology_bonds_count(topology: *const CHFL_TOPOLOGY, nbonds: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_dihedrals.html b/0.4.0/chemfiles_sys/fn.chfl_topology_dihedrals.html new file mode 100644 index 000000000..38d580da4 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_dihedrals.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_dihedrals - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_dihedrals + + [] + + [src]

+
pub unsafe extern fn chfl_topology_dihedrals(topology: *const CHFL_TOPOLOGY, data: *mut size_t, ndihedrals: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_dihedrals_count.html b/0.4.0/chemfiles_sys/fn.chfl_topology_dihedrals_count.html new file mode 100644 index 000000000..af341be94 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_dihedrals_count.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_dihedrals_count - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_dihedrals_count + + [] + + [src]

+
pub unsafe extern fn chfl_topology_dihedrals_count(topology: *const CHFL_TOPOLOGY, ndihedrals: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_free.html b/0.4.0/chemfiles_sys/fn.chfl_topology_free.html new file mode 100644 index 000000000..d844d58af --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_free.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_free - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_free + + [] + + [src]

+
pub unsafe extern fn chfl_topology_free(topology: *mut CHFL_TOPOLOGY) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_from_frame.html b/0.4.0/chemfiles_sys/fn.chfl_topology_from_frame.html new file mode 100644 index 000000000..547f87f38 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_from_frame.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_from_frame - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_from_frame + + [] + + [src]

+
pub unsafe extern fn chfl_topology_from_frame(frame: *mut CHFL_FRAME) -> *mut CHFL_TOPOLOGY
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_isangle.html b/0.4.0/chemfiles_sys/fn.chfl_topology_isangle.html new file mode 100644 index 000000000..d1ebbd975 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_isangle.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_isangle - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_isangle + + [] + + [src]

+
pub unsafe extern fn chfl_topology_isangle(topology: *const CHFL_TOPOLOGY, i: size_t, j: size_t, k: size_t, result: *mut u8) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_isbond.html b/0.4.0/chemfiles_sys/fn.chfl_topology_isbond.html new file mode 100644 index 000000000..3ef7dc52f --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_isbond.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_isbond - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_isbond + + [] + + [src]

+
pub unsafe extern fn chfl_topology_isbond(topology: *const CHFL_TOPOLOGY, i: size_t, j: size_t, result: *mut u8) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_isdihedral.html b/0.4.0/chemfiles_sys/fn.chfl_topology_isdihedral.html new file mode 100644 index 000000000..4f793094c --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_isdihedral.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_isdihedral - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_isdihedral + + [] + + [src]

+
pub unsafe extern fn chfl_topology_isdihedral(topology: *const CHFL_TOPOLOGY, i: size_t, j: size_t, k: size_t, m: size_t, result: *mut u8) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_remove.html b/0.4.0/chemfiles_sys/fn.chfl_topology_remove.html new file mode 100644 index 000000000..ceceb3087 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_remove.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_remove - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_remove + + [] + + [src]

+
pub unsafe extern fn chfl_topology_remove(topology: *mut CHFL_TOPOLOGY, i: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_topology_remove_bond.html b/0.4.0/chemfiles_sys/fn.chfl_topology_remove_bond.html new file mode 100644 index 000000000..90b2aa733 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_topology_remove_bond.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_topology_remove_bond - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_topology_remove_bond + + [] + + [src]

+
pub unsafe extern fn chfl_topology_remove_bond(topology: *mut CHFL_TOPOLOGY, i: size_t, j: size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_close.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_close.html new file mode 100644 index 000000000..3fc38e2cc --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_close.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_close - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_close + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_close(file: *mut CHFL_TRAJECTORY) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_nsteps.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_nsteps.html new file mode 100644 index 000000000..708a831ab --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_nsteps.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_nsteps - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_nsteps + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_nsteps(file: *mut CHFL_TRAJECTORY, nsteps: *mut size_t) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_open.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_open.html new file mode 100644 index 000000000..d6463cbb0 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_open.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_open - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_open + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_open(filename: *const c_char, mode: *const c_char) -> *mut CHFL_TRAJECTORY
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_read.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_read.html new file mode 100644 index 000000000..16db24669 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_read.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_read - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_read + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_read(file: *mut CHFL_TRAJECTORY, frame: *mut CHFL_FRAME) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_read_step.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_read_step.html new file mode 100644 index 000000000..452cfa11e --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_read_step.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_read_step - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_read_step + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_read_step(file: *mut CHFL_TRAJECTORY, step: size_t, frame: *mut CHFL_FRAME) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_cell.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_cell.html new file mode 100644 index 000000000..675276919 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_cell.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_set_cell - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_set_cell + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_set_cell(file: *mut CHFL_TRAJECTORY, cell: *const CHFL_CELL) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology.html new file mode 100644 index 000000000..cbca2086d --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_set_topology - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_set_topology + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_set_topology(file: *mut CHFL_TRAJECTORY, topology: *const CHFL_TOPOLOGY) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology_file.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology_file.html new file mode 100644 index 000000000..6cfb4e60a --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology_file.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_set_topology_file - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_set_topology_file + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_set_topology_file(file: *mut CHFL_TRAJECTORY, filename: *const c_char) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology_with_format.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology_with_format.html new file mode 100644 index 000000000..08f297599 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_set_topology_with_format.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_set_topology_with_format - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_set_topology_with_format + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_set_topology_with_format(file: *mut CHFL_TRAJECTORY, filename: *const c_char, format: *const c_char) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_sync.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_sync.html new file mode 100644 index 000000000..a77d7bc22 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_sync.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_sync - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_sync + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_sync(file: *mut CHFL_TRAJECTORY) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_with_format.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_with_format.html new file mode 100644 index 000000000..99c55b5f2 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_with_format.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_with_format - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_with_format + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_with_format(filename: *const c_char, mode: *const c_char, format: *const c_char) -> *mut CHFL_TRAJECTORY
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_trajectory_write.html b/0.4.0/chemfiles_sys/fn.chfl_trajectory_write.html new file mode 100644 index 000000000..4b190a566 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_trajectory_write.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_trajectory_write - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_trajectory_write + + [] + + [src]

+
pub unsafe extern fn chfl_trajectory_write(file: *mut CHFL_TRAJECTORY, frame: *const CHFL_FRAME) -> CHFL_STATUS
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/fn.chfl_version.html b/0.4.0/chemfiles_sys/fn.chfl_version.html new file mode 100644 index 000000000..5b9e0fbb7 --- /dev/null +++ b/0.4.0/chemfiles_sys/fn.chfl_version.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_version - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_version + + [] + + [src]

+
pub unsafe extern fn chfl_version() -> *const c_char
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/index.html b/0.4.0/chemfiles_sys/index.html new file mode 100644 index 000000000..3decf84ea --- /dev/null +++ b/0.4.0/chemfiles_sys/index.html @@ -0,0 +1,809 @@ + + + + + + + + + + chemfiles_sys - Rust + + + + + + + + + + + + + + + + + +
+

Crate chemfiles_sys + + [] + + [src]

+

Enums

+ + + + + + + + + + + + + + + + + + + + +
CHFL_ATOM + +
CHFL_CELL + +
CHFL_FRAME + +
CHFL_TOPOLOGY + +
CHFL_TRAJECTORY + +

Constants

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CORSE_GRAIN + +
DEBUG + +
DUMMY + +
ELEMENT + +
ERROR + +
INFINITE + +
INFO + +
NONE + +
ORTHOROMBIC + +
TRICLINIC + +
UNDEFINED + +
WARNING + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
chfl_atom + +
chfl_atom_atomic_number + +
chfl_atom_charge + +
chfl_atom_covalent_radius + +
chfl_atom_free + +
chfl_atom_from_frame + +
chfl_atom_from_topology + +
chfl_atom_full_name + +
chfl_atom_mass + +
chfl_atom_name + +
chfl_atom_set_charge + +
chfl_atom_set_mass + +
chfl_atom_set_name + +
chfl_atom_set_type + +
chfl_atom_type + +
chfl_atom_vdw_radius + +
chfl_cell + +
chfl_cell_angles + +
chfl_cell_free + +
chfl_cell_from_frame + +
chfl_cell_lengths + +
chfl_cell_matrix + +
chfl_cell_periodicity + +
chfl_cell_set_angles + +
chfl_cell_set_lengths + +
chfl_cell_set_periodicity + +
chfl_cell_set_type + +
chfl_cell_triclinic + +
chfl_cell_type + +
chfl_cell_volume + +
chfl_frame + +
chfl_frame_atoms_count + +
chfl_frame_free + +
chfl_frame_guess_topology + +
chfl_frame_has_velocities + +
chfl_frame_positions + +
chfl_frame_set_cell + +
chfl_frame_set_positions + +
chfl_frame_set_step + +
chfl_frame_set_topology + +
chfl_frame_set_velocities + +
chfl_frame_step + +
chfl_frame_velocities + +
chfl_last_error + +
chfl_log_stderr + +
chfl_logfile + +
chfl_loglevel + +
chfl_set_loglevel + +
chfl_strerror + +
chfl_topology + +
chfl_topology_add_bond + +
chfl_topology_angles + +
chfl_topology_angles_count + +
chfl_topology_append + +
chfl_topology_atoms_count + +
chfl_topology_bonds + +
chfl_topology_bonds_count + +
chfl_topology_dihedrals + +
chfl_topology_dihedrals_count + +
chfl_topology_free + +
chfl_topology_from_frame + +
chfl_topology_isangle + +
chfl_topology_isbond + +
chfl_topology_isdihedral + +
chfl_topology_remove + +
chfl_topology_remove_bond + +
chfl_trajectory_close + +
chfl_trajectory_nsteps + +
chfl_trajectory_open + +
chfl_trajectory_read + +
chfl_trajectory_read_step + +
chfl_trajectory_set_cell + +
chfl_trajectory_set_topology + +
chfl_trajectory_set_topology_file + +
chfl_trajectory_sync + +
chfl_trajectory_with_format + +
chfl_trajectory_write + +

Type Definitions

+ + + + + + + + + + + + + + + + + + + + +
CHFL_ATOM_TYPE + +
CHFL_CELL_TYPE + +
CHFL_LOG_LEVEL + +
CHFL_STATUS + +
size_t + +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/sidebar-items.js b/0.4.0/chemfiles_sys/sidebar-items.js new file mode 100644 index 000000000..9ef72310b --- /dev/null +++ b/0.4.0/chemfiles_sys/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"constant":[["CORSE_GRAIN",""],["DEBUG",""],["DUMMY",""],["ELEMENT",""],["ERROR",""],["INFINITE",""],["INFO",""],["NONE",""],["ORTHOROMBIC",""],["TRICLINIC",""],["UNDEFINED",""],["WARNING",""]],"enum":[["CHFL_ATOM",""],["CHFL_CELL",""],["CHFL_FRAME",""],["CHFL_TOPOLOGY",""],["CHFL_TRAJECTORY",""]],"fn":[["chfl_atom",""],["chfl_atom_atomic_number",""],["chfl_atom_charge",""],["chfl_atom_covalent_radius",""],["chfl_atom_free",""],["chfl_atom_from_frame",""],["chfl_atom_from_topology",""],["chfl_atom_full_name",""],["chfl_atom_mass",""],["chfl_atom_name",""],["chfl_atom_set_charge",""],["chfl_atom_set_mass",""],["chfl_atom_set_name",""],["chfl_atom_set_type",""],["chfl_atom_type",""],["chfl_atom_vdw_radius",""],["chfl_cell",""],["chfl_cell_angles",""],["chfl_cell_free",""],["chfl_cell_from_frame",""],["chfl_cell_lengths",""],["chfl_cell_matrix",""],["chfl_cell_periodicity",""],["chfl_cell_set_angles",""],["chfl_cell_set_lengths",""],["chfl_cell_set_periodicity",""],["chfl_cell_set_type",""],["chfl_cell_triclinic",""],["chfl_cell_type",""],["chfl_cell_volume",""],["chfl_frame",""],["chfl_frame_atoms_count",""],["chfl_frame_free",""],["chfl_frame_guess_topology",""],["chfl_frame_has_velocities",""],["chfl_frame_positions",""],["chfl_frame_set_cell",""],["chfl_frame_set_positions",""],["chfl_frame_set_step",""],["chfl_frame_set_topology",""],["chfl_frame_set_velocities",""],["chfl_frame_step",""],["chfl_frame_velocities",""],["chfl_last_error",""],["chfl_log_stderr",""],["chfl_logfile",""],["chfl_loglevel",""],["chfl_set_loglevel",""],["chfl_strerror",""],["chfl_topology",""],["chfl_topology_add_bond",""],["chfl_topology_angles",""],["chfl_topology_angles_count",""],["chfl_topology_append",""],["chfl_topology_atoms_count",""],["chfl_topology_bonds",""],["chfl_topology_bonds_count",""],["chfl_topology_dihedrals",""],["chfl_topology_dihedrals_count",""],["chfl_topology_free",""],["chfl_topology_from_frame",""],["chfl_topology_isangle",""],["chfl_topology_isbond",""],["chfl_topology_isdihedral",""],["chfl_topology_remove",""],["chfl_topology_remove_bond",""],["chfl_trajectory_close",""],["chfl_trajectory_nsteps",""],["chfl_trajectory_open",""],["chfl_trajectory_read",""],["chfl_trajectory_read_step",""],["chfl_trajectory_set_cell",""],["chfl_trajectory_set_topology",""],["chfl_trajectory_set_topology_file",""],["chfl_trajectory_sync",""],["chfl_trajectory_with_format",""],["chfl_trajectory_write",""]],"type":[["CHFL_ATOM_TYPE",""],["CHFL_CELL_TYPE",""],["CHFL_LOG_LEVEL",""],["CHFL_STATUS",""],["size_t",""]]}); \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/struct.chfl_match_t.html b/0.4.0/chemfiles_sys/struct.chfl_match_t.html new file mode 100644 index 000000000..7f20fb706 --- /dev/null +++ b/0.4.0/chemfiles_sys/struct.chfl_match_t.html @@ -0,0 +1,123 @@ + + + + + + + + + + chemfiles_sys::chfl_match_t - Rust + + + + + + + + + + + + + + + + + +
+

Struct chemfiles_sys::chfl_match_t + + [] + + [src]

+
pub struct chfl_match_t {
+    pub size: c_char,
+    pub atoms: [size_t; 4],
+}

Fields

+ + +
size
atoms

Trait Implementations

Derived Implementations

impl Eq for chfl_match_t

impl PartialEq for chfl_match_t

fn eq(&self, __arg_0: &chfl_match_t) -> bool

+

fn ne(&self, __arg_0: &chfl_match_t) -> bool

+

impl Debug for chfl_match_t

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+

impl Copy for chfl_match_t

impl Clone for chfl_match_t

fn clone(&self) -> chfl_match_t

+

1.0.0fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.CHFL_ATOM_TYPE.html b/0.4.0/chemfiles_sys/type.CHFL_ATOM_TYPE.html new file mode 100644 index 000000000..b750a4786 --- /dev/null +++ b/0.4.0/chemfiles_sys/type.CHFL_ATOM_TYPE.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_ATOM_TYPE - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_ATOM_TYPE + + [] + + [src]

+
type CHFL_ATOM_TYPE = c_uint;
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.CHFL_ATOM_TYPES.html b/0.4.0/chemfiles_sys/type.CHFL_ATOM_TYPES.html new file mode 100644 index 000000000..b06b2da0f --- /dev/null +++ b/0.4.0/chemfiles_sys/type.CHFL_ATOM_TYPES.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_ATOM_TYPES - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_ATOM_TYPES + + [] + + [src]

+
type CHFL_ATOM_TYPES = c_uint;
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.CHFL_CELL_TYPE.html b/0.4.0/chemfiles_sys/type.CHFL_CELL_TYPE.html new file mode 100644 index 000000000..223126c38 --- /dev/null +++ b/0.4.0/chemfiles_sys/type.CHFL_CELL_TYPE.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_CELL_TYPE - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_CELL_TYPE + + [] + + [src]

+
type CHFL_CELL_TYPE = c_uint;
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.CHFL_CELL_TYPES.html b/0.4.0/chemfiles_sys/type.CHFL_CELL_TYPES.html new file mode 100644 index 000000000..2c8887c90 --- /dev/null +++ b/0.4.0/chemfiles_sys/type.CHFL_CELL_TYPES.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_CELL_TYPES - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_CELL_TYPES + + [] + + [src]

+
type CHFL_CELL_TYPES = c_uint;
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.CHFL_LOG_LEVEL.html b/0.4.0/chemfiles_sys/type.CHFL_LOG_LEVEL.html new file mode 100644 index 000000000..a74745310 --- /dev/null +++ b/0.4.0/chemfiles_sys/type.CHFL_LOG_LEVEL.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_LOG_LEVEL - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_LOG_LEVEL + + [] + + [src]

+
type CHFL_LOG_LEVEL = c_uint;
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.CHFL_STATUS.html b/0.4.0/chemfiles_sys/type.CHFL_STATUS.html new file mode 100644 index 000000000..4c1a48103 --- /dev/null +++ b/0.4.0/chemfiles_sys/type.CHFL_STATUS.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::CHFL_STATUS - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::CHFL_STATUS + + [] + + [src]

+
type CHFL_STATUS = c_int;
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.c_bool.html b/0.4.0/chemfiles_sys/type.c_bool.html new file mode 100644 index 000000000..ceaea7e17 --- /dev/null +++ b/0.4.0/chemfiles_sys/type.c_bool.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::c_bool - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::c_bool + + [] + + [src]

+
type c_bool = u8;
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.chfl_logging_callback_t.html b/0.4.0/chemfiles_sys/type.chfl_logging_callback_t.html new file mode 100644 index 000000000..418ab5d27 --- /dev/null +++ b/0.4.0/chemfiles_sys/type.chfl_logging_callback_t.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::chfl_logging_callback_t - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::chfl_logging_callback_t + + [] + + [src]

+
type chfl_logging_callback_t =  extern "C" fn(CHFL_LOG_LEVEL, *const c_char);
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/chemfiles_sys/type.size_t.html b/0.4.0/chemfiles_sys/type.size_t.html new file mode 100644 index 000000000..3fd0b770b --- /dev/null +++ b/0.4.0/chemfiles_sys/type.size_t.html @@ -0,0 +1,112 @@ + + + + + + + + + + chemfiles_sys::size_t - Rust + + + + + + + + + + + + + + + + + +
+

chemfiles_sys::size_t + + [] + + [src]

+
type size_t = usize;
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/0.4.0/implementors/core/borrow/trait.Borrow.js b/0.4.0/implementors/core/borrow/trait.Borrow.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/borrow/trait.Borrow.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/borrow/trait.BorrowMut.js b/0.4.0/implementors/core/borrow/trait.BorrowMut.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/borrow/trait.BorrowMut.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/clone/trait.Clone.js b/0.4.0/implementors/core/clone/trait.Clone.js new file mode 100644 index 000000000..1199be9bc --- /dev/null +++ b/0.4.0/implementors/core/clone/trait.Clone.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = ["impl Clone for stat","impl Clone for stat64","impl Clone for pthread_attr_t","impl Clone for sigset_t","impl Clone for sigaction","impl Clone for stack_t","impl Clone for siginfo_t","impl Clone for glob64_t","impl Clone for ucred","impl Clone for statfs","impl Clone for msghdr","impl Clone for termios","impl Clone for flock","impl Clone for ipc_perm","impl Clone for shmid_ds","impl Clone for dirent","impl Clone for dirent64","impl Clone for rlimit64","impl Clone for glob_t","impl Clone for ifaddrs","impl Clone for pthread_mutex_t","impl Clone for pthread_rwlock_t","impl Clone for pthread_mutexattr_t","impl Clone for pthread_cond_t","impl Clone for passwd","impl Clone for statvfs","impl Clone for sockaddr_nl","impl Clone for dqblk","impl Clone for signalfd_siginfo","impl Clone for fsid_t","impl Clone for mq_attr","impl Clone for cpu_set_t","impl Clone for sockaddr","impl Clone for sockaddr_in","impl Clone for sockaddr_in6","impl Clone for sockaddr_un","impl Clone for sockaddr_storage","impl Clone for addrinfo","impl Clone for sockaddr_ll","impl Clone for fd_set","impl Clone for tm","impl Clone for sched_param","impl Clone for Dl_info","impl Clone for epoll_event","impl Clone for utsname","impl Clone for utimbuf","impl Clone for timeval","impl Clone for timespec","impl Clone for rlimit","impl Clone for rusage","impl Clone for in_addr","impl Clone for in6_addr","impl Clone for ip_mreq","impl Clone for ipv6_mreq","impl Clone for hostent","impl Clone for iovec","impl Clone for pollfd",];implementors['chemfiles_sys'] = ["impl Clone for chfl_match_t",];implementors['chemfiles'] = ["impl Clone for Error","impl Clone for ErrorKind","impl Clone for LogLevel","impl Clone for AtomType","impl Clone for CellType","impl Clone for Match",];implementors['chemfiles'] = ["impl Clone for Error","impl Clone for LogLevel","impl Clone for AtomType","impl Clone for CellType",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/cmp/trait.Eq.js b/0.4.0/implementors/core/cmp/trait.Eq.js new file mode 100644 index 000000000..d7ef9959d --- /dev/null +++ b/0.4.0/implementors/core/cmp/trait.Eq.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = [];implementors['chemfiles_sys'] = ["impl Eq for chfl_match_t",];implementors['chemfiles'] = ["impl Eq for AtomType","impl Eq for CellType","impl Eq for Match",];implementors['chemfiles'] = ["impl Eq for AtomType","impl Eq for CellType",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/cmp/trait.Ord.js b/0.4.0/implementors/core/cmp/trait.Ord.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/cmp/trait.Ord.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/cmp/trait.PartialEq.js b/0.4.0/implementors/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..9c9f9b6ae --- /dev/null +++ b/0.4.0/implementors/core/cmp/trait.PartialEq.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = [];implementors['chemfiles_sys'] = ["impl PartialEq for chfl_match_t",];implementors['chemfiles'] = ["impl PartialEq for Error","impl PartialEq for ErrorKind","impl PartialEq for LogLevel","impl PartialEq for AtomType","impl PartialEq for CellType","impl PartialEq for Match",];implementors['chemfiles'] = ["impl PartialEq for Error","impl PartialEq for LogLevel","impl PartialEq for AtomType","impl PartialEq for CellType",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/cmp/trait.PartialOrd.js b/0.4.0/implementors/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/cmp/trait.PartialOrd.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/convert/trait.AsMut.js b/0.4.0/implementors/core/convert/trait.AsMut.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/convert/trait.AsMut.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/convert/trait.AsRef.js b/0.4.0/implementors/core/convert/trait.AsRef.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/convert/trait.AsRef.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/convert/trait.From.js b/0.4.0/implementors/core/convert/trait.From.js new file mode 100644 index 000000000..17c47c88c --- /dev/null +++ b/0.4.0/implementors/core/convert/trait.From.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = [];implementors['chemfiles'] = ["impl From<CHFL_STATUS> for Error","impl From<CHFL_LOG_LEVEL> for LogLevel","impl From<CHFL_ATOM_TYPES> for AtomType","impl From<CHFL_CELL_TYPES> for CellType",];implementors['chemfiles'] = ["impl From<CHFL_STATUS> for Error","impl From<Error> for CHFL_STATUS","impl From<CHFL_LOG_LEVEL> for LogLevel","impl From<CHFL_ATOM_TYPE> for AtomType","impl From<CHFL_CELL_TYPE> for CellType",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/default/trait.Default.js b/0.4.0/implementors/core/default/trait.Default.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/default/trait.Default.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.Binary.js b/0.4.0/implementors/core/fmt/trait.Binary.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.Binary.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.Debug.js b/0.4.0/implementors/core/fmt/trait.Debug.js new file mode 100644 index 000000000..8ed9762c8 --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.Debug.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = [];implementors['chemfiles_sys'] = ["impl Debug for chfl_match_t",];implementors['chemfiles'] = ["impl Debug for Error","impl Debug for ErrorKind","impl Debug for LogLevel","impl Debug for AtomType","impl Debug for CellType","impl Debug for Match",];implementors['chemfiles'] = ["impl Debug for Error","impl Debug for LogLevel","impl Debug for AtomType","impl Debug for CellType",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.Display.js b/0.4.0/implementors/core/fmt/trait.Display.js new file mode 100644 index 000000000..d6095210b --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.Display.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = [];implementors['chemfiles'] = ["impl Display for Error",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.LowerExp.js b/0.4.0/implementors/core/fmt/trait.LowerExp.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.LowerExp.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.LowerHex.js b/0.4.0/implementors/core/fmt/trait.LowerHex.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.LowerHex.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.Octal.js b/0.4.0/implementors/core/fmt/trait.Octal.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.Octal.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.Pointer.js b/0.4.0/implementors/core/fmt/trait.Pointer.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.Pointer.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.UpperExp.js b/0.4.0/implementors/core/fmt/trait.UpperExp.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.UpperExp.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/fmt/trait.UpperHex.js b/0.4.0/implementors/core/fmt/trait.UpperHex.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/fmt/trait.UpperHex.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/hash/trait.Hash.js b/0.4.0/implementors/core/hash/trait.Hash.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/hash/trait.Hash.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/iter/trait.FromIterator.js b/0.4.0/implementors/core/iter/trait.FromIterator.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/iter/trait.FromIterator.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/iter/trait.IntoIterator.js b/0.4.0/implementors/core/iter/trait.IntoIterator.js new file mode 100644 index 000000000..579d0c8f7 --- /dev/null +++ b/0.4.0/implementors/core/iter/trait.IntoIterator.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = [];implementors['chemfiles'] = ["impl<'a> IntoIterator for &'a Match",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/iter/trait.Step.js b/0.4.0/implementors/core/iter/trait.Step.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/iter/trait.Step.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/marker/trait.Copy.js b/0.4.0/implementors/core/marker/trait.Copy.js new file mode 100644 index 000000000..a8b2be785 --- /dev/null +++ b/0.4.0/implementors/core/marker/trait.Copy.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = ["impl Copy for stat","impl Copy for stat64","impl Copy for pthread_attr_t","impl Copy for sigset_t","impl Copy for sigaction","impl Copy for stack_t","impl Copy for siginfo_t","impl Copy for glob64_t","impl Copy for ucred","impl Copy for statfs","impl Copy for msghdr","impl Copy for termios","impl Copy for flock","impl Copy for ipc_perm","impl Copy for shmid_ds","impl Copy for dirent","impl Copy for dirent64","impl Copy for rlimit64","impl Copy for glob_t","impl Copy for ifaddrs","impl Copy for pthread_mutex_t","impl Copy for pthread_rwlock_t","impl Copy for pthread_mutexattr_t","impl Copy for pthread_cond_t","impl Copy for passwd","impl Copy for statvfs","impl Copy for sockaddr_nl","impl Copy for dqblk","impl Copy for signalfd_siginfo","impl Copy for fsid_t","impl Copy for mq_attr","impl Copy for cpu_set_t","impl Copy for sockaddr","impl Copy for sockaddr_in","impl Copy for sockaddr_in6","impl Copy for sockaddr_un","impl Copy for sockaddr_storage","impl Copy for addrinfo","impl Copy for sockaddr_ll","impl Copy for fd_set","impl Copy for tm","impl Copy for sched_param","impl Copy for Dl_info","impl Copy for epoll_event","impl Copy for utsname","impl Copy for utimbuf","impl Copy for timeval","impl Copy for timespec","impl Copy for rlimit","impl Copy for rusage","impl Copy for in_addr","impl Copy for in6_addr","impl Copy for ip_mreq","impl Copy for ipv6_mreq","impl Copy for hostent","impl Copy for iovec","impl Copy for pollfd",];implementors['chemfiles_sys'] = ["impl Copy for chfl_match_t",];implementors['chemfiles'] = ["impl Copy for Match",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/marker/trait.Send.js b/0.4.0/implementors/core/marker/trait.Send.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/marker/trait.Send.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/marker/trait.Sync.js b/0.4.0/implementors/core/marker/trait.Sync.js new file mode 100644 index 000000000..cd82fd32a --- /dev/null +++ b/0.4.0/implementors/core/marker/trait.Sync.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['lazy_static'] = ["impl<T: Sync> Sync for Lazy<T>",];implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/nonzero/trait.Zeroable.js b/0.4.0/implementors/core/nonzero/trait.Zeroable.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/nonzero/trait.Zeroable.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/num/trait.One.js b/0.4.0/implementors/core/num/trait.One.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/num/trait.One.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/num/trait.Zero.js b/0.4.0/implementors/core/num/trait.Zero.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/num/trait.Zero.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Add.js b/0.4.0/implementors/core/ops/trait.Add.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Add.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.AddAssign.js b/0.4.0/implementors/core/ops/trait.AddAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.AddAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.BitAnd.js b/0.4.0/implementors/core/ops/trait.BitAnd.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.BitAnd.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.BitAndAssign.js b/0.4.0/implementors/core/ops/trait.BitAndAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.BitAndAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.BitOr.js b/0.4.0/implementors/core/ops/trait.BitOr.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.BitOr.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.BitOrAssign.js b/0.4.0/implementors/core/ops/trait.BitOrAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.BitOrAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.BitXor.js b/0.4.0/implementors/core/ops/trait.BitXor.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.BitXor.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.BitXorAssign.js b/0.4.0/implementors/core/ops/trait.BitXorAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.BitXorAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.CoerceUnsized.js b/0.4.0/implementors/core/ops/trait.CoerceUnsized.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.CoerceUnsized.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Div.js b/0.4.0/implementors/core/ops/trait.Div.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Div.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.DivAssign.js b/0.4.0/implementors/core/ops/trait.DivAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.DivAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Drop.js b/0.4.0/implementors/core/ops/trait.Drop.js new file mode 100644 index 000000000..31fe0c364 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Drop.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['chemfiles'] = ["impl Drop for Atom","impl Drop for UnitCell","impl Drop for Topology","impl Drop for Frame","impl Drop for Trajectory","impl Drop for Selection",];implementors['chemfiles'] = ["impl Drop for Atom","impl Drop for UnitCell","impl Drop for Topology","impl Drop for Frame","impl Drop for Trajectory",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Index.js b/0.4.0/implementors/core/ops/trait.Index.js new file mode 100644 index 000000000..c46da417a --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Index.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = [];implementors['chemfiles'] = ["impl Index<usize> for Match",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.IndexMut.js b/0.4.0/implementors/core/ops/trait.IndexMut.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.IndexMut.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Mul.js b/0.4.0/implementors/core/ops/trait.Mul.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Mul.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.MulAssign.js b/0.4.0/implementors/core/ops/trait.MulAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.MulAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Neg.js b/0.4.0/implementors/core/ops/trait.Neg.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Neg.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Not.js b/0.4.0/implementors/core/ops/trait.Not.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Not.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Rem.js b/0.4.0/implementors/core/ops/trait.Rem.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Rem.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.RemAssign.js b/0.4.0/implementors/core/ops/trait.RemAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.RemAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Shl.js b/0.4.0/implementors/core/ops/trait.Shl.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Shl.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.ShlAssign.js b/0.4.0/implementors/core/ops/trait.ShlAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.ShlAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Shr.js b/0.4.0/implementors/core/ops/trait.Shr.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Shr.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.ShrAssign.js b/0.4.0/implementors/core/ops/trait.ShrAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.ShrAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.Sub.js b/0.4.0/implementors/core/ops/trait.Sub.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.Sub.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/ops/trait.SubAssign.js b/0.4.0/implementors/core/ops/trait.SubAssign.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/ops/trait.SubAssign.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/raw/trait.Repr.js b/0.4.0/implementors/core/raw/trait.Repr.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/raw/trait.Repr.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/slice/trait.SliceExt.js b/0.4.0/implementors/core/slice/trait.SliceExt.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/slice/trait.SliceExt.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/str/pattern/trait.Pattern.js b/0.4.0/implementors/core/str/pattern/trait.Pattern.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/str/pattern/trait.Pattern.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/core/str/trait.FromStr.js b/0.4.0/implementors/core/str/trait.FromStr.js new file mode 100644 index 000000000..5fd020f37 --- /dev/null +++ b/0.4.0/implementors/core/str/trait.FromStr.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['libc'] = []; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/implementors/std/error/trait.Error.js b/0.4.0/implementors/std/error/trait.Error.js new file mode 100644 index 000000000..7454d995e --- /dev/null +++ b/0.4.0/implementors/std/error/trait.Error.js @@ -0,0 +1,10 @@ +(function() {var implementors = {}; +implementors['chemfiles'] = ["impl Error for Error",]; + + if (window.register_implementors) { + window.register_implementors(implementors); + } else { + window.pending_implementors = implementors; + } + +})() diff --git a/0.4.0/index.html b/0.4.0/index.html new file mode 100644 index 000000000..8b8b920bb --- /dev/null +++ b/0.4.0/index.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/0.4.0/jquery.js b/0.4.0/jquery.js new file mode 100644 index 000000000..49990d6e1 --- /dev/null +++ b/0.4.0/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b="length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){ +return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*\s*$/g,ia={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ka(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,"script"),g.length>0&&ma(g,!i&&oa(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement("div")),g=(ba.exec(e)||["",""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),"script"),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(aa,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,"script"),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),"none"!==c&&c||(qa=(qa||n("