projects: drop syslog-4
floss migrated to 6 as part of b/239449434, and memd has been on 6 for a
bit. Since syslog-4 depends on time ~0.1, which is affected by
RUSTSEC-2020-0071, drop it.
BUG=b:239449434
TEST=CQ
Change-Id: I6285e141f2c8e91ec8c0c51f4d7bcbe39338dde9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/rust_crates/+/4210188
Tested-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@google.com>
Commit-Queue: George Burgess <gbiv@chromium.org>
diff --git a/projects/Cargo.lock b/projects/Cargo.lock
index 1cf8295..31787f7 100644
--- a/projects/Cargo.lock
+++ b/projects/Cargo.lock
@@ -1591,15 +1591,6 @@
[[package]]
name = "error-chain"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
-dependencies = [
- "backtrace",
-]
-
-[[package]]
-name = "error-chain"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
@@ -1804,7 +1795,7 @@
"serde_json",
"shell-words",
"syn 1.0.107",
- "syslog 4.0.1",
+ "syslog",
"thiserror",
"tokio",
"tokio-stream",
@@ -2201,7 +2192,7 @@
"protobuf 2.27.1",
"serde",
"serde_json",
- "syslog 6.0.1",
+ "syslog",
"thiserror",
"zeroize",
]
@@ -2753,7 +2744,7 @@
"pkg-config",
"serde",
"stderrlog",
- "syslog 6.0.1",
+ "syslog",
"thiserror",
"zeroize",
]
@@ -3005,7 +2996,7 @@
"log",
"protobuf 2.27.1",
"protoc-rust",
- "syslog 4.0.1",
+ "syslog",
"tempfile",
"time 0.3.14",
]
@@ -5238,23 +5229,11 @@
[[package]]
name = "syslog"
-version = "4.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0641142b4081d3d44beffa4eefd7346a228cdf91ed70186db2ca2cef762d327"
-dependencies = [
- "error-chain 0.11.0",
- "libc",
- "log",
- "time 0.1.43",
-]
-
-[[package]]
-name = "syslog"
version = "6.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978044cc68150ad5e40083c9f6a725e6fd02d7ba1bcf691ec2ff0d66c0b41acc"
dependencies = [
- "error-chain 0.12.4",
+ "error-chain",
"hostname",
"libc",
"log",
@@ -5863,7 +5842,7 @@
"log",
"protobuf 2.27.1",
"protoc-rust",
- "syslog 6.0.1",
+ "syslog",
]
[[package]]
diff --git a/projects/aosp/floss/Cargo.toml b/projects/aosp/floss/Cargo.toml
index 6f6c69e..15ba4d5 100644
--- a/projects/aosp/floss/Cargo.toml
+++ b/projects/aosp/floss/Cargo.toml
@@ -44,7 +44,7 @@
serde_json = "1.0"
shell-words = "1.1.0"
syn = { version = "1.0.58", features = ['default', 'full'] }
-syslog = "4.0"
+syslog = "6"
tokio = { version = "1.0", features = ['bytes', 'fs', 'io-util', 'libc', 'macros', 'memchr', 'mio', 'net', 'num_cpus', 'rt', 'rt-multi-thread', 'sync', 'time', 'tokio-macros'] }
tokio-stream = "0.1"
walkdir = "2.2"
diff --git a/projects/platform2/metrics/memd/Cargo.toml b/projects/platform2/metrics/memd/Cargo.toml
index a21bc80..9391270 100644
--- a/projects/platform2/metrics/memd/Cargo.toml
+++ b/projects/platform2/metrics/memd/Cargo.toml
@@ -11,7 +11,7 @@
libc = "0.2.40"
log = "0.4.1"
protobuf = "2.3"
-syslog = "4.0.0"
+syslog = "6"
tempfile = "3.0"
time = "0.3"
diff --git a/vendor/error-chain-0.11.0/.cargo-checksum.json b/vendor/error-chain-0.11.0/.cargo-checksum.json
deleted file mode 100644
index 1d3eb9b..0000000
--- a/vendor/error-chain-0.11.0/.cargo-checksum.json
+++ /dev/null
@@ -1 +0,0 @@
-{"files":{"CHANGELOG.md":"010cba4f5cdf9607eb744e83a666a3642d6c1aae5d467c67978e97a7f7e86bd8","Cargo.toml":"d8d10d260671883629d2b7e6c5daca5eb2b49b8b1c88345e530462ea1a2e6913","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c43864d39cedab9a1b2aa3d5e480cb58f74cac0b07756670a30c683ce34976a1","README.md":"d63912fd7a5a1a2b1d21edde3cee58cbe422c29b9fcdcc7b8ba2264bf15825b5","examples/all.rs":"cf8422ea6fdb61dbe9ddbb2db51daba48768e3b1d81c5f9e454371c258954cfb","examples/chain_err.rs":"fbb6f90397d5e621e4982d224caf3d419a3c1aaa50f07e5c9c617a9352cfb81f","examples/doc.rs":"790ad6877c91e4e5b2d78829c58702100dcccf3eac2279940257691420cdff03","examples/quickstart.rs":"ca471b3c310d40e5f5dc07db2bfbfcedb71dfc1e25021a6383a9810b24e8fc40","examples/size.rs":"a67ba47b254fb899cb0ecf809e95f75649bb0e401feece9485a2064e223602ab","src/bin/has_backtrace.rs":"eedf028ff206938760a53e91d13534b6ad6780b2b6635f405b7896125484a869","src/error_chain.rs":"5fc674d965746f3ea1a6ea65f82352c40b83439004480bf5a338748a90e476cc","src/example_generated.rs":"95a1e191917740885286f199186674ed575d807077b57dffe6388a4fe2e1ba98","src/impl_error_chain_kind.rs":"538c6f7a2382d555f809c4d7f33e739dff7aa75b2fb3c1629ca2afaa38ff4279","src/lib.rs":"0adc37e316f45d57d56d76245c76942d2a894643c4d2da744639d33c3cd99099","src/quick_main.rs":"472f0b90b11d346cbceec5a95da78fabda0fb55e7e019dc62ac8ff0c206841ea","tests/quick_main.rs":"39a1113cc0d30e5b265e4139cda36f910f8c534a4409e99a9a506a0e88e58f19","tests/tests.rs":"2b76317571651999c294c639088ec7d764c27721d802ea6bc624cfdf31619623"},"package":"ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"}
\ No newline at end of file
diff --git a/vendor/error-chain-0.11.0/CHANGELOG.md b/vendor/error-chain-0.11.0/CHANGELOG.md
deleted file mode 100644
index ed0f12e..0000000
--- a/vendor/error-chain-0.11.0/CHANGELOG.md
+++ /dev/null
@@ -1,120 +0,0 @@
-# Unreleased
-
-# 0.11.0
-
-- Change last rust version supported to 1.14
-- [Cache whether RUST_BACKTRACE is enabled in a relaxed atomic static.](https://github.com/rust-lang-nursery/error-chain/pull/210)
-- [Mask the `quick_error` macro from the doc](https://github.com/rust-lang-nursery/error-chain/pull/210)
-- [Make generated `ErrorKind` enums non-exhaustive](https://github.com/rust-lang-nursery/error-chain/pull/193)
-- All 0.11.0-rc.2 changes
-
-# 0.11.0-rc.2
-
-- [Make `ErrorChainIter`'s field private](https://github.com/rust-lang-nursery/error-chain/issues/178)
-- [Rename `ErrorChainIter` to `Iter`](https://github.com/rust-lang-nursery/error-chain/issues/168)
-- [Implement `Debug` for `ErrorChainIter`](https://github.com/rust-lang-nursery/error-chain/issues/169)
-- [Rename `ChainedError::display` to `display_chain`](https://github.com/rust-lang-nursery/error-chain/issues/180)
-- [Add a new method for `Error`: `chain_err`.](https://github.com/rust-lang-nursery/error-chain/pull/141)
-- [Allow `chain_err` to be used on `Option<T>`](https://github.com/rust-lang-nursery/error-chain/pull/156)
-- [Add support for creating an error chain on boxed trait errors (`Box<Error>`)](https://github.com/rust-lang-nursery/error-chain/pull/156)
-- [Remove lint for unused doc comment.](https://github.com/rust-lang-nursery/error-chain/pull/199)
-- [Hide error_chain_processed macro from documentation.](https://github.com/rust-lang-nursery/error-chain/pull/212)
-
-# 0.10.0
-
-- [Add a new constructor for `Error`: `with_chain`.](https://github.com/rust-lang-nursery/error-chain/pull/126)
-- [Add the `ensure!` macro.](https://github.com/rust-lang-nursery/error-chain/pull/135)
-
-# 0.9.0
-
-- Revert [Add a `Sync` bound to errors](https://github.com/rust-lang-nursery/error-chain/pull/110)
-
-# 0.8.1
-
-- Add crates.io category.
-
-# 0.8.0
-
-- [Add a `Sync` bound to errors](https://github.com/rust-lang-nursery/error-chain/pull/110)
-- [Add `ChainedError::display` to format error chains](https://github.com/rust-lang-nursery/error-chain/pull/113)
-
-# 0.7.2
-
-- Add `quick_main!` (#88).
-- `allow(unused)` for the `Result` wrapper.
-- Minimum rust version supported is now 1.10 on some conditions (#103).
-
-# 0.7.1
-
-- [Add the `bail!` macro](https://github.com/rust-lang-nursery/error-chain/pull/76)
-
-# 0.7.0
-
-- [Rollback several design changes to fix regressions](https://github.com/rust-lang-nursery/error-chain/pull/75)
-- New `Variant(Error) #[attrs]` for `links` and `foreign_links`.
-- Hide implementation details from the doc.
-- Always generate `Error::backtrace`.
-
-# 0.6.2
-
-- Allow dead code.
-
-# 0.6.1
-
-- Fix wrong trait constraint in ResultExt implementation (#66).
-
-# 0.6.0
-
-- Conditional compilation for error variants.
-- Backtrace generation is now a feature.
-- More standard trait implementations for extra convenience.
-- Remove ChainErr.
-- Remove need to specify `ErrorKind` in `links {}`.
-- Add ResultExt trait.
-- Error.1 is a struct instead of a tuple.
-- Error is now a struct.
-- The declarations order is more flexible.
-- Way better error reporting when there is a syntax error in the macro call.
-- `Result` generation can be disabled.
-- At most one declaration of each type can be present.
-
-# 0.5.0
-
-- [Only generate backtraces with RUST_BACKTRACE set](https://github.com/rust-lang-nursery/error-chain/pull/27)
-- [Fixup matching, disallow repeating "types" section](https://github.com/rust-lang-nursery/error-chain/pull/26)
-- [Fix tests on stable/beta](https://github.com/rust-lang-nursery/error-chain/pull/28)
-- [Only deploy docs when tagged](https://github.com/rust-lang-nursery/error-chain/pull/30)
-
-Contributors: benaryorg, Brian Anderson, Georg Brandl
-
-# 0.4.2
-
-- [Fix the resolution of the ErrorKind description method](https://github.com/rust-lang-nursery/error-chain/pull/24)
-
-Contributors: Brian Anderson
-
-# 0.4.1 (yanked)
-
-- [Fix a problem with resolving methods of the standard Error type](https://github.com/rust-lang-nursery/error-chain/pull/22)
-
-Contributors: Brian Anderson
-
-# 0.4.0 (yanked)
-
-- [Remove the foreign link description and forward to the foreign error](https://github.com/rust-lang-nursery/error-chain/pull/19)
-- [Allow missing sections](https://github.com/rust-lang-nursery/error-chain/pull/17)
-
-Contributors: Brian Anderson, Taylor Cramer
-
-# 0.3.0
-
-- [Forward Display implementation for foreign errors](https://github.com/rust-lang-nursery/error-chain/pull/13)
-
-Contributors: Brian Anderson, Taylor Cramer
-
-# 0.2.2
-
-- [Don't require `types` section in macro invocation](https://github.com/rust-lang-nursery/error-chain/pull/8)
-- [Add "quick start" to README](https://github.com/rust-lang-nursery/error-chain/pull/9)
-
-Contributors: Brian Anderson, Jake Shadle, Nate Mara
diff --git a/vendor/error-chain-0.11.0/Cargo.toml b/vendor/error-chain-0.11.0/Cargo.toml
deleted file mode 100644
index 6c4e0e4..0000000
--- a/vendor/error-chain-0.11.0/Cargo.toml
+++ /dev/null
@@ -1,32 +0,0 @@
-# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
-#
-# When uploading crates to the registry Cargo will automatically
-# "normalize" Cargo.toml files for maximal compatibility
-# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g. crates.io) dependencies
-#
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
-
-[package]
-name = "error-chain"
-version = "0.11.0"
-authors = ["Brian Anderson <banderson@mozilla.com>", "Paul Colomiets <paul@colomiets.name>", "Colin Kiegel <kiegel@gmx.de>", "Yamakaky <yamakaky@yamaworld.fr>"]
-description = "Yet another error boilerplate library."
-documentation = "https://docs.rs/error-chain"
-readme = "README.md"
-keywords = ["error"]
-categories = ["rust-patterns"]
-license = "MIT/Apache-2.0"
-repository = "https://github.com/rust-lang-nursery/error-chain"
-[dependencies.backtrace]
-version = "0.3"
-optional = true
-
-[features]
-example_generated = []
-default = ["backtrace", "example_generated"]
-[badges.travis-ci]
-repository = "rust-lang-nursery/error-chain"
diff --git a/vendor/error-chain-0.11.0/LICENSE-APACHE b/vendor/error-chain-0.11.0/LICENSE-APACHE
deleted file mode 100644
index 16fe87b..0000000
--- a/vendor/error-chain-0.11.0/LICENSE-APACHE
+++ /dev/null
@@ -1,201 +0,0 @@
- 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/vendor/error-chain-0.11.0/LICENSE-MIT b/vendor/error-chain-0.11.0/LICENSE-MIT
deleted file mode 100644
index 5f28864..0000000
--- a/vendor/error-chain-0.11.0/LICENSE-MIT
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 2017 The Error-Chain Project Developers
-
-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/vendor/error-chain-0.11.0/README.md b/vendor/error-chain-0.11.0/README.md
deleted file mode 100644
index 51e5053..0000000
--- a/vendor/error-chain-0.11.0/README.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# error-chain - Consistent error handling for Rust
-
-[](https://travis-ci.org/rust-lang-nursery/error-chain)
-[](https://crates.io/crates/error-chain)
-[](https://github.com/rust-lang-nursery/error-chain)
-
-`error-chain` makes it easy to take full advantage of Rust's error
-handling features without the overhead of maintaining boilerplate
-error types and conversions. It implements an opinionated strategy for
-defining your own error types, as well as conversions from others'
-error types.
-
-[Documentation (crates.io)](https://docs.rs/error-chain).
-
-[Documentation (master)](https://rust-lang-nursery.github.io/error-chain).
-
-## Quick start
-
-If you just want to set up your new project with error-chain,
-follow the [quickstart.rs] template, and read this [intro]
-to error-chain.
-
-[quickstart.rs]: https://github.com/rust-lang-nursery/error-chain/blob/master/examples/quickstart.rs
-[intro]: http://brson.github.io/2016/11/30/starting-with-error-chain
-
-## Supported Rust version
-
-Please view the beginning of the [Travis configuration file](.travis.yml)
-to see the oldest supported Rust version.
-
-Note that `error-chain` supports older versions of Rust when built with
-`default-features = false`.
-
-## License
-
-MIT/Apache-2.0
diff --git a/vendor/error-chain-0.11.0/examples/all.rs b/vendor/error-chain-0.11.0/examples/all.rs
deleted file mode 100644
index ccc3ab7..0000000
--- a/vendor/error-chain-0.11.0/examples/all.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-#[macro_use]
-extern crate error_chain;
-
-pub mod inner {
- error_chain!{}
-}
-
-#[cfg(feature = "a_feature")]
-pub mod feature {
- error_chain!{}
-}
-
-error_chain! {
- // Types generated by the macro. If empty or absent, it defaults to
- // Error, ErrorKind, Result;
- types {
- // With custom names:
- MyError, MyErrorKind, MyResult;
- // Without the `Result` wrapper:
- // Error, ErrorKind;
- }
-
- // Automatic bindings to other error types generated by `error_chain!`.
- links {
- Inner(inner::Error, inner::ErrorKind);
- // Attributes can be added at the end of the declaration.
- Feature(feature::Error, feature::ErrorKind) #[cfg(feature = "a_feature")];
- }
-
- // Bindings to types implementing std::error::Error.
- foreign_links {
- Io(::std::io::Error);
- }
-}
-
-fn main() {}
diff --git a/vendor/error-chain-0.11.0/examples/chain_err.rs b/vendor/error-chain-0.11.0/examples/chain_err.rs
deleted file mode 100644
index bd8effd..0000000
--- a/vendor/error-chain-0.11.0/examples/chain_err.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-//! Demonstrates usage of `Error::caused` method. This method enables chaining errors
-//! like `ResultExt::chain_err` but doesn't require the presence of a `Result` wrapper.
-
-#[macro_use]
-extern crate error_chain;
-
-use std::fs::File;
-
-mod errors {
- use std::io;
- use super::LaunchStage;
-
- error_chain! {
- foreign_links {
- Io(io::Error) #[doc = "Error during IO"];
- }
-
- errors {
- Launch(phase: LaunchStage) {
- description("An error occurred during startup")
- display("Startup aborted: {:?} did not complete successfully", phase)
- }
-
- ConfigLoad(path: String) {
- description("Config file not found")
- display("Unable to read file `{}`", path)
- }
- }
- }
-
- impl From<LaunchStage> for ErrorKind {
- fn from(v: LaunchStage) -> Self {
- ErrorKind::Launch(v)
- }
- }
-}
-
-pub use errors::*;
-
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum LaunchStage {
- ConfigLoad,
- ConfigParse,
- ConfigResolve,
-}
-
-/// Read the service config from the file specified.
-fn load_config(rel_path: &str) -> Result<()> {
- File::open(rel_path)
- .map(|_| ())
- .chain_err(|| ErrorKind::ConfigLoad(rel_path.to_string()))
-}
-
-/// Launch the service.
-fn launch(rel_path: &str) -> Result<()> {
- load_config(rel_path).map_err(|e| match e {
- e @ Error(ErrorKind::ConfigLoad(_), _) => {
- e.chain_err(|| LaunchStage::ConfigLoad)
- }
- e => e.chain_err(|| "Unknown failure"),
- })
-}
-
-fn main() {
- let chain = launch("does_not_exist.json").unwrap_err();
- for err in chain.iter() {
- println!("{}", err);
- }
-}
diff --git a/vendor/error-chain-0.11.0/examples/doc.rs b/vendor/error-chain-0.11.0/examples/doc.rs
deleted file mode 100644
index 999ac9c..0000000
--- a/vendor/error-chain-0.11.0/examples/doc.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-#![deny(missing_docs)]
-
-//! This module is used to check that all generated items are documented.
-
-#[macro_use]
-extern crate error_chain;
-
-/// Inner module.
-pub mod inner {
- error_chain!{}
-}
-
-error_chain! {
- links {
- Inner(inner::Error, inner::ErrorKind) #[doc = "Doc"];
- }
- foreign_links {
- Io(::std::io::Error) #[doc = "Io"];
- }
- errors {
- /// Doc
- Test2 {
-
- }
- }
-}
-
-fn main() {}
diff --git a/vendor/error-chain-0.11.0/examples/quickstart.rs b/vendor/error-chain-0.11.0/examples/quickstart.rs
deleted file mode 100644
index 2e3e2b5..0000000
--- a/vendor/error-chain-0.11.0/examples/quickstart.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Simple and robust error handling with error-chain!
-// Use this as a template for new projects.
-
-// `error_chain!` can recurse deeply
-#![recursion_limit = "1024"]
-
-// Import the macro. Don't forget to add `error-chain` in your
-// `Cargo.toml`!
-#[macro_use]
-extern crate error_chain;
-
-// We'll put our errors in an `errors` module, and other modules in
-// this crate will `use errors::*;` to get access to everything
-// `error_chain!` creates.
-mod errors {
- // Create the Error, ErrorKind, ResultExt, and Result types
- error_chain!{}
-}
-
-// This only gives access within this module. Make this `pub use errors::*;`
-// instead if the types must be accessible from other modules (e.g., within
-// a `links` section).
-use errors::*;
-
-fn main() {
- if let Err(ref e) = run() {
- use std::io::Write;
- let stderr = &mut ::std::io::stderr();
- let errmsg = "Error writing to stderr";
-
- writeln!(stderr, "error: {}", e).expect(errmsg);
-
- for e in e.iter().skip(1) {
- writeln!(stderr, "caused by: {}", e).expect(errmsg);
- }
-
- // The backtrace is not always generated. Try to run this example
- // with `RUST_BACKTRACE=1`.
- if let Some(backtrace) = e.backtrace() {
- writeln!(stderr, "backtrace: {:?}", backtrace).expect(errmsg);
- }
-
- ::std::process::exit(1);
- }
-}
-
-// The above main gives you maximum control over how the error is
-// formatted. If you don't care (i.e. you want to display the full
-// error during an assert) you can just call the `display_chain` method
-// on the error object
-#[allow(dead_code)]
-fn alternative_main() {
- if let Err(ref e) = run() {
- use std::io::Write;
- use error_chain::ChainedError; // trait which holds `display_chain`
- let stderr = &mut ::std::io::stderr();
- let errmsg = "Error writing to stderr";
-
- writeln!(stderr, "{}", e.display_chain()).expect(errmsg);
- ::std::process::exit(1);
- }
-}
-
-// Use this macro to auto-generate the main above. You may want to
-// set the `RUST_BACKTRACE` env variable to see a backtrace.
-// quick_main!(run);
-
-
-// Most functions will return the `Result` type, imported from the
-// `errors` module. It is a typedef of the standard `Result` type
-// for which the error type is always our own `Error`.
-fn run() -> Result<()> {
- use std::fs::File;
-
- // This operation will fail
- File::open("tretrete")
- .chain_err(|| "unable to open tretrete file")?;
-
- Ok(())
-}
diff --git a/vendor/error-chain-0.11.0/examples/size.rs b/vendor/error-chain-0.11.0/examples/size.rs
deleted file mode 100644
index ae360d6..0000000
--- a/vendor/error-chain-0.11.0/examples/size.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#[macro_use]
-extern crate error_chain;
-
-use std::mem::{size_of, size_of_val};
-
-error_chain! {
- errors {
- AVariant
- Another
- }
-}
-
-fn main() {
- println!("Memory usage in bytes");
- println!("---------------------");
- println!("Result<()>: {}", size_of::<Result<()>>());
- println!(" (): {}", size_of::<()>());
- println!(" Error: {}", size_of::<Error>());
- println!(" ErrorKind: {}", size_of::<ErrorKind>());
- let msg = ErrorKind::Msg("test".into());
- println!(" ErrorKind::Msg: {}", size_of_val(&msg));
- println!(" String: {}", size_of::<String>());
- println!(" State: {}", size_of::<error_chain::State>());
- #[cfg(feature = "backtrace")]
- {
- let state = error_chain::State {
- next_error: None,
- backtrace: None,
- };
- println!(" State.next_error: {}", size_of_val(&state.next_error));
- println!(" State.backtrace: {}", size_of_val(&state.backtrace));
- }
- #[cfg(not(feature = "backtrace"))]
- {
- let state = error_chain::State { next_error: None };
- println!(" State.next_error: {}", size_of_val(&state.next_error));
- }
-}
diff --git a/vendor/error-chain-0.11.0/src/bin/has_backtrace.rs b/vendor/error-chain-0.11.0/src/bin/has_backtrace.rs
deleted file mode 100644
index c5dac05..0000000
--- a/vendor/error-chain-0.11.0/src/bin/has_backtrace.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-//! Exits with exit code 0 if backtraces are disabled and 1 if they are enabled.
-//! Used by tests to make sure backtraces are available when they should be. Should not be used
-//! outside of the tests.
-
-#[macro_use]
-extern crate error_chain;
-
-error_chain! {
- errors {
- MyError
- }
-}
-
-fn main() {
- let err = Error::from(ErrorKind::MyError);
- let has_backtrace = err.backtrace().is_some();
- ::std::process::exit(has_backtrace as i32);
-}
diff --git a/vendor/error-chain-0.11.0/src/error_chain.rs b/vendor/error-chain-0.11.0/src/error_chain.rs
deleted file mode 100644
index cbd42cd..0000000
--- a/vendor/error-chain-0.11.0/src/error_chain.rs
+++ /dev/null
@@ -1,458 +0,0 @@
-/// Prefer to use `error_chain` instead of this macro.
-#[doc(hidden)]
-#[macro_export]
-macro_rules! impl_error_chain_processed {
- // Default values for `types`.
- (
- types {}
- $( $rest: tt )*
- ) => {
- impl_error_chain_processed! {
- types {
- Error, ErrorKind, ResultExt, Result;
- }
- $( $rest )*
- }
- };
- // With `Result` wrapper.
- (
- types {
- $error_name:ident, $error_kind_name:ident,
- $result_ext_name:ident, $result_name:ident;
- }
- $( $rest: tt )*
- ) => {
- impl_error_chain_processed! {
- types {
- $error_name, $error_kind_name,
- $result_ext_name;
- }
- $( $rest )*
- }
- /// Convenient wrapper around `std::Result`.
- #[allow(unused)]
- pub type $result_name<T> = ::std::result::Result<T, $error_name>;
- };
- // Without `Result` wrapper.
- (
- types {
- $error_name:ident, $error_kind_name:ident,
- $result_ext_name:ident;
- }
-
- links {
- $( $link_variant:ident ( $link_error_path:path, $link_kind_path:path )
- $( #[$meta_links:meta] )*; ) *
- }
-
- foreign_links {
- $( $foreign_link_variant:ident ( $foreign_link_error_path:path )
- $( #[$meta_foreign_links:meta] )*; )*
- }
-
- errors {
- $( $error_chunks:tt ) *
- }
-
- ) => {
- /// The Error type.
- ///
- /// This tuple struct is made of two elements:
- ///
- /// - an `ErrorKind` which is used to determine the type of the error.
- /// - An internal `State`, not meant for direct use outside of `error_chain`
- /// internals, containing:
- /// - a backtrace, generated when the error is created.
- /// - an error chain, used for the implementation of `Error::cause()`.
- #[derive(Debug)]
- pub struct $error_name(
- // The members must be `pub` for `links`.
- /// The kind of the error.
- pub $error_kind_name,
- /// Contains the error chain and the backtrace.
- #[doc(hidden)]
- pub $crate::State,
- );
-
- impl $crate::ChainedError for $error_name {
- type ErrorKind = $error_kind_name;
-
- fn new(kind: $error_kind_name, state: $crate::State) -> $error_name {
- $error_name(kind, state)
- }
-
- fn from_kind(kind: Self::ErrorKind) -> Self {
- Self::from_kind(kind)
- }
-
- fn with_chain<E, K>(error: E, kind: K)
- -> Self
- where E: ::std::error::Error + Send + 'static,
- K: Into<Self::ErrorKind>
- {
- Self::with_chain(error, kind)
- }
-
- fn kind(&self) -> &Self::ErrorKind {
- self.kind()
- }
-
- fn iter(&self) -> $crate::Iter {
- $crate::Iter::new(Some(self))
- }
-
- fn chain_err<F, EK>(self, error: F) -> Self
- where F: FnOnce() -> EK,
- EK: Into<$error_kind_name> {
- self.chain_err(error)
- }
-
- fn backtrace(&self) -> Option<&$crate::Backtrace> {
- self.backtrace()
- }
-
- impl_extract_backtrace!($error_name
- $error_kind_name
- $([$link_error_path, $(#[$meta_links])*])*);
- }
-
- #[allow(dead_code)]
- impl $error_name {
- /// Constructs an error from a kind, and generates a backtrace.
- pub fn from_kind(kind: $error_kind_name) -> $error_name {
- $error_name(
- kind,
- $crate::State::default(),
- )
- }
-
- /// Constructs a chained error from another error and a kind, and generates a backtrace.
- pub fn with_chain<E, K>(error: E, kind: K)
- -> $error_name
- where E: ::std::error::Error + Send + 'static,
- K: Into<$error_kind_name>
- {
- $error_name::with_boxed_chain(Box::new(error), kind)
- }
-
- /// Construct a chained error from another boxed error and a kind, and generates a backtrace
- pub fn with_boxed_chain<K>(error: Box<::std::error::Error + Send>, kind: K)
- -> $error_name
- where K: Into<$error_kind_name>
- {
- $error_name(
- kind.into(),
- $crate::State::new::<$error_name>(error, ),
- )
- }
-
- /// Returns the kind of the error.
- pub fn kind(&self) -> &$error_kind_name {
- &self.0
- }
-
- /// Iterates over the error chain.
- pub fn iter(&self) -> $crate::Iter {
- $crate::ChainedError::iter(self)
- }
-
- /// Returns the backtrace associated with this error.
- pub fn backtrace(&self) -> Option<&$crate::Backtrace> {
- self.1.backtrace()
- }
-
- /// Extends the error chain with a new entry.
- pub fn chain_err<F, EK>(self, error: F) -> $error_name
- where F: FnOnce() -> EK, EK: Into<$error_kind_name> {
- $error_name::with_chain(self, Self::from_kind(error().into()))
- }
- }
-
- impl ::std::error::Error for $error_name {
- fn description(&self) -> &str {
- self.0.description()
- }
-
- #[allow(unknown_lints, unused_doc_comment)]
- fn cause(&self) -> Option<&::std::error::Error> {
- match self.1.next_error {
- Some(ref c) => Some(&**c),
- None => {
- match self.0 {
- $(
- $(#[$meta_foreign_links])*
- $error_kind_name::$foreign_link_variant(ref foreign_err) => {
- foreign_err.cause()
- }
- ) *
- _ => None
- }
- }
- }
- }
- }
-
- impl ::std::fmt::Display for $error_name {
- fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- ::std::fmt::Display::fmt(&self.0, f)
- }
- }
-
- $(
- $(#[$meta_links])*
- impl From<$link_error_path> for $error_name {
- fn from(e: $link_error_path) -> Self {
- $error_name(
- $error_kind_name::$link_variant(e.0),
- e.1,
- )
- }
- }
- ) *
-
- $(
- $(#[$meta_foreign_links])*
- impl From<$foreign_link_error_path> for $error_name {
- fn from(e: $foreign_link_error_path) -> Self {
- $error_name::from_kind(
- $error_kind_name::$foreign_link_variant(e)
- )
- }
- }
- ) *
-
- impl From<$error_kind_name> for $error_name {
- fn from(e: $error_kind_name) -> Self {
- $error_name::from_kind(e)
- }
- }
-
- impl<'a> From<&'a str> for $error_name {
- fn from(s: &'a str) -> Self {
- $error_name::from_kind(s.into())
- }
- }
-
- impl From<String> for $error_name {
- fn from(s: String) -> Self {
- $error_name::from_kind(s.into())
- }
- }
-
- impl ::std::ops::Deref for $error_name {
- type Target = $error_kind_name;
-
- fn deref(&self) -> &Self::Target {
- &self.0
- }
- }
-
-
- // The ErrorKind type
- // --------------
-
- impl_error_chain_kind! {
- /// The kind of an error.
- #[derive(Debug)]
- pub enum $error_kind_name {
-
- /// A convenient variant for String.
- Msg(s: String) {
- description(&s)
- display("{}", s)
- }
-
- $(
- $(#[$meta_links])*
- $link_variant(e: $link_kind_path) {
- description(e.description())
- display("{}", e)
- }
- ) *
-
- $(
- $(#[$meta_foreign_links])*
- $foreign_link_variant(err: $foreign_link_error_path) {
- description(::std::error::Error::description(err))
- display("{}", err)
- }
- ) *
-
- $($error_chunks)*
- }
- }
-
- $(
- $(#[$meta_links])*
- impl From<$link_kind_path> for $error_kind_name {
- fn from(e: $link_kind_path) -> Self {
- $error_kind_name::$link_variant(e)
- }
- }
- ) *
-
- impl<'a> From<&'a str> for $error_kind_name {
- fn from(s: &'a str) -> Self {
- $error_kind_name::Msg(s.to_string())
- }
- }
-
- impl From<String> for $error_kind_name {
- fn from(s: String) -> Self {
- $error_kind_name::Msg(s)
- }
- }
-
- impl From<$error_name> for $error_kind_name {
- fn from(e: $error_name) -> Self {
- e.0
- }
- }
-
- // The ResultExt trait defines the `chain_err` method.
-
- /// Additional methods for `Result`, for easy interaction with this crate.
- pub trait $result_ext_name<T> {
- /// If the `Result` is an `Err` then `chain_err` evaluates the closure,
- /// which returns *some type that can be converted to `ErrorKind`*, boxes
- /// the original error to store as the cause, then returns a new error
- /// containing the original error.
- fn chain_err<F, EK>(self, callback: F) -> ::std::result::Result<T, $error_name>
- where F: FnOnce() -> EK,
- EK: Into<$error_kind_name>;
- }
-
- impl<T, E> $result_ext_name<T> for ::std::result::Result<T, E> where E: ::std::error::Error + Send + 'static {
- fn chain_err<F, EK>(self, callback: F) -> ::std::result::Result<T, $error_name>
- where F: FnOnce() -> EK,
- EK: Into<$error_kind_name> {
- self.map_err(move |e| {
- let state = $crate::State::new::<$error_name>(Box::new(e), );
- $crate::ChainedError::new(callback().into(), state)
- })
- }
- }
-
- impl<T> $result_ext_name<T> for ::std::option::Option<T> {
- fn chain_err<F, EK>(self, callback: F) -> ::std::result::Result<T, $error_name>
- where F: FnOnce() -> EK,
- EK: Into<$error_kind_name> {
- self.ok_or_else(move || {
- $crate::ChainedError::from_kind(callback().into())
- })
- }
- }
-
-
- };
-}
-
-/// Internal macro used for reordering of the fields.
-#[doc(hidden)]
-#[macro_export]
-macro_rules! error_chain_processing {
- (
- ({}, $b:tt, $c:tt, $d:tt)
- types $content:tt
- $( $tail:tt )*
- ) => {
- error_chain_processing! {
- ($content, $b, $c, $d)
- $($tail)*
- }
- };
- (
- ($a:tt, {}, $c:tt, $d:tt)
- links $content:tt
- $( $tail:tt )*
- ) => {
- error_chain_processing! {
- ($a, $content, $c, $d)
- $($tail)*
- }
- };
- (
- ($a:tt, $b:tt, {}, $d:tt)
- foreign_links $content:tt
- $( $tail:tt )*
- ) => {
- error_chain_processing! {
- ($a, $b, $content, $d)
- $($tail)*
- }
- };
- (
- ($a:tt, $b:tt, $c:tt, {})
- errors $content:tt
- $( $tail:tt )*
- ) => {
- error_chain_processing! {
- ($a, $b, $c, $content)
- $($tail)*
- }
- };
- ( ($a:tt, $b:tt, $c:tt, $d:tt) ) => {
- impl_error_chain_processed! {
- types $a
- links $b
- foreign_links $c
- errors $d
- }
- };
-}
-
-/// Macro for generating error types and traits. See crate level documentation for details.
-#[macro_export]
-macro_rules! error_chain {
- ( $( $block_name:ident { $( $block_content:tt )* } )* ) => {
- error_chain_processing! {
- ({}, {}, {}, {})
- $($block_name { $( $block_content )* })*
- }
- };
-}
-
-/// Macro used to manage the `backtrace` feature.
-///
-/// See
-/// https://www.reddit.com/r/rust/comments/57virt/hey_rustaceans_got_an_easy_question_ask_here/da5r4ti/?context=3
-/// for more details.
-#[macro_export]
-#[doc(hidden)]
-#[cfg(feature = "backtrace")]
-macro_rules! impl_extract_backtrace {
- ($error_name: ident
- $error_kind_name: ident
- $([$link_error_path: path, $(#[$meta_links: meta])*])*) => {
- #[allow(unknown_lints, unused_doc_comment)]
- fn extract_backtrace(e: &(::std::error::Error + Send + 'static))
- -> Option<::std::sync::Arc<$crate::Backtrace>> {
- if let Some(e) = e.downcast_ref::<$error_name>() {
- return e.1.backtrace.clone();
- }
- $(
- $( #[$meta_links] )*
- {
- if let Some(e) = e.downcast_ref::<$link_error_path>() {
- return e.1.backtrace.clone();
- }
- }
- ) *
- None
- }
- }
-}
-
-/// Macro used to manage the `backtrace` feature.
-///
-/// See
-/// https://www.reddit.com/r/rust/comments/57virt/hey_rustaceans_got_an_easy_question_ask_here/da5r4ti/?context=3
-/// for more details.
-#[macro_export]
-#[doc(hidden)]
-#[cfg(not(feature = "backtrace"))]
-macro_rules! impl_extract_backtrace {
- ($error_name: ident
- $error_kind_name: ident
- $([$link_error_path: path, $(#[$meta_links: meta])*])*) => {}
-}
diff --git a/vendor/error-chain-0.11.0/src/example_generated.rs b/vendor/error-chain-0.11.0/src/example_generated.rs
deleted file mode 100644
index 413407c..0000000
--- a/vendor/error-chain-0.11.0/src/example_generated.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-//! These modules show an example of code generated by the macro. **IT MUST NOT BE
-//! USED OUTSIDE THIS CRATE**.
-//!
-//! This is the basic error structure. You can see that `ErrorKind`
-//! has been populated in a variety of ways. All `ErrorKind`s get a
-//! `Msg` variant for basic errors. When strings are converted to
-//! `ErrorKind`s they become `ErrorKind::Msg`. The "links" defined in
-//! the macro are expanded to the `Inner` variant, and the
-//! "foreign links" to the `Io` variant.
-//!
-//! Both types come with a variety of `From` conversions as well:
-//! `Error` can be created from `ErrorKind`, `&str` and `String`,
-//! and the `links` and `foreign_links` error types. `ErrorKind`
-//! can be created from the corresponding `ErrorKind`s of the link
-//! types, as well as from `&str` and `String`.
-//!
-//! `into()` and `From::from` are used heavily to massage types into
-//! the right shape. Which one to use in any specific case depends on
-//! the influence of type inference, but there are some patterns that
-//! arise frequently.
-
-/// Another code generated by the macro.
-pub mod inner {
- error_chain!{}
-}
-
-error_chain! {
- links {
- Inner(inner::Error, inner::ErrorKind) #[doc = "Link to another `ErrorChain`."];
- }
- foreign_links {
- Io(::std::io::Error) #[doc = "Link to a `std::error::Error` type."];
- }
- errors {
- #[doc = "A custom error kind."]
- Custom
- }
-}
diff --git a/vendor/error-chain-0.11.0/src/impl_error_chain_kind.rs b/vendor/error-chain-0.11.0/src/impl_error_chain_kind.rs
deleted file mode 100644
index d6c05c8..0000000
--- a/vendor/error-chain-0.11.0/src/impl_error_chain_kind.rs
+++ /dev/null
@@ -1,541 +0,0 @@
-// From https://github.com/tailhook/quick-error
-// Changes:
-// - replace `impl Error` by `impl Item::description`
-// - $imeta
-
-#[macro_export]
-#[doc(hidden)]
-macro_rules! impl_error_chain_kind {
- ( $(#[$meta:meta])*
- pub enum $name:ident { $($chunks:tt)* }
- ) => {
- impl_error_chain_kind!(SORT [pub enum $name $(#[$meta])* ]
- items [] buf []
- queue [ $($chunks)* ]);
- };
- ( $(#[$meta:meta])*
- enum $name:ident { $($chunks:tt)* }
- ) => {
- impl_error_chain_kind!(SORT [enum $name $(#[$meta])* ]
- items [] buf []
- queue [ $($chunks)* ]);
- };
- // Queue is empty, can do the work
- (SORT [enum $name:ident $( #[$meta:meta] )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [ ]
- queue [ ]
- ) => {
- impl_error_chain_kind!(ENUM_DEFINITION [enum $name $( #[$meta] )*]
- body []
- queue [$($( #[$imeta] )*
- => $iitem: $imode [$( $ivar: $ityp ),*] )*]
- );
- impl_error_chain_kind!(IMPLEMENTATIONS $name {$(
- $iitem: $imode [$(#[$imeta])*] [$( $ivar: $ityp ),*] {$( $ifuncs )*}
- )*});
- $(
- impl_error_chain_kind!(ERROR_CHECK $imode $($ifuncs)*);
- )*
- };
- (SORT [pub enum $name:ident $( #[$meta:meta] )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [ ]
- queue [ ]
- ) => {
- impl_error_chain_kind!(ENUM_DEFINITION [pub enum $name $( #[$meta] )*]
- body []
- queue [$($( #[$imeta] )*
- => $iitem: $imode [$( $ivar: $ityp ),*] )*]
- );
- impl_error_chain_kind!(IMPLEMENTATIONS $name {$(
- $iitem: $imode [$(#[$imeta])*] [$( $ivar: $ityp ),*] {$( $ifuncs )*}
- )*});
- $(
- impl_error_chain_kind!(ERROR_CHECK $imode $($ifuncs)*);
- )*
- };
- // Add meta to buffer
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )*]
- queue [ #[$qmeta:meta] $( $tail:tt )*]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*]
- buf [$( #[$bmeta] )* #[$qmeta] ]
- queue [$( $tail )*]);
- };
- // Add ident to buffer
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )*]
- queue [ $qitem:ident $( $tail:tt )*]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- items [$( $(#[$imeta])*
- => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*]
- buf [$(#[$bmeta])* => $qitem : UNIT [ ] ]
- queue [$( $tail )*]);
- };
- // Flush buffer on meta after ident
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )*
- => $bitem:ident: $bmode:tt [$( $bvar:ident: $btyp:ty ),*] ]
- queue [ #[$qmeta:meta] $( $tail:tt )*]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- enum [$( $(#[$emeta])* => $eitem $(( $($etyp),* ))* )*
- $(#[$bmeta])* => $bitem: $bmode $(( $($btyp),* ))*]
- items [$($( #[$imeta:meta] )*
- => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*
- $bitem: $bmode [$( $bvar:$btyp ),*] {} ]
- buf [ #[$qmeta] ]
- queue [$( $tail )*]);
- };
- // Add tuple enum-variant
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )* => $bitem:ident: UNIT [ ] ]
- queue [($( $qvar:ident: $qtyp:ty ),+) $( $tail:tt )*]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*]
- buf [$( #[$bmeta] )* => $bitem: TUPLE [$( $qvar:$qtyp ),*] ]
- queue [$( $tail )*]
- );
- };
- // Add struct enum-variant - e.g. { descr: &'static str }
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )* => $bitem:ident: UNIT [ ] ]
- queue [{ $( $qvar:ident: $qtyp:ty ),+} $( $tail:tt )*]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*]
- buf [$( #[$bmeta] )* => $bitem: STRUCT [$( $qvar:$qtyp ),*] ]
- queue [$( $tail )*]);
- };
- // Add struct enum-variant, with excess comma - e.g. { descr: &'static str, }
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )* => $bitem:ident: UNIT [ ] ]
- queue [{$( $qvar:ident: $qtyp:ty ),+ ,} $( $tail:tt )*]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*]
- buf [$( #[$bmeta] )* => $bitem: STRUCT [$( $qvar:$qtyp ),*] ]
- queue [$( $tail )*]);
- };
- // Add braces and flush always on braces
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )*
- => $bitem:ident: $bmode:tt [$( $bvar:ident: $btyp:ty ),*] ]
- queue [ {$( $qfuncs:tt )*} $( $tail:tt )*]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*
- $(#[$bmeta])* => $bitem: $bmode [$( $bvar:$btyp ),*] {$( $qfuncs )*} ]
- buf [ ]
- queue [$( $tail )*]);
- };
- // Flush buffer on double ident
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )*
- => $bitem:ident: $bmode:tt [$( $bvar:ident: $btyp:ty ),*] ]
- queue [ $qitem:ident $( $tail:tt )*]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*
- $(#[$bmeta])* => $bitem: $bmode [$( $bvar:$btyp ),*] {} ]
- buf [ => $qitem : UNIT [ ] ]
- queue [$( $tail )*]);
- };
- // Flush buffer on end
- (SORT [$( $def:tt )*]
- items [$($( #[$imeta:meta] )*
- => $iitem:ident: $imode:tt [$( $ivar:ident: $ityp:ty ),*]
- {$( $ifuncs:tt )*} )* ]
- buf [$( #[$bmeta:meta] )*
- => $bitem:ident: $bmode:tt [$( $bvar:ident: $btyp:ty ),*] ]
- queue [ ]
- ) => {
- impl_error_chain_kind!(SORT [$( $def )*]
- items [$( $(#[$imeta])* => $iitem: $imode [$( $ivar:$ityp ),*] {$( $ifuncs )*} )*
- $(#[$bmeta])* => $bitem: $bmode [$( $bvar:$btyp ),*] {} ]
- buf [ ]
- queue [ ]);
- };
- // Public enum (Queue Empty)
- (ENUM_DEFINITION [pub enum $name:ident $( #[$meta:meta] )*]
- body [$($( #[$imeta:meta] )*
- => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ]
- queue [ ]
- ) => {
- $(#[$meta])*
- pub enum $name {
- $(
- $(#[$imeta])*
- $iitem $(($( $ttyp ),*))* $({$( $svar: $styp ),*})*,
- )*
-
- #[doc(hidden)]
- __Nonexhaustive {}
- }
- };
- // Private enum (Queue Empty)
- (ENUM_DEFINITION [enum $name:ident $( #[$meta:meta] )*]
- body [$($( #[$imeta:meta] )*
- => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ]
- queue [ ]
- ) => {
- $(#[$meta])*
- enum $name {
- $(
- $(#[$imeta])*
- $iitem $(($( $ttyp ),*))* $({$( $svar: $styp ),*})*,
- )*
- }
- };
- // Unit variant
- (ENUM_DEFINITION [$( $def:tt )*]
- body [$($( #[$imeta:meta] )*
- => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ]
- queue [$( #[$qmeta:meta] )*
- => $qitem:ident: UNIT [ ] $( $queue:tt )*]
- ) => {
- impl_error_chain_kind!(ENUM_DEFINITION [ $($def)* ]
- body [$($( #[$imeta] )* => $iitem ($(($( $ttyp ),+))*) {$({$( $svar: $styp ),*})*} )*
- $( #[$qmeta] )* => $qitem () {} ]
- queue [ $($queue)* ]
- );
- };
- // Tuple variant
- (ENUM_DEFINITION [$( $def:tt )*]
- body [$($( #[$imeta:meta] )*
- => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ]
- queue [$( #[$qmeta:meta] )*
- => $qitem:ident: TUPLE [$( $qvar:ident: $qtyp:ty ),+] $( $queue:tt )*]
- ) => {
- impl_error_chain_kind!(ENUM_DEFINITION [ $($def)* ]
- body [$($( #[$imeta] )* => $iitem ($(($( $ttyp ),+))*) {$({$( $svar: $styp ),*})*} )*
- $( #[$qmeta] )* => $qitem (($( $qtyp ),*)) {} ]
- queue [ $($queue)* ]
- );
- };
- // Struct variant
- (ENUM_DEFINITION [$( $def:tt )*]
- body [$($( #[$imeta:meta] )*
- => $iitem:ident ($(($( $ttyp:ty ),+))*) {$({$( $svar:ident: $styp:ty ),*})*} )* ]
- queue [$( #[$qmeta:meta] )*
- => $qitem:ident: STRUCT [$( $qvar:ident: $qtyp:ty ),*] $( $queue:tt )*]
- ) => {
- impl_error_chain_kind!(ENUM_DEFINITION [ $($def)* ]
- body [$($( #[$imeta] )* => $iitem ($(($( $ttyp ),+))*) {$({$( $svar: $styp ),*})*} )*
- $( #[$qmeta] )* => $qitem () {{$( $qvar: $qtyp ),*}} ]
- queue [ $($queue)* ]
- );
- };
- (IMPLEMENTATIONS
- $name:ident {$(
- $item:ident: $imode:tt [$(#[$imeta:meta])*] [$( $var:ident: $typ:ty ),*] {$( $funcs:tt )*}
- )*}
- ) => {
- #[allow(unknown_lints, unused, unused_doc_comment)]
- impl ::std::fmt::Display for $name {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter)
- -> ::std::fmt::Result
- {
- match *self {
- $(
- $(#[$imeta])*
- impl_error_chain_kind!(ITEM_PATTERN
- $name $item: $imode [$( ref $var ),*]
- ) => {
- let display_fn = impl_error_chain_kind!(FIND_DISPLAY_IMPL
- $name $item: $imode
- {$( $funcs )*});
-
- display_fn(self, fmt)
- }
- )*
-
- _ => Ok(())
- }
- }
- }
- /*#[allow(unused)]
- impl ::std::error::Error for $name {
- fn description(&self) -> &str {
- match *self {
- $(
- impl_error_chain_kind!(ITEM_PATTERN
- $name $item: $imode [$( ref $var ),*]
- ) => {
- impl_error_chain_kind!(FIND_DESCRIPTION_IMPL
- $item: $imode self fmt [$( $var ),*]
- {$( $funcs )*})
- }
- )*
- }
- }
- fn cause(&self) -> Option<&::std::error::Error> {
- match *self {
- $(
- impl_error_chain_kind!(ITEM_PATTERN
- $name $item: $imode [$( ref $var ),*]
- ) => {
- impl_error_chain_kind!(FIND_CAUSE_IMPL
- $item: $imode [$( $var ),*]
- {$( $funcs )*})
- }
- )*
- }
- }
- }*/
- #[allow(unknown_lints, unused, unused_doc_comment)]
- impl $name {
- /// A string describing the error kind.
- pub fn description(&self) -> &str {
- match *self {
- $(
- $(#[$imeta])*
- impl_error_chain_kind!(ITEM_PATTERN
- $name $item: $imode [$( ref $var ),*]
- ) => {
- impl_error_chain_kind!(FIND_DESCRIPTION_IMPL
- $item: $imode self fmt [$( $var ),*]
- {$( $funcs )*})
- }
- )*
-
- _ => "",
- }
- }
- }
- $(
- impl_error_chain_kind!(FIND_FROM_IMPL
- $name $item: $imode [$( $var:$typ ),*]
- {$( $funcs )*});
- )*
- };
- (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt
- { display($self_:tt) -> ($( $exprs:tt )*) $( $tail:tt )*}
- ) => {
- |impl_error_chain_kind!(IDENT $self_): &$name, f: &mut ::std::fmt::Formatter| {
- write!(f, $( $exprs )*)
- }
- };
- (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt
- { display($pattern:expr) $( $tail:tt )*}
- ) => {
- |_, f: &mut ::std::fmt::Formatter| { write!(f, $pattern) }
- };
- (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt
- { display($pattern:expr, $( $exprs:tt )*) $( $tail:tt )*}
- ) => {
- |_, f: &mut ::std::fmt::Formatter| { write!(f, $pattern, $( $exprs )*) }
- };
- (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt
- { $t:tt $( $tail:tt )*}
- ) => {
- impl_error_chain_kind!(FIND_DISPLAY_IMPL
- $name $item: $imode
- {$( $tail )*})
- };
- (FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt
- { }
- ) => {
- |self_: &$name, f: &mut ::std::fmt::Formatter| {
- write!(f, "{}", self_.description())
- }
- };
- (FIND_DESCRIPTION_IMPL $item:ident: $imode:tt $me:ident $fmt:ident
- [$( $var:ident ),*]
- { description($expr:expr) $( $tail:tt )*}
- ) => {
- $expr
- };
- (FIND_DESCRIPTION_IMPL $item:ident: $imode:tt $me:ident $fmt:ident
- [$( $var:ident ),*]
- { $t:tt $( $tail:tt )*}
- ) => {
- impl_error_chain_kind!(FIND_DESCRIPTION_IMPL
- $item: $imode $me $fmt [$( $var ),*]
- {$( $tail )*})
- };
- (FIND_DESCRIPTION_IMPL $item:ident: $imode:tt $me:ident $fmt:ident
- [$( $var:ident ),*]
- { }
- ) => {
- stringify!($item)
- };
- (FIND_CAUSE_IMPL $item:ident: $imode:tt
- [$( $var:ident ),*]
- { cause($expr:expr) $( $tail:tt )*}
- ) => {
- Some($expr)
- };
- (FIND_CAUSE_IMPL $item:ident: $imode:tt
- [$( $var:ident ),*]
- { $t:tt $( $tail:tt )*}
- ) => {
- impl_error_chain_kind!(FIND_CAUSE_IMPL
- $item: $imode [$( $var ),*]
- { $($tail)* })
- };
- (FIND_CAUSE_IMPL $item:ident: $imode:tt
- [$( $var:ident ),*]
- { }
- ) => {
- None
- };
- (FIND_FROM_IMPL $name:ident $item:ident: $imode:tt
- [$( $var:ident: $typ:ty ),*]
- { from() $( $tail:tt )*}
- ) => {
- $(
- impl From<$typ> for $name {
- fn from($var: $typ) -> $name {
- $name::$item($var)
- }
- }
- )*
- impl_error_chain_kind!(FIND_FROM_IMPL
- $name $item: $imode [$( $var:$typ ),*]
- {$( $tail )*});
- };
- (FIND_FROM_IMPL $name:ident $item:ident: UNIT
- [ ]
- { from($ftyp:ty) $( $tail:tt )*}
- ) => {
- impl From<$ftyp> for $name {
- fn from(_discarded_error: $ftyp) -> $name {
- $name::$item
- }
- }
- impl_error_chain_kind!(FIND_FROM_IMPL
- $name $item: UNIT [ ]
- {$( $tail )*});
- };
- (FIND_FROM_IMPL $name:ident $item:ident: TUPLE
- [$( $var:ident: $typ:ty ),*]
- { from($fvar:ident: $ftyp:ty) -> ($( $texpr:expr ),*) $( $tail:tt )*}
- ) => {
- impl From<$ftyp> for $name {
- fn from($fvar: $ftyp) -> $name {
- $name::$item($( $texpr ),*)
- }
- }
- impl_error_chain_kind!(FIND_FROM_IMPL
- $name $item: TUPLE [$( $var:$typ ),*]
- { $($tail)* });
- };
- (FIND_FROM_IMPL $name:ident $item:ident: STRUCT
- [$( $var:ident: $typ:ty ),*]
- { from($fvar:ident: $ftyp:ty) -> {$( $tvar:ident: $texpr:expr ),*} $( $tail:tt )*}
- ) => {
- impl From<$ftyp> for $name {
- fn from($fvar: $ftyp) -> $name {
- $name::$item {
- $( $tvar: $texpr ),*
- }
- }
- }
- impl_error_chain_kind!(FIND_FROM_IMPL
- $name $item: STRUCT [$( $var:$typ ),*]
- { $($tail)* });
- };
- (FIND_FROM_IMPL $name:ident $item:ident: $imode:tt
- [$( $var:ident: $typ:ty ),*]
- { $t:tt $( $tail:tt )*}
- ) => {
- impl_error_chain_kind!(FIND_FROM_IMPL
- $name $item: $imode [$( $var:$typ ),*]
- {$( $tail )*}
- );
- };
- (FIND_FROM_IMPL $name:ident $item:ident: $imode:tt
- [$( $var:ident: $typ:ty ),*]
- { }
- ) => {
- };
- (ITEM_BODY $(#[$imeta:meta])* $item:ident: UNIT
- ) => { };
- (ITEM_BODY $(#[$imeta:meta])* $item:ident: TUPLE
- [$( $typ:ty ),*]
- ) => {
- ($( $typ ),*)
- };
- (ITEM_BODY $(#[$imeta:meta])* $item:ident: STRUCT
- [$( $var:ident: $typ:ty ),*]
- ) => {
- {$( $var:$typ ),*}
- };
- (ITEM_PATTERN $name:ident $item:ident: UNIT []
- ) => {
- $name::$item
- };
- (ITEM_PATTERN $name:ident $item:ident: TUPLE
- [$( ref $var:ident ),*]
- ) => {
- $name::$item ($( ref $var ),*)
- };
- (ITEM_PATTERN $name:ident $item:ident: STRUCT
- [$( ref $var:ident ),*]
- ) => {
- $name::$item {$( ref $var ),*}
- };
- // This one should match all allowed sequences in "funcs" but not match
- // anything else.
- // This is to contrast FIND_* clauses which just find stuff they need and
- // skip everything else completely
- (ERROR_CHECK $imode:tt display($self_:tt) -> ($( $exprs:tt )*) $( $tail:tt )*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA $imode $($tail)*); };
- (ERROR_CHECK $imode:tt display($pattern: expr) $( $tail:tt )*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA $imode $($tail)*); };
- (ERROR_CHECK $imode:tt display($pattern: expr, $( $exprs:tt )*) $( $tail:tt )*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA $imode $($tail)*); };
- (ERROR_CHECK $imode:tt description($expr:expr) $( $tail:tt )*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA $imode $($tail)*); };
- (ERROR_CHECK $imode:tt cause($expr:expr) $($tail:tt)*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA $imode $($tail)*); };
- (ERROR_CHECK $imode:tt from() $($tail:tt)*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA $imode $($tail)*); };
- (ERROR_CHECK $imode:tt from($ftyp:ty) $($tail:tt)*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA $imode $($tail)*); };
- (ERROR_CHECK TUPLE from($fvar:ident: $ftyp:ty) -> ($( $e:expr ),*) $( $tail:tt )*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA TUPLE $($tail)*); };
- (ERROR_CHECK STRUCT from($fvar:ident: $ftyp:ty) -> {$( $v:ident: $e:expr ),*} $( $tail:tt )*)
- => { impl_error_chain_kind!(ERROR_CHECK_COMMA STRUCT $($tail)*); };
- (ERROR_CHECK $imode:tt ) => {};
- (ERROR_CHECK_COMMA $imode:tt , $( $tail:tt )*)
- => { impl_error_chain_kind!(ERROR_CHECK $imode $($tail)*); };
- (ERROR_CHECK_COMMA $imode:tt $( $tail:tt )*)
- => { impl_error_chain_kind!(ERROR_CHECK $imode $($tail)*); };
- // Utility functions
- (IDENT $ident:ident) => { $ident }
-}
diff --git a/vendor/error-chain-0.11.0/src/lib.rs b/vendor/error-chain-0.11.0/src/lib.rs
deleted file mode 100644
index d0881fc..0000000
--- a/vendor/error-chain-0.11.0/src/lib.rs
+++ /dev/null
@@ -1,865 +0,0 @@
-#![deny(missing_docs)]
-#![allow(unknown_lints)] // to be removed when unused_doc_comments lints is merged
-#![doc(html_root_url = "https://docs.rs/error-chain/0.11.0")]
-
-//! A library for consistent and reliable error handling
-//!
-//! error-chain makes it easy to take full advantage of Rust's
-//! powerful error handling features without the overhead of
-//! maintaining boilerplate error types and conversions. It implements
-//! an opinionated strategy for defining your own error types, as well
-//! as conversions from others' error types.
-//!
-//! ## Quick start
-//!
-//! If you just want to set up your new project with error-chain,
-//! follow the [quickstart.rs] template, and read this [intro]
-//! to error-chain.
-//!
-//! [quickstart.rs]: https://github.com/rust-lang-nursery/error-chain/blob/master/examples/quickstart.rs
-//! [intro]: http://brson.github.io/2016/11/30/starting-with-error-chain
-//!
-//! ## Why error chain?
-//!
-//! * error-chain is easy to configure. Handle errors robustly with minimal
-//! effort.
-//! * Basic error handling requires no maintenance of custom error types
-//! nor the [`From`] conversions that make `?` work.
-//! * error-chain scales from simple error handling strategies to more
-//! rigorous. Return formatted strings for simple errors, only
-//! introducing error variants and their strong typing as needed for
-//! advanced error recovery.
-//! * error-chain makes it trivial to correctly manage the [cause] of
-//! the errors generated by your own code. This is the "chaining"
-//! in "error-chain".
-//!
-//! [cause]: https://doc.rust-lang.org/std/error/trait.Error.html#method.cause
-//!
-//! ## Principles of error-chain
-//!
-//! error-chain is based on the following principles:
-//!
-//! * No error should ever be discarded. This library primarily
-//! makes it easy to "chain" errors with the [`chain_err`] method.
-//! * Introducing new errors is trivial. Simple errors can be introduced
-//! at the error site with just a string.
-//! * Handling errors is possible with pattern matching.
-//! * Conversions between error types are done in an automatic and
-//! consistent way - [`From`] conversion behavior is never specified
-//! explicitly.
-//! * Errors implement [`Send`].
-//! * Errors can carry backtraces.
-//!
-//! Similar to other libraries like [error-type] and [quick-error],
-//! this library introduces the error chaining mechanism originally
-//! employed by Cargo. The [`error_chain!`] macro declares the types
-//! and implementation boilerplate necessary for fulfilling a
-//! particular error-handling strategy. Most importantly it defines a
-//! custom error type (called [`Error`] by convention) and the [`From`]
-//! conversions that let the `?` operator work.
-//!
-//! This library differs in a few ways from previous error libs:
-//!
-//! * Instead of defining the custom [`Error`] type as an enum, it is a
-//! struct containing an [`ErrorKind`][] (which defines the
-//! [`description`] and [`display_chain`] methods for the error), an opaque,
-//! optional, boxed [`std::error::Error`]` + `[`Send`]` + 'static` object
-//! (which defines the [`cause`], and establishes the links in the
-//! error chain), and a [`Backtrace`].
-//! * The macro also defines a [`ResultExt`] trait that defines a
-//! [`chain_err`] method. This method on all [`std::error::Error`]` + `[`Send`]` + 'static`
-//! types extends the error chain by boxing the current
-//! error into an opaque object and putting it inside a new concrete
-//! error.
-//! * It provides automatic [`From`] conversions between other error types
-//! defined by the [`error_chain!`] that preserve type information,
-//! and facilitate seamless error composition and matching of composed
-//! errors.
-//! * It provides automatic [`From`] conversions between any other error
-//! type that hides the type of the other error in the [`cause`] box.
-//! * If `RUST_BACKTRACE` is enabled, it collects a single backtrace at
-//! the earliest opportunity and propagates it down the stack through
-//! [`From`] and [`ResultExt`] conversions.
-//!
-//! To accomplish its goals it makes some tradeoffs:
-//!
-//! * The split between the [`Error`] and [`ErrorKind`] types can make it
-//! slightly more cumbersome to instantiate new (unchained) errors,
-//! requiring an [`Into`] or [`From`] conversion; as well as slightly
-//! more cumbersome to match on errors with another layer of types
-//! to match.
-//! * Because the error type contains [`std::error::Error`]` + `[`Send`]` + 'static` objects,
-//! it can't implement [`PartialEq`] for easy comparisons.
-//!
-//! ## Declaring error types
-//!
-//! Generally, you define one family of error types per crate, though
-//! it's also perfectly fine to define error types on a finer-grained
-//! basis, such as per module.
-//!
-//! Assuming you are using crate-level error types, typically you will
-//! define an `errors` module and inside it call [`error_chain!`]:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! mod other_error {
-//! error_chain! {}
-//! }
-//!
-//! error_chain! {
-//! // The type defined for this error. These are the conventional
-//! // and recommended names, but they can be arbitrarily chosen.
-//! //
-//! // It is also possible to leave this section out entirely, or
-//! // leave it empty, and these names will be used automatically.
-//! types {
-//! Error, ErrorKind, ResultExt, Result;
-//! }
-//!
-//! // Without the `Result` wrapper:
-//! //
-//! // types {
-//! // Error, ErrorKind, ResultExt;
-//! // }
-//!
-//! // Automatic conversions between this error chain and other
-//! // error chains. In this case, it will e.g. generate an
-//! // `ErrorKind` variant called `Another` which in turn contains
-//! // the `other_error::ErrorKind`, with conversions from
-//! // `other_error::Error`.
-//! //
-//! // Optionally, some attributes can be added to a variant.
-//! //
-//! // This section can be empty.
-//! links {
-//! Another(other_error::Error, other_error::ErrorKind) #[cfg(unix)];
-//! }
-//!
-//! // Automatic conversions between this error chain and other
-//! // error types not defined by the `error_chain!`. These will be
-//! // wrapped in a new error with, in the first case, the
-//! // `ErrorKind::Fmt` variant. The description and cause will
-//! // forward to the description and cause of the original error.
-//! //
-//! // Optionally, some attributes can be added to a variant.
-//! //
-//! // This section can be empty.
-//! foreign_links {
-//! Fmt(::std::fmt::Error);
-//! Io(::std::io::Error) #[cfg(unix)];
-//! }
-//!
-//! // Define additional `ErrorKind` variants. Define custom responses with the
-//! // `description` and `display` calls.
-//! errors {
-//! InvalidToolchainName(t: String) {
-//! description("invalid toolchain name")
-//! display("invalid toolchain name: '{}'", t)
-//! }
-//!
-//! // You can also add commas after description/display.
-//! // This may work better with some editor auto-indentation modes:
-//! UnknownToolchainVersion(v: String) {
-//! description("unknown toolchain version"), // note the ,
-//! display("unknown toolchain version: '{}'", v), // trailing comma is allowed
-//! }
-//! }
-//! }
-//!
-//! # fn main() {}
-//! ```
-//!
-//! Each section, `types`, `links`, `foreign_links`, and `errors` may
-//! be omitted if it is empty.
-//!
-//! This populates the module with a number of definitions,
-//! the most important of which are the [`Error`] type
-//! and the [`ErrorKind`] type. An example of generated code can be found in the
-//! [example_generated](example_generated/index.html) module.
-//!
-//! ## Returning new errors
-//!
-//! Introducing new error chains, with a string message:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! # fn main() {}
-//! # error_chain! {}
-//! fn foo() -> Result<()> {
-//! Err("foo error!".into())
-//! }
-//! ```
-//!
-//! Introducing new error chains, with an [`ErrorKind`]:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! # fn main() {}
-//! error_chain! {
-//! errors { FooError }
-//! }
-//!
-//! fn foo() -> Result<()> {
-//! Err(ErrorKind::FooError.into())
-//! }
-//! ```
-//!
-//! Note that the return type is the typedef [`Result`], which is
-//! defined by the macro as `pub type Result<T> =
-//! ::std::result::Result<T, Error>`. Note that in both cases
-//! [`.into()`] is called to convert a type into the [`Error`] type; both
-//! strings and [`ErrorKind`] have [`From`] conversions to turn them into
-//! [`Error`].
-//!
-//! When the error is emitted behind the `?` operator, the explicit conversion
-//! isn't needed; `Err(ErrorKind)` will automatically be converted to `Err(Error)`.
-//! So the below is equivalent to the previous:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! # fn main() {}
-//! # error_chain! { errors { FooError } }
-//! fn foo() -> Result<()> {
-//! Ok(Err(ErrorKind::FooError)?)
-//! }
-//!
-//! fn bar() -> Result<()> {
-//! Ok(Err("bogus!")?)
-//! }
-//! ```
-//!
-//! ## The `bail!` macro
-//!
-//! The above method of introducing new errors works but is a little
-//! verbose. Instead, we can use the [`bail!`] macro, which performs an early return
-//! with conversions done automatically.
-//!
-//! With [`bail!`] the previous examples look like:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! # fn main() {}
-//! # error_chain! { errors { FooError } }
-//! fn foo() -> Result<()> {
-//! if true {
-//! bail!(ErrorKind::FooError);
-//! } else {
-//! Ok(())
-//! }
-//! }
-//!
-//! fn bar() -> Result<()> {
-//! if true {
-//! bail!("bogus!");
-//! } else {
-//! Ok(())
-//! }
-//! }
-//! ```
-//!
-//! ## Chaining errors
-//! error-chain supports extending an error chain by appending new errors.
-//! This can be done on a Result or on an existing Error.
-//!
-//! To extend the error chain:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! # fn main() {}
-//! # error_chain! {}
-//! # fn do_something() -> Result<()> { unimplemented!() }
-//! # fn test() -> Result<()> {
-//! let res: Result<()> = do_something().chain_err(|| "something went wrong");
-//! # Ok(())
-//! # }
-//! ```
-//!
-//! [`chain_err`] can be called on any [`Result`] type where the contained
-//! error type implements [`std::error::Error`]` + `[`Send`]` + 'static`, as long as
-//! the [`Result`] type's corresponding [`ResultExt`] trait is in scope. If
-//! the [`Result`] is an `Err` then [`chain_err`] evaluates the closure,
-//! which returns *some type that can be converted to [`ErrorKind`]*,
-//! boxes the original error to store as the cause, then returns a new
-//! error containing the original error.
-//!
-//! Calling [`chain_err`][Error_chain_err] on an existing [`Error`] instance has
-//! the same signature and produces the same outcome as being called on a
-//! [`Result`] matching the properties described above. This is most useful when
-//! partially handling errors using the [`map_err`] function.
-//!
-//! To chain an error directly, use [`with_chain`]:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! # fn main() {}
-//! # error_chain! {}
-//! # fn do_something() -> Result<()> { unimplemented!() }
-//! # fn test() -> Result<()> {
-//! let res: Result<()> =
-//! do_something().map_err(|e| Error::with_chain(e, "something went wrong"));
-//! # Ok(())
-//! # }
-//! ```
-//!
-//! ## Linking errors
-//!
-//! To convert an error from another error chain to this error chain:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! # fn main() {}
-//! # mod other { error_chain! {} }
-//! error_chain! {
-//! links {
-//! OtherError(other::Error, other::ErrorKind);
-//! }
-//! }
-//!
-//! fn do_other_thing() -> other::Result<()> { unimplemented!() }
-//!
-//! # fn test() -> Result<()> {
-//! let res: Result<()> = do_other_thing().map_err(|e| e.into());
-//! # Ok(())
-//! # }
-//! ```
-//!
-//! The [`Error`] and [`ErrorKind`] types implements [`From`] for the corresponding
-//! types of all linked error chains. Linked errors do not introduce a new
-//! cause to the error chain.
-//!
-//! ## Matching errors
-//!
-//! error-chain error variants are matched with simple patterns.
-//! [`Error`] is a tuple struct and its first field is the [`ErrorKind`],
-//! making dispatching on error kinds relatively compact:
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! # fn main() {
-//! error_chain! {
-//! errors {
-//! InvalidToolchainName(t: String) {
-//! description("invalid toolchain name")
-//! display("invalid toolchain name: '{}'", t)
-//! }
-//! }
-//! }
-//!
-//! match Error::from("error!") {
-//! Error(ErrorKind::InvalidToolchainName(_), _) => { }
-//! Error(ErrorKind::Msg(_), _) => { }
-//! _ => { }
-//! }
-//! # }
-//! ```
-//!
-//! Chained errors are also matched with (relatively) compact syntax
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! mod utils {
-//! error_chain! {
-//! errors {
-//! BadStuff {
-//! description("bad stuff")
-//! }
-//! }
-//! }
-//! }
-//!
-//! mod app {
-//! error_chain! {
-//! links {
-//! Utils(::utils::Error, ::utils::ErrorKind);
-//! }
-//! }
-//! }
-//!
-//!
-//! # fn main() {
-//! match app::Error::from("error!") {
-//! app::Error(app::ErrorKind::Utils(utils::ErrorKind::BadStuff), _) => { }
-//! _ => { }
-//! }
-//! # }
-//! ```
-//!
-//! ## Inspecting errors
-//!
-//! An error-chain error contains information about the error itself, a backtrace, and the chain
-//! of causing errors. For reporting purposes, this information can be accessed as follows.
-//!
-//! ```
-//! # #[macro_use] extern crate error_chain;
-//! use error_chain::ChainedError; // for e.display_chain()
-//!
-//! error_chain! {
-//! errors {
-//! InvalidToolchainName(t: String) {
-//! description("invalid toolchain name")
-//! display("invalid toolchain name: '{}'", t)
-//! }
-//! }
-//! }
-//!
-//! # fn main() {
-//! // Generate an example error to inspect:
-//! let e = "xyzzy".parse::<i32>()
-//! .chain_err(|| ErrorKind::InvalidToolchainName("xyzzy".to_string()))
-//! .unwrap_err();
-//!
-//! // Get the brief description of the error:
-//! assert_eq!(e.description(), "invalid toolchain name");
-//!
-//! // Get the display version of the error:
-//! assert_eq!(e.to_string(), "invalid toolchain name: 'xyzzy'");
-//!
-//! // Get the full cause and backtrace:
-//! println!("{}", e.display_chain().to_string());
-//! // Error: invalid toolchain name: 'xyzzy'
-//! // Caused by: invalid digit found in string
-//! // stack backtrace:
-//! // 0: 0x7fa9f684fc94 - backtrace::backtrace::libunwind::trace
-//! // at src/backtrace/libunwind.rs:53
-//! // - backtrace::backtrace::trace<closure>
-//! // at src/backtrace/mod.rs:42
-//! // 1: 0x7fa9f6850b0e - backtrace::capture::{{impl}}::new
-//! // at out/capture.rs:79
-//! // [..]
-//! # }
-//! ```
-//!
-//! The [`Error`] and [`ErrorKind`] types also allow programmatic access to these elements.
-//!
-//! ## Foreign links
-//!
-//! Errors that do not conform to the same conventions as this library
-//! can still be included in the error chain. They are considered "foreign
-//! errors", and are declared using the `foreign_links` block of the
-//! [`error_chain!`] macro. [`Error`]s are automatically created from
-//! foreign errors by the `?` operator.
-//!
-//! Foreign links and regular links have one crucial difference:
-//! [`From`] conversions for regular links *do not introduce a new error
-//! into the error chain*, while conversions for foreign links *always
-//! introduce a new error into the error chain*. So for the example
-//! above all errors deriving from the [`std::fmt::Error`] type will be
-//! presented to the user as a new [`ErrorKind`] variant, and the
-//! cause will be the original [`std::fmt::Error`] error. In contrast, when
-//! `other_error::Error` is converted to `Error` the two `ErrorKind`s
-//! are converted between each other to create a new `Error` but the
-//! old error is discarded; there is no "cause" created from the
-//! original error.
-//!
-//! ## Backtraces
-//!
-//! If the `RUST_BACKTRACE` environment variable is set to anything
-//! but ``0``, the earliest non-foreign error to be generated creates
-//! a single backtrace, which is passed through all [`From`] conversions
-//! and [`chain_err`] invocations of compatible types. To read the
-//! backtrace just call the [`backtrace`] method.
-//!
-//! Backtrace generation can be disabled by turning off the `backtrace` feature.
-//!
-//! The Backtrace contains a Vec of [`BacktraceFrame`]s that can be operated
-//! on directly. For example, to only see the files and line numbers of code
-//! within your own project.
-//!
-//! ```
-//! # #[macro_use]
-//! # extern crate error_chain;
-//! # mod errors {
-//! # error_chain! {
-//! # foreign_links {
-//! # Io(::std::io::Error);
-//! # }
-//! # }
-//! # }
-//! # use errors::*;
-//! # #[cfg(feature="backtrace")]
-//! # fn main() {
-//! if let Err(ref e) = open_file() {
-//! if let Some(backtrace) = e.backtrace() {
-//! let frames = backtrace.frames();
-//! for frame in frames.iter() {
-//! for symbol in frame.symbols().iter() {
-//! if let (Some(file), Some(lineno)) = (symbol.filename(), symbol.lineno()) {
-//! if file.display().to_string()[0..3] == "src".to_string(){
-//! println!("{}:{}", file.display().to_string(), lineno);
-//! }
-//! }
-//! }
-//! }
-//! }
-//! };
-//! # }
-//! # #[cfg(not(feature="backtrace"))]
-//! # fn main() { }
-//!
-//! fn open_file() -> Result<()> {
-//! std::fs::File::open("does_not_exist")?;
-//! Ok(())
-//! }
-//! ```
-//!
-//! ## Iteration
-//!
-//! The [`iter`] method returns an iterator over the chain of error boxes.
-//!
-//! [error-type]: https://github.com/DanielKeep/rust-error-type
-//! [quick-error]: https://github.com/tailhook/quick-error
-
-//! [`display_chain`]: trait.ChainedError.html#method.display_chain
-//! [`error_chain!`]: macro.error_chain.html
-//! [`bail!`]: macro.bail.html
-//! [`Backtrace`]: struct.Backtrace.html
-
-//! [`Error`]: example_generated/struct.Error.html
-//! [`with_chain`]: example_generated/struct.Error.html#method.with_chain
-//! [Error_chain_err]: example_generated/struct.Error.html#method.chain_err
-//! [`cause`]: example_generated/struct.Error.html#method.cause
-//! [`backtrace`]: example_generated/struct.Error.html#method.backtrace
-//! [`iter`]: example_generated/struct.Error.html#method.iter
-//! [`ErrorKind`]: example_generated/enum.ErrorKind.html
-//! [`description`]: example_generated/enum.ErrorKind.html#method.description
-//! [`Result`]: example_generated/type.Result.html
-//! [`ResultExt`]: example_generated/trait.ResultExt.html
-//! [`chain_err`]: example_generated/trait.ResultExt.html#tymethod.chain_err
-
-//! [`std::error::Error`]: https://doc.rust-lang.org/std/error/trait.Error.html
-//! [`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
-//! [`Into`]: https://doc.rust-lang.org/std/convert/trait.Into.html
-//! [`From`]: https://doc.rust-lang.org/std/convert/trait.From.html
-//! [`PartialEq`]: https://doc.rust-lang.org/std/cmp/trait.PartialEq.html
-//! [`std::fmt::Error`]: https://doc.rust-lang.org/std/fmt/struct.Error.html
-//! [`.into()`]: https://doc.rust-lang.org/std/convert/trait.Into.html#tymethod.into
-//! [`map_err`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.map_err
-//! [`BacktraceFrame`]: https://docs.rs/backtrace/0.3.2/backtrace/struct.BacktraceFrame.html
-
-
-#[cfg(feature = "backtrace")]
-extern crate backtrace;
-
-use std::error;
-use std::iter::Iterator;
-#[cfg(feature = "backtrace")]
-use std::sync::Arc;
-use std::fmt;
-
-#[cfg(feature = "backtrace")]
-pub use backtrace::Backtrace;
-#[cfg(not(feature = "backtrace"))]
-/// Dummy type used when the `backtrace` feature is disabled.
-pub type Backtrace = ();
-
-#[macro_use]
-mod impl_error_chain_kind;
-#[macro_use]
-mod error_chain;
-#[macro_use]
-mod quick_main;
-pub use quick_main::ExitCode;
-#[cfg(feature = "example_generated")]
-pub mod example_generated;
-
-#[derive(Debug)]
-/// Iterator over the error chain using the `Error::cause()` method.
-pub struct Iter<'a>(Option<&'a error::Error>);
-
-impl<'a> Iter<'a> {
- /// Returns a new iterator over the error chain using `Error::cause()`.
- pub fn new(err: Option<&'a error::Error>) -> Iter<'a> {
- Iter(err)
- }
-}
-
-impl<'a> Iterator for Iter<'a> {
- type Item = &'a error::Error;
-
- fn next<'b>(&'b mut self) -> Option<&'a error::Error> {
- match self.0.take() {
- Some(e) => {
- self.0 = e.cause();
- Some(e)
- }
- None => None,
- }
- }
-}
-
-/// Returns a backtrace of the current call stack if `RUST_BACKTRACE`
-/// is set to anything but ``0``, and `None` otherwise. This is used
-/// in the generated error implementations.
-#[cfg(feature = "backtrace")]
-#[doc(hidden)]
-pub fn make_backtrace() -> Option<Arc<Backtrace>> {
- use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
-
- // The lowest bit indicates whether the value was computed,
- // while the second lowest bit is the actual "enabled" bit.
- static BACKTRACE_ENABLED_CACHE: AtomicUsize = ATOMIC_USIZE_INIT;
-
- let enabled = match BACKTRACE_ENABLED_CACHE.load(Ordering::Relaxed) {
- 0 => {
- let enabled = match std::env::var_os("RUST_BACKTRACE") {
- Some(ref val) if val != "0" => true,
- _ => false
- };
- let encoded = ((enabled as usize) << 1) | 1;
- BACKTRACE_ENABLED_CACHE.store(encoded, Ordering::Relaxed);
- enabled
- }
- encoded => (encoded >> 1) != 0
- };
-
- if enabled {
- Some(Arc::new(Backtrace::new()))
- } else {
- None
- }
-}
-
-/// This trait is implemented on all the errors generated by the `error_chain`
-/// macro.
-pub trait ChainedError: error::Error + Send + 'static {
- /// Associated kind type.
- type ErrorKind;
-
- /// Constructs an error from a kind, and generates a backtrace.
- fn from_kind(kind: Self::ErrorKind) -> Self where Self: Sized;
-
- /// Constructs a chained error from another error and a kind, and generates a backtrace.
- fn with_chain<E, K>(error: E, kind: K) -> Self
- where Self: Sized,
- E: ::std::error::Error + Send + 'static,
- K: Into<Self::ErrorKind>;
-
- /// Returns the kind of the error.
- fn kind(&self) -> &Self::ErrorKind;
-
- /// Iterates over the error chain.
- fn iter(&self) -> Iter;
-
- /// Returns the backtrace associated with this error.
- fn backtrace(&self) -> Option<&Backtrace>;
-
- /// Returns an object which implements `Display` for printing the full
- /// context of this error.
- ///
- /// The full cause chain and backtrace, if present, will be printed.
- fn display_chain<'a>(&'a self) -> DisplayChain<'a, Self> {
- DisplayChain(self)
- }
-
- /// Extends the error chain with a new entry.
- fn chain_err<F, EK>(self, error: F) -> Self
- where F: FnOnce() -> EK,
- EK: Into<Self::ErrorKind>;
-
- /// Creates an error from its parts.
- #[doc(hidden)]
- fn new(kind: Self::ErrorKind, state: State) -> Self where Self: Sized;
-
- /// Returns the first known backtrace, either from its State or from one
- /// of the errors from `foreign_links`.
- #[cfg(feature = "backtrace")]
- #[doc(hidden)]
- fn extract_backtrace(e: &(error::Error + Send + 'static)) -> Option<Arc<Backtrace>>
- where Self: Sized;
-}
-
-/// A struct which formats an error for output.
-#[derive(Debug)]
-pub struct DisplayChain<'a, T: 'a + ?Sized>(&'a T);
-
-impl<'a, T> fmt::Display for DisplayChain<'a, T>
- where T: ChainedError
-{
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
- // Keep `try!` for 1.10 support
- try!(writeln!(fmt, "Error: {}", self.0));
-
- for e in self.0.iter().skip(1) {
- try!(writeln!(fmt, "Caused by: {}", e));
- }
-
- if let Some(backtrace) = self.0.backtrace() {
- try!(writeln!(fmt, "{:?}", backtrace));
- }
-
- Ok(())
- }
-}
-
-/// Common state between errors.
-#[derive(Debug)]
-#[doc(hidden)]
-pub struct State {
- /// Next error in the error chain.
- pub next_error: Option<Box<error::Error + Send>>,
- /// Backtrace for the current error.
- #[cfg(feature = "backtrace")]
- pub backtrace: Option<Arc<Backtrace>>,
-}
-
-impl Default for State {
- #[cfg(feature = "backtrace")]
- fn default() -> State {
- State {
- next_error: None,
- backtrace: make_backtrace(),
- }
- }
-
- #[cfg(not(feature = "backtrace"))]
- fn default() -> State {
- State { next_error: None }
- }
-}
-
-impl State {
- /// Creates a new State type
- #[cfg(feature = "backtrace")]
- pub fn new<CE: ChainedError>(e: Box<error::Error + Send>) -> State {
- let backtrace = CE::extract_backtrace(&*e).or_else(make_backtrace);
- State {
- next_error: Some(e),
- backtrace: backtrace,
- }
- }
-
- /// Creates a new State type
- #[cfg(not(feature = "backtrace"))]
- pub fn new<CE: ChainedError>(e: Box<error::Error + Send>) -> State {
- State { next_error: Some(e) }
- }
-
- /// Returns the inner backtrace if present.
- #[cfg(feature = "backtrace")]
- pub fn backtrace(&self) -> Option<&Backtrace> {
- self.backtrace.as_ref().map(|v| &**v)
- }
-
- /// Returns the inner backtrace if present.
- #[cfg(not(feature = "backtrace"))]
- pub fn backtrace(&self) -> Option<&Backtrace> {
- None
- }
-}
-
-/// Exits a function early with an error
-///
-/// The `bail!` macro provides an easy way to exit a function.
-/// `bail!(expr)` is equivalent to writing.
-///
-/// ```
-/// # #[macro_use] extern crate error_chain;
-/// # error_chain! { }
-/// # fn main() { }
-/// # fn foo() -> Result<()> {
-/// # let expr = "";
-/// return Err(expr.into());
-/// # }
-/// ```
-///
-/// And as shorthand it takes a formatting string a la `println!`:
-///
-/// ```
-/// # #[macro_use] extern crate error_chain;
-/// # error_chain! { }
-/// # fn main() { }
-/// # fn foo() -> Result<()> {
-/// # let n = 0;
-/// bail!("bad number: {}", n);
-/// # }
-/// ```
-///
-/// # Examples
-///
-/// Bailing on a custom error:
-///
-/// ```
-/// # #[macro_use] extern crate error_chain;
-/// # fn main() {}
-/// error_chain! {
-/// errors { FooError }
-/// }
-///
-/// fn foo() -> Result<()> {
-/// if bad_condition() {
-/// bail!(ErrorKind::FooError);
-/// }
-///
-/// Ok(())
-/// }
-///
-/// # fn bad_condition() -> bool { true }
-/// ```
-///
-/// Bailing on a formatted string:
-///
-/// ```
-/// # #[macro_use] extern crate error_chain;
-/// # fn main() {}
-/// error_chain! { }
-///
-/// fn foo() -> Result<()> {
-/// if let Some(bad_num) = bad_condition() {
-/// bail!("so bad: {}", bad_num);
-/// }
-///
-/// Ok(())
-/// }
-///
-/// # fn bad_condition() -> Option<i8> { None }
-/// ```
-#[macro_export]
-macro_rules! bail {
- ($e:expr) => {
- return Err($e.into());
- };
- ($fmt:expr, $($arg:tt)+) => {
- return Err(format!($fmt, $($arg)+).into());
- };
-}
-
-/// Exits a function early with an error if the condition is not satisfied
-///
-/// The `ensure!` macro is a convenience helper that provides a way to exit
-/// a function with an error if the given condition fails.
-///
-/// As an example, `ensure!(condition, "error code: {}", errcode)` is equivalent to
-///
-/// ```
-/// # #[macro_use] extern crate error_chain;
-/// # error_chain! { }
-/// # fn main() { }
-/// # fn foo() -> Result<()> {
-/// # let errcode = 0u8;
-/// # let condition = true;
-/// if !condition {
-/// bail!("error code: {}", errcode);
-/// }
-/// # Ok(())
-/// # }
-/// ```
-///
-/// See documentation for `bail!` macro for further details.
-#[macro_export]
-macro_rules! ensure {
- ($cond:expr, $e:expr) => {
- if !($cond) {
- bail!($e);
- }
- };
- ($cond:expr, $fmt:expr, $($arg:tt)+) => {
- if !($cond) {
- bail!($fmt, $($arg)+);
- }
- };
-}
-
-#[doc(hidden)]
-pub mod mock {
- error_chain!{}
-}
diff --git a/vendor/error-chain-0.11.0/src/quick_main.rs b/vendor/error-chain-0.11.0/src/quick_main.rs
deleted file mode 100644
index f81e7d7..0000000
--- a/vendor/error-chain-0.11.0/src/quick_main.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-/// Convenient wrapper to be able to use `?` and such in the main. You can
-/// use it with a separated function:
-///
-/// ```
-/// # #[macro_use] extern crate error_chain;
-/// # error_chain! {}
-/// # fn main() {
-/// quick_main!(run);
-/// # }
-///
-/// fn run() -> Result<()> {
-/// Err("error".into())
-/// }
-/// ```
-///
-/// or with a closure:
-///
-/// ```
-/// # #[macro_use] extern crate error_chain;
-/// # error_chain! {}
-/// # fn main() {
-/// quick_main!(|| -> Result<()> {
-/// Err("error".into())
-/// });
-/// # }
-/// ```
-///
-/// You can also set the exit value of the process by returning a type that implements [`ExitCode`](trait.ExitCode.html):
-///
-/// ```
-/// # #[macro_use] extern crate error_chain;
-/// # error_chain! {}
-/// # fn main() {
-/// quick_main!(run);
-/// # }
-///
-/// fn run() -> Result<i32> {
-/// Err("error".into())
-/// }
-/// ```
-#[macro_export]
-macro_rules! quick_main {
- ($main:expr) => {
- fn main() {
- use ::std::io::Write;
-
- ::std::process::exit(match $main() {
- Ok(ret) => $crate::ExitCode::code(ret),
- Err(ref e) => {
- write!(&mut ::std::io::stderr(), "{}", $crate::ChainedError::display_chain(e))
- .expect("Error writing to stderr");
-
- 1
- }
- });
- }
- };
-}
-
-/// Represents a value that can be used as the exit status of the process.
-/// See [`quick_main!`](macro.quick_main.html).
-pub trait ExitCode {
- /// Returns the value to use as the exit status.
- fn code(self) -> i32;
-}
-
-impl ExitCode for i32 {
- fn code(self) -> i32 {
- self
- }
-}
-
-impl ExitCode for () {
- fn code(self) -> i32 {
- 0
- }
-}
diff --git a/vendor/error-chain-0.11.0/tests/quick_main.rs b/vendor/error-chain-0.11.0/tests/quick_main.rs
deleted file mode 100644
index 4ada3b4..0000000
--- a/vendor/error-chain-0.11.0/tests/quick_main.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-#![allow(dead_code)]
-#[macro_use]
-extern crate error_chain;
-
-error_chain!();
-
-mod unit {
- use super::*;
- quick_main!(run);
-
- fn run() -> Result<()> {
- Ok(())
- }
-}
-
-mod i32 {
- use super::*;
- quick_main!(run);
-
- fn run() -> Result<i32> {
- Ok(1)
- }
-}
-
-mod closure {
- use super::*;
- quick_main!(|| -> Result<()> { Ok(()) });
-}
diff --git a/vendor/error-chain-0.11.0/tests/tests.rs b/vendor/error-chain-0.11.0/tests/tests.rs
deleted file mode 100644
index e603e02..0000000
--- a/vendor/error-chain-0.11.0/tests/tests.rs
+++ /dev/null
@@ -1,628 +0,0 @@
-#![allow(dead_code)]
-
-#[macro_use]
-extern crate error_chain;
-
-#[test]
-fn smoke_test_1() {
- error_chain! {
- types {
- Error, ErrorKind, ResultExt, Result;
- }
-
- links { }
-
- foreign_links { }
-
- errors { }
- };
-}
-
-#[test]
-fn smoke_test_2() {
- error_chain! {
- types { }
-
- links { }
-
- foreign_links { }
-
- errors { }
- };
-}
-
-#[test]
-fn smoke_test_3() {
- error_chain! {
- links { }
-
- foreign_links { }
-
- errors { }
- };
-}
-
-#[test]
-fn smoke_test_4() {
- error_chain! {
- links { }
-
- foreign_links { }
-
- errors {
- HttpStatus(e: u32) {
- description("http request returned an unsuccessful status code")
- display("http request returned an unsuccessful status code: {}", e)
- }
- }
- };
-}
-
-#[test]
-fn smoke_test_5() {
- error_chain! {
- types { }
-
- links { }
-
- foreign_links { }
-
- errors {
- HttpStatus(e: u32) {
- description("http request returned an unsuccessful status code")
- display("http request returned an unsuccessful status code: {}", e)
- }
- }
- };
-}
-
-#[test]
-fn smoke_test_6() {
- error_chain! {
- errors {
- HttpStatus(e: u32) {
- description("http request returned an unsuccessful status code")
- display("http request returned an unsuccessful status code: {}", e)
- }
- }
- };
-}
-
-#[test]
-fn smoke_test_7() {
- error_chain! {
- types { }
-
- foreign_links { }
-
- errors {
- HttpStatus(e: u32) {
- description("http request returned an unsuccessful status code")
- display("http request returned an unsuccessful status code: {}", e)
- }
- }
- };
-}
-
-#[test]
-fn smoke_test_8() {
- error_chain! {
- types { }
-
- links { }
- links { }
-
- foreign_links { }
- foreign_links { }
-
- errors {
- FileNotFound
- AccessDenied
- }
- };
-}
-
-#[test]
-fn order_test_1() {
- error_chain! { types { } links { } foreign_links { } errors { } };
-}
-
-#[test]
-fn order_test_2() {
- error_chain! { links { } types { } foreign_links { } errors { } };
-}
-
-#[test]
-fn order_test_3() {
- error_chain! { foreign_links { } links { } errors { } types { } };
-}
-
-#[test]
-fn order_test_4() {
- error_chain! { errors { } types { } foreign_links { } };
-}
-
-#[test]
-fn order_test_5() {
- error_chain! { foreign_links { } types { } };
-}
-
-#[test]
-fn order_test_6() {
- error_chain! {
- links { }
-
- errors {
- HttpStatus(e: u32) {
- description("http request returned an unsuccessful status code")
- display("http request returned an unsuccessful status code: {}", e)
- }
- }
-
-
- foreign_links { }
- };
-}
-
-#[test]
-fn order_test_7() {
- error_chain! {
- links { }
-
- foreign_links { }
-
- types {
- Error, ErrorKind, ResultExt, Result;
- }
- };
-}
-
-
-#[test]
-fn order_test_8() {
- error_chain! {
- links { }
-
- foreign_links { }
- foreign_links { }
-
- types {
- Error, ErrorKind, ResultExt, Result;
- }
- };
-}
-
-#[test]
-fn empty() {
- error_chain!{};
-}
-
-#[test]
-#[cfg(feature = "backtrace")]
-fn has_backtrace_depending_on_env() {
- use std::process::Command;
- use std::path::Path;
-
- let cmd_path = if cfg!(windows) {
- Path::new("./target/debug/has_backtrace.exe")
- } else {
- Path::new("./target/debug/has_backtrace")
- };
- let mut cmd = Command::new(cmd_path);
-
- // missing RUST_BACKTRACE and RUST_BACKTRACE=0
- cmd.env_remove("RUST_BACKTRACE");
- assert_eq!(cmd.status().unwrap().code().unwrap(), 0);
-
- cmd.env("RUST_BACKTRACE", "0");
- assert_eq!(cmd.status().unwrap().code().unwrap(), 0);
-
- // RUST_BACKTRACE set to anything but 0
- cmd.env("RUST_BACKTRACE", "yes");
- assert_eq!(cmd.status().unwrap().code().unwrap(), 1);
-
- cmd.env("RUST_BACKTRACE", "1");
- assert_eq!(cmd.status().unwrap().code().unwrap(), 1);
-}
-
-#[test]
-fn chain_err() {
- use std::fmt;
-
- error_chain! {
- foreign_links {
- Fmt(fmt::Error);
- }
- errors {
- Test
- }
- }
-
- let _: Result<()> = Err(fmt::Error).chain_err(|| "");
- let _: Result<()> = Err(Error::from_kind(ErrorKind::Test)).chain_err(|| "");
-}
-
-/// Verify that an error chain is extended one by `Error::chain_err`, with
-/// the new error added to the end.
-#[test]
-fn error_chain_err() {
- error_chain! {
- errors {
- Test
- }
- }
-
- let base = Error::from(ErrorKind::Test);
- let ext = base.chain_err(|| "Test passes");
-
- if let Error(ErrorKind::Msg(_), _) = ext {
- // pass
- } else {
- panic!("The error should be wrapped. {:?}", ext);
- }
-}
-
-#[test]
-fn links() {
- mod test {
- error_chain!{}
- }
-
- error_chain! {
- links {
- Test(test::Error, test::ErrorKind);
- }
- }
-}
-
-#[cfg(test)]
-mod foreign_link_test {
-
- use std::fmt;
-
- // Note: foreign errors must be `pub` because they appear in the
- // signature of the public foreign_link_error_path
- #[derive(Debug)]
- pub struct ForeignError {
- cause: ForeignErrorCause,
- }
-
- impl ::std::error::Error for ForeignError {
- fn description(&self) -> &'static str {
- "Foreign error description"
- }
-
- fn cause(&self) -> Option<&::std::error::Error> {
- Some(&self.cause)
- }
- }
-
- impl fmt::Display for ForeignError {
- fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- write!(formatter, "Foreign error display")
- }
- }
-
- #[derive(Debug)]
- pub struct ForeignErrorCause {}
-
- impl ::std::error::Error for ForeignErrorCause {
- fn description(&self) -> &'static str {
- "Foreign error cause description"
- }
-
- fn cause(&self) -> Option<&::std::error::Error> {
- None
- }
- }
-
- impl fmt::Display for ForeignErrorCause {
- fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- write!(formatter, "Foreign error cause display")
- }
- }
-
- error_chain! {
- types{
- Error, ErrorKind, ResultExt, Result;
- }
- links {}
- foreign_links {
- Foreign(ForeignError);
- Io(::std::io::Error);
- }
- errors {}
- }
-
- #[test]
- fn display_underlying_error() {
- let chained_error = try_foreign_error().err().unwrap();
- assert_eq!(format!("{}", ForeignError { cause: ForeignErrorCause {} }),
- format!("{}", chained_error));
- }
-
- #[test]
- fn finds_cause() {
- let chained_error = try_foreign_error().err().unwrap();
- assert_eq!(format!("{}", ForeignErrorCause {}),
- format!("{}", ::std::error::Error::cause(&chained_error).unwrap()));
- }
-
- #[test]
- fn iterates() {
- let chained_error = try_foreign_error().err().unwrap();
- let mut error_iter = chained_error.iter();
- assert!(!format!("{:?}", error_iter).is_empty());
- assert_eq!(format!("{}", ForeignError { cause: ForeignErrorCause {} }),
- format!("{}", error_iter.next().unwrap()));
- assert_eq!(format!("{}", ForeignErrorCause {}),
- format!("{}", error_iter.next().unwrap()));
- assert_eq!(format!("{:?}", None as Option<&::std::error::Error>),
- format!("{:?}", error_iter.next()));
- }
-
- fn try_foreign_error() -> Result<()> {
- Err(ForeignError { cause: ForeignErrorCause {} })?;
- Ok(())
- }
-}
-
-#[cfg(test)]
-mod attributes_test {
- #[allow(unused_imports)]
- use std::io;
-
- #[cfg(not(test))]
- mod inner {
- error_chain!{}
- }
-
- error_chain! {
- types {
- Error, ErrorKind, ResultExt, Result;
- }
-
- links {
- Inner(inner::Error, inner::ErrorKind) #[cfg(not(test))];
- }
-
- foreign_links {
- Io(io::Error) #[cfg(not(test))];
- }
-
- errors {
- #[cfg(not(test))]
- AnError {
-
- }
- }
- }
-}
-
-#[test]
-fn with_result() {
- error_chain! {
- types {
- Error, ErrorKind, ResultExt, Result;
- }
- }
- let _: Result<()> = Ok(());
-}
-
-#[test]
-fn without_result() {
- error_chain! {
- types {
- Error, ErrorKind, ResultExt;
- }
- }
- let _: Result<(), ()> = Ok(());
-}
-
-#[test]
-fn documentation() {
- mod inner {
- error_chain!{}
- }
-
- error_chain! {
- links {
- Inner(inner::Error, inner::ErrorKind) #[doc = "Doc"];
- }
- foreign_links {
- Io(::std::io::Error) #[doc = "Doc"];
- }
- errors {
- /// Doc
- Variant
- }
- }
-}
-
-#[cfg(test)]
-mod multiple_error_same_mod {
- error_chain! {
- types {
- MyError, MyErrorKind, MyResultExt, MyResult;
- }
- }
- error_chain!{}
-}
-
-#[doc(test)]
-#[deny(dead_code)]
-mod allow_dead_code {
- error_chain!{}
-}
-
-// Make sure links actually work!
-#[test]
-fn rustup_regression() {
- error_chain! {
- links {
- Download(error_chain::mock::Error, error_chain::mock::ErrorKind);
- }
-
- foreign_links { }
-
- errors {
- LocatingWorkingDir {
- description("could not locate working directory")
- }
- }
- }
-}
-
-#[test]
-fn error_patterns() {
- error_chain! {
- links { }
-
- foreign_links { }
-
- errors { }
- }
-
- // Tuples look nice when matching errors
- match Error::from("Test") {
- Error(ErrorKind::Msg(_), _) => {},
- _ => {},
- }
-}
-
-#[test]
-fn error_first() {
- error_chain! {
- errors {
- LocatingWorkingDir {
- description("could not locate working directory")
- }
- }
-
- links {
- Download(error_chain::mock::Error, error_chain::mock::ErrorKind);
- }
-
- foreign_links { }
- }
-}
-
-#[test]
-fn bail() {
- error_chain! {
- errors { Foo }
- }
-
- fn foo() -> Result<()> {
- bail!(ErrorKind::Foo)
- }
-
- fn bar() -> Result<()> {
- bail!("bar")
- }
-
- fn baz() -> Result<()> {
- bail!("{}", "baz")
- }
-}
-
-#[test]
-fn ensure() {
- error_chain! {
- errors { Bar }
- }
-
- fn foo(x: u8) -> Result<()> {
- ensure!(x == 42, ErrorKind::Bar);
- Ok(())
- }
-
- assert!(foo(42).is_ok());
- assert!(foo(0).is_err());
-}
-
-/// Since the `types` declaration is a list of symbols, check if we
-/// don't change their meaning or order.
-#[test]
-fn types_declarations() {
- error_chain! {
- types {
- MyError, MyErrorKind, MyResultExt, MyResult;
- }
- }
-
- MyError::from_kind(MyErrorKind::Msg("".into()));
-
- let err: Result<(), ::std::io::Error> = Ok(());
- MyResultExt::chain_err(err, || "").unwrap();
-
- let _: MyResult<()> = Ok(());
-}
-
-#[test]
-/// Calling chain_err over a `Result` containing an error to get a chained error
-/// and constructing a MyError directly, passing it an error should be equivalent.
-fn rewrapping() {
-
- use std::env::VarError::{self, NotPresent, NotUnicode};
-
- error_chain! {
- foreign_links {
- VarErr(VarError);
- }
-
- types {
- MyError, MyErrorKind, MyResultExt, MyResult;
- }
- }
-
- let result_a_from_func: Result<String, _> = Err(VarError::NotPresent);
- let result_b_from_func: Result<String, _> = Err(VarError::NotPresent);
-
- let our_error_a = result_a_from_func.map_err(|e| match e {
- NotPresent => MyError::with_chain(e, "env var wasn't provided"),
- NotUnicode(_) => MyError::with_chain(e, "env var was borkæ–‡å—化ã"),
- });
-
- let our_error_b = result_b_from_func.or_else(|e| match e {
- NotPresent => Err(e).chain_err(|| "env var wasn't provided"),
- NotUnicode(_) => Err(e).chain_err(|| "env var was borkæ–‡å—化ã"),
- });
-
- assert_eq!(format!("{}", our_error_a.unwrap_err()),
- format!("{}", our_error_b.unwrap_err()));
-
-}
-
-#[test]
-fn comma_in_errors_impl() {
- error_chain! {
- links { }
-
- foreign_links { }
-
- errors {
- HttpStatus(e: u32) {
- description("http request returned an unsuccessful status code"),
- display("http request returned an unsuccessful status code: {}", e)
- }
- }
- };
-}
-
-
-#[test]
-fn trailing_comma_in_errors_impl() {
- error_chain! {
- links { }
-
- foreign_links { }
-
- errors {
- HttpStatus(e: u32) {
- description("http request returned an unsuccessful status code"),
- display("http request returned an unsuccessful status code: {}", e),
- }
- }
- };
-}
diff --git a/vendor/syslog-4.0.1/.cargo-checksum.json b/vendor/syslog-4.0.1/.cargo-checksum.json
deleted file mode 100644
index effa060..0000000
--- a/vendor/syslog-4.0.1/.cargo-checksum.json
+++ /dev/null
@@ -1 +0,0 @@
-{"files":{"Cargo.toml":"d5793892c208d4108a7f895fd92823ccbb6e44de4eac458aa7a2bd2baa445cf4","LICENSE":"3aba98cfa51c381f5652e3c235e6d339102f30fb565145437c23f76a00e0af6d","README.md":"0d131dc0b3064caee696243463b3dd50ba2445ef4b6a12bd19c18182d2befac7","examples/write.rs":"a12e33c358723ec5ade338a5131a1f6828e42c2c1c43154dec4e95b3ceeb82d3","src/errors.rs":"b6cb9f5b47c0701f166ad9be8bb6b32f5f605cc5f75ca177f30f4890be27afba","src/facility.rs":"b474882541a246613e19f160bc92097fbd3966f8b956987d22f730848a0b9ea3","src/format.rs":"45a3520c7b9967ea834d29ed54543ac630795a8ab0f582edbd626179b492d471","src/lib.rs":"8db8e66c6702bd0f603e97bb07082108b5dd2c55d84615b94cc13bb927d3733b"},"package":"a0641142b4081d3d44beffa4eefd7346a228cdf91ed70186db2ca2cef762d327"}
\ No newline at end of file
diff --git a/vendor/syslog-4.0.1/Cargo.toml b/vendor/syslog-4.0.1/Cargo.toml
deleted file mode 100644
index 263cc6c..0000000
--- a/vendor/syslog-4.0.1/Cargo.toml
+++ /dev/null
@@ -1,36 +0,0 @@
-# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
-#
-# When uploading crates to the registry Cargo will automatically
-# "normalize" Cargo.toml files for maximal compatibility
-# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g. crates.io) dependencies
-#
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
-
-[package]
-name = "syslog"
-version = "4.0.1"
-authors = ["contact@geoffroycouprie.com"]
-description = "Send log messages to syslog"
-documentation = "https://docs.rs/syslog"
-keywords = ["syslog", "logs", "logging"]
-license = "MIT"
-repository = "https://github.com/Geal/rust-syslog"
-[dependencies.error-chain]
-version = "^0.11.0"
-
-[dependencies.libc]
-version = "^0.2"
-
-[dependencies.log]
-version = "^0.4.1"
-features = ["std"]
-
-[dependencies.time]
-version = "^0.1"
-
-[features]
-nightly = []
diff --git a/vendor/syslog-4.0.1/LICENSE b/vendor/syslog-4.0.1/LICENSE
deleted file mode 100644
index 22c486f..0000000
--- a/vendor/syslog-4.0.1/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2014-2018 Geoffroy Couprie
-
-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/vendor/syslog-4.0.1/README.md b/vendor/syslog-4.0.1/README.md
deleted file mode 100644
index 8594f75..0000000
--- a/vendor/syslog-4.0.1/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# Sending to Syslog in Rust
-
-[](https://travis-ci.org/Geal/rust-syslog)
-[](https://coveralls.io/github/Geal/rust-syslog?branch=master)
-
-A small library to write to local syslog.
-
-## Installation
-
-syslog is available on [crates.io](https://crates.io/crates/syslog) and can be included in your Cargo enabled project like this:
-
-```toml
-[dependencies]
-syslog = "^4.0"
-```
-
-## documentation
-
-Reference documentation is available [here](https://docs.rs/syslog).
-
-## Example
-
-```rust
-extern crate syslog;
-
-use syslog::{Facility, Formatter3164};
-
-fn main() {
- let formatter = Formatter3164 {
- facility: Facility::LOG_USER,
- hostname: None,
- process: "myprogram".into(),
- pid: 42,
- };
-
- match syslog::unix(formatter) {
- Err(e) => println!("impossible to connect to syslog: {:?}", e),
- Ok(mut writer) => {
- writer.err("hello world").expect("could not write error message");
- }
- }
-}
-```
-
-The struct `syslog::Logger` implements `Log` from the `log` crate, so it can be used as backend for other logging systems.
-
-There are 3 functions to create loggers:
-
-* the `unix` function sends to the local syslog through a Unix socket: `syslog::unix(formatter)`
-* the `tcp` function takes an address for a remote TCP syslog server: `tcp(formatter, "127.0.0.1:4242")`
-* the `udp` function takes an address for a local port, and the address remote UDP syslog server: `udp(formatter, "127.0.0.1:1234", "127.0.0.1:4242")`
diff --git a/vendor/syslog-4.0.1/examples/write.rs b/vendor/syslog-4.0.1/examples/write.rs
deleted file mode 100644
index 46a0ea8..0000000
--- a/vendor/syslog-4.0.1/examples/write.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-extern crate syslog;
-
-use syslog::{Facility, Formatter3164};
-
-fn main() {
- let formatter = Formatter3164 {
- facility: Facility::LOG_USER,
- hostname: None,
- process: "myprogram".into(),
- pid: 0,
- };
-
- match syslog::unix(formatter) {
- Err(e) => println!("impossible to connect to syslog: {:?}", e),
- Ok(mut writer) => {
- writer.err("hello world").expect("could not write error message");
- }
- }
-}
diff --git a/vendor/syslog-4.0.1/src/errors.rs b/vendor/syslog-4.0.1/src/errors.rs
deleted file mode 100644
index 92aef28..0000000
--- a/vendor/syslog-4.0.1/src/errors.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-error_chain! {
- errors { Initialization Format Write }
-
- foreign_links {
- Io(::std::io::Error) #[doc = "Link to a `std::error::Error` type."];
- }
-}
diff --git a/vendor/syslog-4.0.1/src/facility.rs b/vendor/syslog-4.0.1/src/facility.rs
deleted file mode 100644
index 5967de7..0000000
--- a/vendor/syslog-4.0.1/src/facility.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-use std::str::FromStr;
-
-#[allow(non_camel_case_types)]
-#[derive(Copy,Clone,Debug)]
-pub enum Facility {
- LOG_KERN = 0 << 3,
- LOG_USER = 1 << 3,
- LOG_MAIL = 2 << 3,
- LOG_DAEMON = 3 << 3,
- LOG_AUTH = 4 << 3,
- LOG_SYSLOG = 5 << 3,
- LOG_LPR = 6 << 3,
- LOG_NEWS = 7 << 3,
- LOG_UUCP = 8 << 3,
- LOG_CRON = 9 << 3,
- LOG_AUTHPRIV = 10 << 3,
- LOG_FTP = 11 << 3,
- LOG_LOCAL0 = 16 << 3,
- LOG_LOCAL1 = 17 << 3,
- LOG_LOCAL2 = 18 << 3,
- LOG_LOCAL3 = 19 << 3,
- LOG_LOCAL4 = 20 << 3,
- LOG_LOCAL5 = 21 << 3,
- LOG_LOCAL6 = 22 << 3,
- LOG_LOCAL7 = 23 << 3
-}
-
-impl FromStr for Facility {
- type Err = ();
- fn from_str(s: &str) -> Result<Facility, ()> {
- let result = match &s.to_lowercase()[..] {
- "log_kern" | "kern" => Facility::LOG_KERN,
- "log_user" | "user" => Facility::LOG_USER,
- "log_mail" | "mail" => Facility::LOG_MAIL,
- "log_daemon" | "daemon" => Facility::LOG_DAEMON,
- "log_auth" | "auth" => Facility::LOG_AUTH,
- "log_syslog" | "syslog" => Facility::LOG_SYSLOG,
- "log_lpr" | "lpr" => Facility::LOG_LPR,
- "log_news" | "news" => Facility::LOG_NEWS,
- "log_uucp" | "uucp" => Facility::LOG_UUCP,
- "log_cron" | "cron" => Facility::LOG_CRON,
- "log_authpriv"| "authpriv" => Facility::LOG_AUTHPRIV,
- "log_ftp" | "ftp" => Facility::LOG_FTP,
- "log_local0" | "local0" => Facility::LOG_LOCAL0,
- "log_local1" | "local1" => Facility::LOG_LOCAL1,
- "log_local2" | "local2" => Facility::LOG_LOCAL2,
- "log_local3" | "local3" => Facility::LOG_LOCAL3,
- "log_local4" | "local4" => Facility::LOG_LOCAL4,
- "log_local5" | "local5" => Facility::LOG_LOCAL5,
- "log_local6" | "local6" => Facility::LOG_LOCAL6,
- "log_local7" | "local7" => Facility::LOG_LOCAL7,
- _ => return Err(())
- };
- Ok(result)
- }
-}
diff --git a/vendor/syslog-4.0.1/src/format.rs b/vendor/syslog-4.0.1/src/format.rs
deleted file mode 100644
index 9c304d3..0000000
--- a/vendor/syslog-4.0.1/src/format.rs
+++ /dev/null
@@ -1,129 +0,0 @@
-use time;
-use std::io::Write;
-use std::fmt::Display;
-use std::collections::HashMap;
-
-use Priority;
-use errors::*;
-use facility::Facility;
-
-#[allow(non_camel_case_types)]
-#[derive(Copy,Clone)]
-pub enum Severity {
- LOG_EMERG,
- LOG_ALERT,
- LOG_CRIT,
- LOG_ERR,
- LOG_WARNING,
- LOG_NOTICE,
- LOG_INFO,
- LOG_DEBUG
-}
-
-pub trait LogFormat<T> {
- fn format<W: Write>(&self, w: &mut W, severity: Severity, message: T) -> Result<()>;
-
- fn emerg<W: Write>(&mut self, w: &mut W, message: T) -> Result<()> {
- self.format(w, Severity::LOG_EMERG, message)
- }
-
- fn alert<W: Write>(&mut self, w: &mut W, message: T) -> Result<()> {
- self.format(w, Severity::LOG_ALERT, message)
- }
-
- fn crit<W: Write>(&mut self, w: &mut W, message: T) -> Result<()> {
- self.format(w, Severity::LOG_CRIT, message)
- }
-
- fn err<W: Write>(&mut self, w: &mut W, message: T) -> Result<()> {
- self.format(w, Severity::LOG_ERR, message)
- }
-
- fn warning<W: Write>(&mut self, w: &mut W, message: T) -> Result<()> {
- self.format(w, Severity::LOG_WARNING, message)
- }
-
- fn notice<W: Write>(&mut self, w: &mut W, message: T) -> Result<()> {
- self.format(w, Severity::LOG_NOTICE, message)
- }
-
- fn info<W: Write>(&mut self, w: &mut W, message: T) -> Result<()> {
- self.format(w, Severity::LOG_INFO, message)
- }
-
- fn debug<W: Write>(&mut self, w: &mut W, message: T) -> Result<()> {
- self.format(w, Severity::LOG_DEBUG, message)
- }
-}
-
-#[derive(Clone,Debug)]
-pub struct Formatter3164 {
- pub facility: Facility,
- pub hostname: Option<String>,
- pub process: String,
- pub pid: i32,
-}
-
-impl<T: Display> LogFormat<T> for Formatter3164 {
- fn format<W: Write>(&self, w: &mut W, severity: Severity, message: T) -> Result<()> {
- if let Some(ref hostname) = self.hostname {
- write!(w, "<{}>{} {} {}[{}]: {}",
- encode_priority(severity, self.facility),
- time::now().strftime("%b %d %T").unwrap(),
- hostname, self.process, self.pid, message).chain_err(|| ErrorKind::Format)
- } else {
- write!(w, "<{}>{} {}[{}]: {}",
- encode_priority(severity, self.facility),
- time::now().strftime("%b %d %T").unwrap(),
- self.process, self.pid, message).chain_err(|| ErrorKind::Format)
- }
- }
-}
-
-/// RFC 5424 structured data
-pub type StructuredData = HashMap<String, HashMap<String, String>>;
-
-#[derive(Clone,Debug)]
-pub struct Formatter5424 {
- pub facility: Facility,
- pub hostname: Option<String>,
- pub process: String,
- pub pid: i32,
-}
-
-impl Formatter5424 {
- pub fn format_5424_structured_data(&self, data: StructuredData) -> String {
- if data.is_empty() {
- "-".to_string()
- } else {
- let mut res = String::new();
- for (id, params) in &data {
- res = res + "["+id;
- for (name,value) in params {
- res = res + " " + name + "=\"" + value + "\"";
- }
- res += "]";
- }
-
- res
- }
- }
-}
-
-impl<T: Display> LogFormat<(i32, StructuredData, T)> for Formatter5424 {
- fn format<W: Write>(&self, w: &mut W, severity: Severity, log_message: (i32, StructuredData, T)) -> Result<()> {
- let (message_id, data, message) = log_message;
-
- write!(w, "<{}> {} {} {} {} {} {} {} {}",
- encode_priority(severity, self.facility),
- 1, // version
- time::now_utc().rfc3339(),
- self.hostname.as_ref().map(|x| &x[..]).unwrap_or("localhost"),
- self.process, self.pid, message_id,
- self.format_5424_structured_data(data), message).chain_err(|| ErrorKind::Format)
- }
-}
-
-fn encode_priority(severity: Severity, facility: Facility) -> Priority {
- facility as u8 | severity as u8
-}
diff --git a/vendor/syslog-4.0.1/src/lib.rs b/vendor/syslog-4.0.1/src/lib.rs
deleted file mode 100644
index e48591d..0000000
--- a/vendor/syslog-4.0.1/src/lib.rs
+++ /dev/null
@@ -1,402 +0,0 @@
-//! Syslog
-//!
-//! This crate provides facilities to send log messages via syslog.
-//! It supports Unix sockets for local syslog, UDP and TCP for remote servers.
-//!
-//! Messages can be passed directly without modification, or in RFC 3164 or RFC 5424 format
-//!
-//! The code is available on [Github](https://github.com/Geal/rust-syslog)
-//!
-//! # Example
-//!
-//! ```
-//! extern crate syslog;
-//!
-//! use syslog::{Facility, Formatter3164};
-//!
-//! fn main() {
-//! let formatter = Formatter3164 {
-//! facility: Facility::LOG_USER,
-//! hostname: None,
-//! process: "myprogram".into(),
-//! pid: 0,
-//! };
-//!
-//! match syslog::unix(formatter) {
-//! Err(e) => println!("impossible to connect to syslog: {:?}", e),
-//! Ok(mut writer) => {
-//! writer.err("hello world").expect("could not write error message");
-//! }
-//! }
-//! }
-//! ```
-#![crate_type = "lib"]
-
-#[macro_use] extern crate error_chain;
-extern crate libc;
-extern crate time;
-extern crate log;
-
-use std::env;
-use std::path::Path;
-use std::fmt::{self,Arguments,Display};
-use std::io::{self, BufWriter, Write};
-use std::sync::{Arc,Mutex};
-use std::marker::PhantomData;
-use std::net::{SocketAddr,ToSocketAddrs,UdpSocket,TcpStream};
-use std::os::unix::net::{UnixDatagram, UnixStream};
-
-use libc::getpid;
-use log::{Log, Metadata, Record, Level};
-
-mod facility;
-mod format;
-mod errors;
-pub use facility::Facility;
-pub use format::Severity;
-pub use errors::*;
-
-use format::{LogFormat};
-pub use format::{Formatter3164, Formatter5424};
-
-pub type Priority = u8;
-
-/// Main logging structure
-pub struct Logger<Backend: Write, T, Formatter: LogFormat<T>> {
- formatter: Formatter,
- backend: Backend,
- phantom: PhantomData<T>,
-}
-
-impl<W:Write, T, F:LogFormat<T>> Logger<W, T, F> {
- pub fn emerg(&mut self, message: T) -> Result<()> {
- self.formatter.emerg(&mut self.backend, message)
- }
-
- pub fn alert(&mut self, message: T) -> Result<()> {
- self.formatter.alert(&mut self.backend, message)
- }
-
- pub fn crit(&mut self, message: T) -> Result<()> {
- self.formatter.crit(&mut self.backend, message)
- }
-
- pub fn err(&mut self, message: T) -> Result<()> {
- self.formatter.err(&mut self.backend, message)
- }
-
- pub fn warning(&mut self, message: T) -> Result<()> {
- self.formatter.warning(&mut self.backend, message)
- }
-
- pub fn notice(&mut self, message: T) -> Result<()> {
- self.formatter.notice(&mut self.backend, message)
- }
-
- pub fn info(&mut self, message: T) -> Result<()> {
- self.formatter.info(&mut self.backend, message)
- }
-
- pub fn debug(&mut self, message: T) -> Result<()> {
- self.formatter.debug(&mut self.backend, message)
- }
-}
-
-pub enum LoggerBackend {
- /// Unix socket, temp file path, log file path
- Unix(UnixDatagram),
- UnixStream(BufWriter<UnixStream>),
- Udp(UdpSocket, SocketAddr),
- Tcp(BufWriter<TcpStream>)
-}
-
-impl Write for LoggerBackend {
- /// Sends a message directly, without any formatting
- fn write(&mut self, message: &[u8]) -> io::Result<usize> {
- match *self {
- LoggerBackend::Unix(ref dgram) => {
- dgram.send(&message[..])
- },
- LoggerBackend::UnixStream(ref mut socket) => {
- let null = [0 ; 1];
- socket.write(&message[..]).and_then(|sz| {
- socket.write(&null).map(|_| sz)
- })
- },
- LoggerBackend::Udp(ref socket, ref addr) => {
- socket.send_to(&message[..], addr)
- },
- LoggerBackend::Tcp(ref mut socket) => {
- socket.write(&message[..])
- }
- }
- }
-
- fn write_fmt(&mut self, args: Arguments) -> io::Result<()> {
- match *self {
- LoggerBackend::Unix(ref dgram) => {
- let message = fmt::format(args);
- dgram.send(message.as_bytes()).map(|_| ())
- },
- LoggerBackend::UnixStream(ref mut socket) => {
- let null = [0 ; 1];
- socket.write_fmt(args).and_then(|_| {
- socket.write(&null).map(|_| ())
- })
- },
- LoggerBackend::Udp(ref socket, ref addr) => {
- let message = fmt::format(args);
- socket.send_to(message.as_bytes(), addr).map(|_| ())
- },
- LoggerBackend::Tcp(ref mut socket) => {
- socket.write_fmt(args)
- }
- }
- }
-
- fn flush(&mut self) -> io::Result<()> {
- match *self {
- LoggerBackend::Unix(_) => {
- Ok(())
- },
- LoggerBackend::UnixStream(ref mut socket) => {
- socket.flush()
- },
- LoggerBackend::Udp(_, _) => {
- Ok(())
- },
- LoggerBackend::Tcp(ref mut socket) => {
- socket.flush()
- }
- }
- }
-}
-
-/// Returns a Logger using unix socket to target local syslog ( using /dev/log or /var/run/syslog)
-pub fn unix<U: Display, F: Clone+LogFormat<U>>(formatter: F) -> Result<Logger<LoggerBackend, U, F>> {
- unix_connect(formatter.clone(), "/dev/log").or_else(|e| {
- if let ErrorKind::Io(ref io_err) = *e.kind() {
- if io_err.kind() == io::ErrorKind::NotFound {
- return unix_connect(formatter, "/var/run/syslog");
- }
- }
- Err(e)
- }).chain_err(|| ErrorKind::Initialization)
-}
-
-/// Returns a Logger using unix socket to target local syslog at user provided path
-pub fn unix_custom<P: AsRef<Path>, U: Display, F: LogFormat<U>>(formatter: F, path: P) -> Result<Logger<LoggerBackend, U, F>> {
- unix_connect(formatter, path).chain_err(|| ErrorKind::Initialization)
-}
-
-fn unix_connect<P: AsRef<Path>, U: Display, F: LogFormat<U>>(formatter: F, path: P) -> Result<Logger<LoggerBackend, U, F>> {
- let sock = UnixDatagram::unbound()?;
- match sock.connect(&path) {
- Ok(()) => {
- Ok(Logger {
- formatter,
- backend: LoggerBackend::Unix(sock),
- phantom: PhantomData,
- })
- },
- Err(ref e) if e.raw_os_error() == Some(libc::EPROTOTYPE) => {
- let sock = UnixStream::connect(path)?;
- Ok(Logger {
- formatter,
- backend: LoggerBackend::UnixStream(BufWriter::new(sock)),
- phantom: PhantomData,
- })
- },
- Err(e) => Err(e.into()),
- }
-}
-
-/// returns a UDP logger connecting `local` and `server`
-pub fn udp<T: ToSocketAddrs, U: Display, F: LogFormat<U>>(formatter: F, local: T, server: T) -> Result<Logger<LoggerBackend, U, F>> {
- server.to_socket_addrs().chain_err(|| ErrorKind::Initialization).and_then(|mut server_addr_opt| {
- server_addr_opt.next().chain_err(|| ErrorKind::Initialization)
- }).and_then(|server_addr| {
- UdpSocket::bind(local).chain_err(|| ErrorKind::Initialization).and_then(|socket| {
- Ok(Logger {
- formatter,
- backend: LoggerBackend::Udp(socket, server_addr),
- phantom: PhantomData,
- })
- })
- })
-}
-
-/// returns a TCP logger connecting `local` and `server`
-pub fn tcp<T: ToSocketAddrs, U: Display, F: LogFormat<U>>(formatter: F, server: T) -> Result<Logger<LoggerBackend, U, F>> {
- TcpStream::connect(server).chain_err(|| ErrorKind::Initialization).and_then(|socket| {
- Ok(Logger {
- formatter,
- backend: LoggerBackend::Tcp(BufWriter::new(socket)),
- phantom: PhantomData,
- })
- })
-}
-
-pub struct BasicLogger {
- logger: Arc<Mutex<Logger<LoggerBackend, String, Formatter3164>>>,
-}
-
-impl BasicLogger {
- pub fn new(logger: Logger<LoggerBackend, String, Formatter3164>) -> BasicLogger {
- BasicLogger {
- logger: Arc::new(Mutex::new(logger)),
- }
- }
-}
-
-#[allow(unused_variables,unused_must_use)]
-impl Log for BasicLogger {
- fn enabled(&self, metadata: &Metadata) -> bool {
- true
- }
-
- fn log(&self, record: &Record) {
- //FIXME: temporary patch to compile
- let message = format!("{}", record.args());
- let mut logger = self.logger.lock().unwrap();
- match record.level() {
- Level::Error => logger.err(message),
- Level::Warn => logger.warning(message),
- Level::Info => logger.info(message),
- Level::Debug => logger.debug(message),
- Level::Trace => logger.debug(message)
- };
- }
-
- fn flush(&self) {
- let _ = self.logger.lock().unwrap().backend.flush();
- }
-}
-
-/// Unix socket Logger init function compatible with log crate
-pub fn init_unix(facility: Facility, log_level: log::LevelFilter) -> Result<()> {
- let (process, pid) = get_process_info()?;
- let formatter = Formatter3164 {
- facility,
- hostname: None,
- process,
- pid,
- };
- unix(formatter).and_then(|logger| {
- log::set_boxed_logger(Box::new(BasicLogger::new(logger))
- ).chain_err(|| ErrorKind::Initialization)
- })?;
-
- log::set_max_level(log_level);
- Ok(())
-}
-
-/// Unix socket Logger init function compatible with log crate and user provided socket path
-pub fn init_unix_custom<P: AsRef<Path>>(facility: Facility, log_level: log::LevelFilter, path: P) -> Result<()> {
- let (process, pid) = get_process_info()?;
- let formatter = Formatter3164 {
- facility,
- hostname: None,
- process,
- pid,
- };
- unix_custom(formatter, path).and_then(|logger| {
- log::set_boxed_logger(Box::new(BasicLogger::new(logger)))
- .chain_err(|| ErrorKind::Initialization)
- })?;
-
- log::set_max_level(log_level);
- Ok(())
-}
-
-/// UDP Logger init function compatible with log crate
-pub fn init_udp<T: ToSocketAddrs>(local: T, server: T, hostname:String, facility: Facility, log_level: log::LevelFilter) -> Result<()> {
- let (process, pid) = get_process_info()?;
- let formatter = Formatter3164 {
- facility,
- hostname: Some(hostname),
- process,
- pid,
- };
- udp(formatter, local, server).and_then(|logger| {
- log::set_boxed_logger(Box::new(BasicLogger::new(logger))).chain_err(|| ErrorKind::Initialization)
- })?;
-
- log::set_max_level(log_level);
- Ok(())
-}
-
-/// TCP Logger init function compatible with log crate
-pub fn init_tcp<T: ToSocketAddrs>(server: T, hostname: String, facility: Facility, log_level: log::LevelFilter) -> Result<()> {
- let (process, pid) = get_process_info()?;
- let formatter = Formatter3164 {
- facility,
- hostname: Some(hostname),
- process,
- pid,
- };
-
- tcp(formatter, server).and_then(|logger| {
- log::set_boxed_logger(Box::new(BasicLogger::new(logger))).chain_err(|| ErrorKind::Initialization)
- })?;
-
- log::set_max_level(log_level);
- Ok(())
-}
-
-/// Initializes logging subsystem for log crate
-///
-/// This tries to connect to syslog by following ways:
-///
-/// 1. Unix sockets /dev/log and /var/run/syslog (in this order)
-/// 2. Tcp connection to 127.0.0.1:601
-/// 3. Udp connection to 127.0.0.1:514
-///
-/// Note the last option usually (almost) never fails in this method. So
-/// this method doesn't return error even if there is no syslog.
-///
-/// If `application_name` is `None` name is derived from executable name
-pub fn init(facility: Facility, log_level: log::LevelFilter,
- application_name: Option<&str>)
- -> Result<()>
-{
- let (process_name, pid) = get_process_info()?;
- let process = application_name.map(From::from).unwrap_or(process_name);
- let formatter = Formatter3164 {
- facility,
- hostname: None,
- process,
- pid,
- };
-
- let backend = unix(formatter.clone()).map(|logger: Logger<LoggerBackend, String, Formatter3164>| logger.backend)
- .or_else(|_| {
- TcpStream::connect(("127.0.0.1", 601))
- .map(|s| LoggerBackend::Tcp(BufWriter::new(s)))
- })
- .or_else(|_| {
- let udp_addr = "127.0.0.1:514".parse().unwrap();
- UdpSocket::bind(("127.0.0.1", 0))
- .map(|s| LoggerBackend::Udp(s, udp_addr))
- })?;
- log::set_boxed_logger( Box::new(BasicLogger::new(Logger {
- formatter,
- backend,
- phantom: PhantomData,
- }))
- ).chain_err(|| ErrorKind::Initialization)?;
-
- log::set_max_level(log_level);
- Ok(())
-}
-
-fn get_process_info() -> Result<(String,i32)> {
- env::current_exe().chain_err(|| ErrorKind::Initialization).and_then(|path| {
- path.file_name().and_then(|os_name| os_name.to_str()).map(|name| name.to_string())
- .chain_err(|| ErrorKind::Initialization)
- }).map(|name| {
- let pid = unsafe { getpid() };
- (name, pid)
- })
-}
-