headers-core-0.3.0/.cargo_vcs_info.json0000644000000001520000000000100133730ustar { "git": { "sha1": "b8cf384cc40c75a659240ea7d07898e65db72d4e" }, "path_in_vcs": "headers-core" }headers-core-0.3.0/Cargo.toml0000644000000015120000000000100113720ustar # 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 are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] name = "headers-core" version = "0.3.0" authors = ["Sean McArthur "] description = "typed HTTP headers core trait" homepage = "https://hyper.rs" readme = "README.md" keywords = [ "http", "headers", "hyper", "hyperium", ] license = "MIT" repository = "https://github.com/hyperium/headers" [dependencies.http] version = "1.0.0" headers-core-0.3.0/Cargo.toml.orig000064400000000000000000000006031046102023000150530ustar 00000000000000[package] name = "headers-core" version = "0.3.0" # don't forget to update html_root_url description = "typed HTTP headers core trait" license = "MIT" readme = "README.md" homepage = "https://hyper.rs" repository = "https://github.com/hyperium/headers" authors = ["Sean McArthur "] keywords = ["http", "headers", "hyper", "hyperium"] [dependencies] http = "1.0.0" headers-core-0.3.0/LICENSE000064400000000000000000000020471046102023000131750ustar 00000000000000Copyright (c) 2014-2023 Sean McArthur 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. headers-core-0.3.0/README.md000064400000000000000000000000571046102023000134460ustar 00000000000000# Typed HTTP Headers: core `Header` trait WIP headers-core-0.3.0/src/lib.rs000064400000000000000000000033271046102023000140750ustar 00000000000000#![deny(missing_docs)] #![deny(missing_debug_implementations)] #![cfg_attr(test, deny(warnings))] #![doc(html_root_url = "https://docs.rs/headers-core/0.3.0")] //! # headers-core //! //! This is the core crate of the typed HTTP headers system, providing only //! the relevant traits. All actual header implementations are in other crates. extern crate http; pub use http::header::{self, HeaderName, HeaderValue}; use std::error; use std::fmt::{self, Display, Formatter}; /// A trait for any object that will represent a header field and value. /// /// This trait represents the construction and identification of headers, /// and contains trait-object unsafe methods. pub trait Header { /// The name of this header. fn name() -> &'static HeaderName; /// Decode this type from an iterator of `HeaderValue`s. fn decode<'i, I>(values: &mut I) -> Result where Self: Sized, I: Iterator; /// Encode this type to a `HeaderMap`. /// /// This function should be infallible. Any errors converting to a /// `HeaderValue` should have been caught when parsing or constructing /// this value. fn encode>(&self, values: &mut E); } /// Errors trying to decode a header. #[derive(Debug)] pub struct Error { kind: Kind, } #[derive(Debug)] enum Kind { Invalid, } impl Error { /// Create an 'invalid' Error. pub fn invalid() -> Error { Error { kind: Kind::Invalid, } } } impl Display for Error { fn fmt(&self, f: &mut Formatter) -> fmt::Result { match &self.kind { Kind::Invalid => f.write_str("invalid HTTP header"), } } } impl error::Error for Error {}