こんにちは、R&Dチームの齋藤(@aznhe21)です。 ワクチンも効いたからと飲みに行ったら酒に飲まれてしまいました。
さて、本日10/22(金)にRust 1.56がリリースされました。 この記事ではRust 1.56での変更点を詳しく紹介します。
- ピックアップ
- 安定化されたAPIのドキュメント
- std::os::unix::fs::chroot
- core::cell::UnsafeCell::raw_get
- std::io::BufWriter::into_parts
- alloc::vec::Vec::shrink_to
- alloc::string::String::shrink_to
- std::ffi::OsString::shrink_to
- std::path::PathBuf::shrink_to
- alloc::collections::BinaryHeap::shrink_to
- alloc::collections::VecDeque::shrink_to
- alloc::collections::HashMap::shrink_to
- alloc::collections::HashSet::shrink_to
- 変更点リスト
- 関連リンク
- さいごに
- ライセンス表記
ピックアップ
個人的に注目する変更点を「ピックアップ」としてまとめました。 全ての変更点を網羅したリストは変更点リストをご覧ください。
Rust 2021エディションが安定化
Rust 2021が安定化されました。cargo fix --editionを実行し、Cargo.tomlにedition = "2021"と記述することで使えるようになります。
配列を直接イテレーターとして回せるようになったり、
TryFrom / TryIntoなどをuseせずに使えるようになったり、
クロージャで構造体をキャプチャすろ時にフィールド別にキャプチャ出来るようになったりと、
細かいながらも互換性の観点から変更出来なかったものが多いようです。
Rust 2021の変更点はこちらの記事にまとまっていますので、併せてご参照ください。
クレートがサポートする最小のRustバージョンを明示出来るように
これまでのCargoではクレートがサポートする最小のRustバージョンを明示することが出来ず、 Rustが古いままクレートを更新するとよく分からないエラーが出ることがありました。 GitHubを見に行くと実はREADMEにその記述があったりすることも良くあります。
Rust 1.56からはCargo.tomlにrust-versionを指定することで、クレートがサポートする最小のRustバージョンを明示出来るようになり、
このような分かりにくいエラーを抑制したり、クレートとしてのポリシーを明確化することが出来ます。
例えばCargo.tomlに以下のように記述されている場合、このsugoi-crateはRust 1.0以上をサポートしているということです。
[package] name = "sugoi-crate" version = "1.0.0" rust-version = "1.0"
安定化されたAPIのドキュメント
安定化されたAPIのドキュメントを独自に訳して紹介します。リストだけ見たい方は安定化されたAPIをご覧ください。
std::os::unix::fs::chroot
#[stable(feature = "unix_chroot", since = "1.56.0")] #[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))] pub fn chroot<P: AsRef<Path>>(dir: P) -> io::Result<()> { /* 実装は省略 */ }
FuchsiaとVxWorksを除くUNIX系OSでのみサポートされる。
現在のプロセスのルートディレクトリを指定されたパスに変更する。
これには概してrootや特定のケーパビリティといった特権を必要とする。
これは作業ディレクトリを変更しないので、後でstd::env::set_current_dirを呼び出すべきである。
サンプル
use std::os::unix::fs; fn main() -> std::io::Result<()> { fs::chroot("/sandbox")?; std::env::set_current_dir("/")?; // sandboxで作業を続ける Ok(()) }
core::cell::UnsafeCell::raw_get
impl<T: ?Sized> UnsafeCell<T> { #[inline(always)] #[stable(feature = "unsafe_cell_raw_get", since = "1.56.0")] pub const fn raw_get(this: *const Self) -> *mut T { /* 実装は省略 */ } }
内包する値への可変ポインタを取得する。
getとの違いは生ポインタを受け付ける点であり、一時的な参照の生成を抑えることが出来る。
戻り値はどんな種類のポインタにもキャスト出来る。
&mut Tにキャストする際はそのアクセスが一意である(可変か否かに関わらず有効な参照が無い)ことを、
また&Tにキャストする際は変異や可変のエイリアスが発生し得ないことを確認すること。
サンプル
UnsafeCellの段階的な初期化には、getでは未初期化データへの参照が発生するのでraw_getが必要。
use std::cell::UnsafeCell; use std::mem::MaybeUninit; let m = MaybeUninit::<UnsafeCell<i32>>::uninit(); unsafe { UnsafeCell::raw_get(m.as_ptr()).write(5); } let uc = unsafe { m.assume_init() }; assert_eq!(uc.into_inner(), 5);
std::io::BufWriter::into_parts
impl<W: Write> BufWriter<W> { #[stable(feature = "bufwriter_into_parts", since = "1.56.0")] pub fn into_parts(mut self) -> (W, Result<Vec<u8>, WriterPanicked>) { /* 実装は省略 */ } }
このBufWriter<W>を分解し、内包するwriterとバッファされたが未書き込みのデータを返す。
内包するwriterがパニックしていた場合、データのどの部分が書き込まれたのかは不明である。
この場合、(依然として回復可能な)バッファされたデータを含むWriterPanickedを返す。
into_partsはデータを出力(フラッシュ)せず、失敗することも無い。
サンプル
use std::io::{BufWriter, Write}; let mut buffer = [0u8; 15]; let mut stream = BufWriter::new(buffer.as_mut()); write!(stream, "大きすぎるデータ").unwrap(); stream.flush().expect_err("書き込めない"); let (recovered_writer, buffered_data) = stream.into_parts(); assert_eq!(recovered_writer.len(), 0); assert_eq!(&buffered_data.unwrap(), "データ".as_bytes());
alloc::vec::Vec::shrink_to
impl<T, A: Allocator> Vec<T, A> { #[cfg(not(no_global_oom_handling))] #[stable(feature = "shrink_to", since = "1.56.0")] pub fn shrink_to(&mut self, min_capacity: usize) { /* 実装は省略 */ } }
ベクタの容量を下限値まで縮小する。
指定された値と現在の長さでより大きい方の分の容量は維持される。
現在の容量が下限値よりも小さい場合は無操作である。
サンプル
let mut vec = Vec::with_capacity(10); vec.extend([1, 2, 3]); assert_eq!(vec.capacity(), 10); vec.shrink_to(4); assert!(vec.capacity() >= 4); vec.shrink_to(0); assert!(vec.capacity() >= 3);
alloc::string::String::shrink_to
impl String { #[cfg(not(no_global_oom_handling))] #[inline] #[stable(feature = "shrink_to", since = "1.56.0")] pub fn shrink_to(&mut self, min_capacity: usize) { /* 実装は省略 */ } }
Stringの容量を下限値まで縮小する。
指定された値と現在の長さでより大きい方の分の容量は維持される。
現在の容量が下限値よりも小さい場合は無操作である。
サンプル
let mut s = String::from("foo"); s.reserve(100); assert!(s.capacity() >= 100); s.shrink_to(10); assert!(s.capacity() >= 10); s.shrink_to(0); assert!(s.capacity() >= 3);
std::ffi::OsString::shrink_to
impl OsString { #[inline] #[stable(feature = "shrink_to", since = "1.56.0")] pub fn shrink_to(&mut self, min_capacity: usize) { /* 実装は省略 */ } }
OsStringの容量を下限値まで縮小する。
指定された値と現在の長さでより大きい方の分の容量は維持される。
現在の容量が下限値よりも小さい場合は無操作である。
サンプル
use std::ffi::OsString; let mut s = OsString::from("foo"); s.reserve(100); assert!(s.capacity() >= 100); s.shrink_to(10); assert!(s.capacity() >= 10); s.shrink_to(0); assert!(s.capacity() >= 3);
std::path::PathBuf::shrink_to
impl PathBuf { #[stable(feature = "shrink_to", since = "1.56.0")] #[inline] pub fn shrink_to(&mut self, min_capacity: usize) { /* 実装は省略 */ } }
alloc::collections::BinaryHeap::shrink_to
impl<T> BinaryHeap<T> { #[inline] #[stable(feature = "shrink_to", since = "1.56.0")] pub fn shrink_to(&mut self, min_capacity: usize) { /* 実装は省略 */ } }
容量を下限値まで破棄する。
指定された値と現在の長さでより大きい方の分の容量は維持される。
現在の容量が下限値よりも小さい場合は無操作である。
サンプル
use std::collections::BinaryHeap; let mut heap: BinaryHeap<i32> = BinaryHeap::with_capacity(100); assert!(heap.capacity() >= 100); heap.shrink_to(10); assert!(heap.capacity() >= 10);
alloc::collections::VecDeque::shrink_to
impl<T, A: Allocator> VecDeque<T, A> { #[stable(feature = "shrink_to", since = "1.56.0")] pub fn shrink_to(&mut self, min_capacity: usize) { /* 実装は省略 */ } }
VecDequeの容量を下限値まで縮小する。
指定された値と現在の長さでより大きい方の分の容量は維持される。
現在の容量が下限値よりも小さい場合は無操作である。
サンプル
use std::collections::VecDeque; let mut buf = VecDeque::with_capacity(15); buf.extend(0..4); assert_eq!(buf.capacity(), 15); buf.shrink_to(6); assert!(buf.capacity() >= 6); buf.shrink_to(0); assert!(buf.capacity() >= 4);
alloc::collections::HashMap::shrink_to
impl<K, V, S> HashMap<K, V, S> where K: Eq + Hash, S: BuildHasher, { #[inline] #[stable(feature = "shrink_to", since = "1.56.0")] pub fn shrink_to(&mut self, min_capacity: usize) { /* 実装は省略 */ } }
連想配列の容量を下限値まで縮小する。 内部的なルールを維持しつつリサイズ方針のポリシーに従って多少のスペースを残す可能性がある一方で、 容量が下限値よりも小さくなることはない。
現在の容量が下限値よりも小さい場合は無操作である。
サンプル
use std::collections::HashMap; let mut map: HashMap<i32, i32> = HashMap::with_capacity(100); map.insert(1, 2); map.insert(3, 4); assert!(map.capacity() >= 100); map.shrink_to(10); assert!(map.capacity() >= 10); map.shrink_to(0); assert!(map.capacity() >= 2);
alloc::collections::HashSet::shrink_to
impl<T, S> HashSet<T, S> where T: Eq + Hash, S: BuildHasher, { #[inline] #[stable(feature = "shrink_to", since = "1.56.0")] pub fn shrink_to(&mut self, min_capacity: usize) { /* 実装は省略 */ } }
集合の容量を下限値まで縮小する。 内部的なルールを維持しつつリサイズ方針のポリシーに従って多少のスペースを残す可能性がある一方で、 容量が下限値よりも小さくなることはない。
現在の容量が下限値よりも小さい場合は無操作である。
サンプル
use std::collections::HashSet; let mut set = HashSet::with_capacity(100); set.insert(1); set.insert(2); assert!(set.capacity() >= 100); set.shrink_to(10); assert!(set.capacity() >= 10); set.shrink_to(0); assert!(set.capacity() >= 2);
変更点リスト
公式リリースノートをベースに意訳・編集・追記をした変更点リストです。
言語
- Rust 2021エディションが安定化された。 詳細はthe edition guide(※英語)を参照
- パターンで
binding @ patternのように記述したとき、新しい束縛を導入出来るようになった - 定数関数内での共用体(union)のフィールドへのアクセスが許可されるようになった
コンパイラ
- LLVM 13に更新した
- aarch64-unknown-freebsdにおいて、メモリやアドレス、及びスレッドのサニタイザがサポートされた
- 全てのiOSターゲットにおいて、デプロイ対象のバージョンを指定出来るようになった
- 警告の出力を
--force-warnで強制出来るようになった。 これは主にはユーザーではなくcargo fixで使われるものである - ターゲット
aarch64-apple-ios-simをティア2※に引き上げた - ターゲット
powerpc-unknown-freebsdをティア3※に追加した - ターゲット
riscv32imc-esp-espidfをティア3※に追加した
※Rustのティア付けされたプラットフォームサポートの詳細はPlatform Supportのページ(英語)を参照
ライブラリ
- Windowsにおいて、標準出力・標準エラーに対して不完全なUTF-8の並びを書き込むことが許されるようになった。 Windowsのコンソールは依然として正当なUnicodeを要求するものの、これによってUTF-8文字列を複数の書き込みに分割出来るようになった。 これにより、例えばUnicodeや文字の境界を考慮せずにデータを単に読み書きするだけのプログラム(例:ファイルを標準出力にコピーする)も作れるようになった
Instantの逆戻り防止機構には、Mutexの代わりに出来るだけAtomicU{64,128}を使うようになった。 このユースケースでは、競合が発生する場合は原子操作の方がより大規模化出来る(Extend<A>, Extend<B>)がExtend<(A, B)>を実装するようになったstd::io::Sinkとstd::io::Emptyが、DefaultとCopy、Cloneを実装するようになった- 全ての連想配列型が
From<[(K, V); N]>を、配列やセット型がFrom<[T; N]>を実装するようになった impl Future for Pinにおいて、P: Unpin境界を取り除いた- 不正な環境変数名は存在しないものとして扱われるようになった。
以前は、変数名にヌル文字や等号(
=)が含まれる場合はパニックが発生していた。 OSはそのような変数名の存在を示せないため、これらの関数はそれらを存在しないものとして扱うようになった
安定化されたAPI
※各APIのドキュメントを独自に訳した安定化されたAPIのドキュメントもご参照ください。
std::os::unix::fs::chrootUnsafeCell::raw_getBufWriter::into_partscore::panic::{UnwindSafe, RefUnwindSafe, AssertUnwindSafe}これらのAPIは
stdで安定化されていたが、coreで安定化された。String::shrink_toOsString::shrink_toPathBuf::shrink_toBinaryHeap::shrink_toVecDeque::shrink_toHashMap::shrink_toHashSet::shrink_to
以下のAPIが定数文脈でも使えるようになった。
Cargo
- Cargo.tomlにおいて、サポートする最小のRustバージョンを指定出来るようになった。 今のところ、これが依存関係のバージョン選択に影響することは無い。 各クレートはサポートする最小のRustバージョンを指定することが推奨され、 またCIではテストマトリクスにクレートが指定する最小バージョンをデフォルトで含めることも推奨される ※訳注:要はCIではサポートする最小のRustバージョンもテストするように、ということ
互換性メモ
- Windowsにおいて、引数の解釈ルールを更新した。 これにより、Rustの標準ライブラリの動作がC/C++の標準ライブラリの動作に合うようになった。 このルールは時と共に変更されており、今回のPRで(2008年に変更された)最新のルールに沿うようになった
- aarch64において、AAPCSの呼び出し規約が禁じられた。 LLVMでは既にサポートされていなかったものの、これによりより良いエラーメッセージでサポートの有無が表面化されるようになった
- 警告
SEMICOLON_IN_EXPRESSIONS_FROM_MACROSをデフォルトで出力するようになった - 行末のエスケープで複数の行がスキップされる場合に警告が出るようになった
- glibcが2.24以下の時、
Command::pre_execの中でlibc::getpidやstd::process::idを呼び出すと異なる値を返すかもしれない。 Rust 1.56から、使用可能な場合にはシステムコールclone3を直接呼び出すことでそのシステムコールで利用可能な新しい機能を使うようになった。 ただglibcの古いバージョンではgetpidの結果はキャッシュされ、かつこのキャッシュはglibcのclone/fork関数が呼び出された場合のみ更新されるため、 システムコールを直接呼び出す場合はキャッシュが更新されなくなってしまう。 glibc 2.25以上はgetpidの値をキャッシュしなくなり、これに対処している
内部の変更
これらの変更は直接ユーザーの利益に繋がるものではないが、rustc及び関連ツールにおける内部の改善や全体的なパフォーマンスの改善をもたらす。
- x86_64-unknown-linux-gnuターゲットの成果物として公開されるLLVMがPGOを有効にしてコンパイルされるようになった。 大抵のRustビルド(※訳注:コンパイラそのもの)のパフォーマンスが改善される
- 内部のデータ構造でマクロの表現を統一した。 この変更により、コンパイラやrustdocでのマクロの取り扱いに関する多数のバグが修正される
関連リンク
さいごに
次のRust 1.57は2021/12/3(金)に予定されています。 定数文脈でもパニックを起こせるようになったりするようです。
オプティムでは影響を与えるエンジニアを募集しています。
ライセンス表記
- この記事はApache 2/MITのデュアルライセンスで公開されている公式リリースノート及びドキュメントから翻訳・追記をしています
- 冒頭の画像中にはRust公式サイトで配布されているロゴを使用しており、 このロゴはMozillaまたはRust財団によってCC-BYの下で配布されています
- 冒頭の画像はいらすとやさんの画像を使っています。いつもありがとうございます
MIT License
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.
Apache License
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.