Rebrand as kochab
I spent /so/ long looking for that figlet font. __ __ __ / /______ _____/ /_ ____ _/ /_ / //_/ __ \/ ___/ __ \/ __ `/ __ \ / ,< / /_/ / /__/ / / / /_/ / /_/ / /_/|_|\____/\___/_/ /_/\__,_/_.___/
This commit is contained in:
parent
16721a7321
commit
b69aba139f
41
CHANGELOG.md
41
CHANGELOG.md
|
@ -4,43 +4,4 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
As of yet no versions have been released
|
||||||
### Added
|
|
||||||
- `document` API for creating Gemini documents
|
|
||||||
- preliminary timeout API, incl a special case for complex MIMEs by [@Alch-Emi]
|
|
||||||
- `Response::success_*` variants by [@Alch-Emi]
|
|
||||||
- `redirect_temporary_lossy` for `Response` and `ResponseHeader`
|
|
||||||
- `bad_request_lossy` for `Response` and `ResponseHeader`
|
|
||||||
- support for a lot more mime-types in `guess_mime_from_path`, backed by the `mime_guess` crate
|
|
||||||
- customizable TLS cert & key paths by [@Alch-Emi]
|
|
||||||
- `server_dir` default feature for serve_dir utils [@Alch-Emi]
|
|
||||||
- Docments can be converted into responses with std::convert::Into [@Alch-Emi]
|
|
||||||
- Added ratelimiting API [@Alch-Emi]
|
|
||||||
### Improved
|
|
||||||
- build time and size by [@Alch-Emi]
|
|
||||||
- Improved error handling in serve_dir [@Alch-Emi]
|
|
||||||
### Changed
|
|
||||||
- Added route API [@Alch-Emi](https://github.com/Alch-Emi)
|
|
||||||
- API for adding handlers now accepts async handlers [@Alch-Emi](https://github.com/Alch-Emi)
|
|
||||||
- `Response::success` now takes a request body [@Alch-Emi]
|
|
||||||
|
|
||||||
## [0.3.0] - 2020-11-14
|
|
||||||
### Added
|
|
||||||
- `GEMINI_MIME_STR`, the `&str` representation of the Gemini MIME
|
|
||||||
- `Meta::new_lossy`, constructor that never fails
|
|
||||||
- `Meta::MAX_LEN`, which is `1024`
|
|
||||||
- "lossy" constructors for `Response` and `Status` (see `Meta::new_lossy`)
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- `Meta::new` now rejects strings exceeding `Meta::MAX_LEN` (`1024`)
|
|
||||||
- Some `Response` and `Status` constructors are now infallible
|
|
||||||
- Improve error messages
|
|
||||||
|
|
||||||
### Deprecated
|
|
||||||
- Instead of `gemini_mime()` use `GEMINI_MIME`
|
|
||||||
|
|
||||||
## [0.2.0] - 2020-11-14
|
|
||||||
### Added
|
|
||||||
- Access to client certificates by [@Alch-Emi]
|
|
||||||
|
|
||||||
[@Alch-Emi]: https://github.com/Alch-Emi
|
|
||||||
|
|
11
Cargo.toml
11
Cargo.toml
|
@ -1,12 +1,11 @@
|
||||||
[package]
|
[package]
|
||||||
name = "northstar"
|
name = "kochab"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
authors = ["panicbit <panicbit.dev@gmail.com>"]
|
authors = ["Emii Tatsuo <emi@alchemi.dev>", "panicbit <panicbit.dev@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "Hippocratic 2.1"
|
||||||
description = "Gemini server implementation"
|
description = "Ergonomic Gemini SDK"
|
||||||
repository = "https://github.com/panicbit/northstar"
|
repository = "https://github.com/Alch-Emi/kochab"
|
||||||
documentation = "https://docs.rs/northstar"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
user_management = ["sled", "bincode", "serde/derive", "crc32fast"]
|
user_management = ["sled", "bincode", "serde/derive", "crc32fast"]
|
||||||
|
|
31
README.md
31
README.md
|
@ -1,28 +1,23 @@
|
||||||
```
|
```
|
||||||
__ __ __
|
*. ,.-*,,..
|
||||||
____ ____ _____/ /_/ /_ _____/ /_____ ______
|
.` `. .,-'` ````--*,,,..
|
||||||
/ __ \/ __ \/ ___/ __/ __ \/ ___/ __/ __ `/ ___/
|
.` ;*` ```''-o
|
||||||
/ / / / /_/ / / / /_/ / / (__ ) /_/ /_/ / /
|
* ,' __ __ __
|
||||||
/_/ /_/\____/_/ \__/_/ /_/____/\__/\__,_/_/
|
`. ,' / /______ _____/ /_ ____ _/ /_
|
||||||
|
⭐ / //_/ __ \/ ___/ __ \/ __ `/ __ \
|
||||||
|
/ ,< / /_/ / /__/ / / / /_/ / /_/ /
|
||||||
|
/_/|_|\____/\___/_/ /_/\__,_/_.___/
|
||||||
```
|
```
|
||||||
|
# kochab
|
||||||
|
|
||||||
- [Documentation](https://docs.rs/northstar)
|
Kochab is an extension & a fork of the Gemini SDK [northstar]. Where northstar creates an efficient and flexible foundation for Gemini projects, kochab seeks to be as ergonomic and intuitive as possible, making it possible to get straight into getting your ideas into geminispace, with no worrying about needing to build the tools to get there.
|
||||||
- [GitHub](https://github.com/panicbit/northstar)
|
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Add the latest version of northstar to your `Cargo.toml`.
|
It is currently only possible to use kochab through it's git repo, although it may wind up on crates.rs someday.
|
||||||
|
|
||||||
## Manually
|
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
northstar = "0.3.0" # check crates.io for the latest version
|
kochab = { git = "https://github.com/Alch-Emi/kochab.git" }
|
||||||
```
|
|
||||||
|
|
||||||
## Automatically
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cargo add northstar
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# Generating a key & certificate
|
# Generating a key & certificate
|
||||||
|
@ -35,3 +30,5 @@ openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 36
|
||||||
and enter your domain name (e.g. "localhost" for testing) as Common Name (CN).
|
and enter your domain name (e.g. "localhost" for testing) as Common Name (CN).
|
||||||
|
|
||||||
Alternatively, if you want to include multiple domains add something like `-addext "subjectAltName = DNS:localhost, DNS:example.org"`.
|
Alternatively, if you want to include multiple domains add something like `-addext "subjectAltName = DNS:localhost, DNS:example.org"`.
|
||||||
|
|
||||||
|
[northstar]: https://github.com/panicbit/northstar "Northstar GitHub"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use anyhow::*;
|
use anyhow::*;
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use northstar::{Certificate, GEMINI_PORT, Request, Response, Server};
|
use kochab::{Certificate, GEMINI_PORT, Request, Response, Server};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ type CertBytes = Vec<u8>;
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
env_logger::builder()
|
env_logger::builder()
|
||||||
.filter_module("northstar", LevelFilter::Debug)
|
.filter_module("kochab", LevelFilter::Debug)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
let users = Arc::<RwLock::<HashMap<CertBytes, String>>>::default();
|
let users = Arc::<RwLock::<HashMap<CertBytes, String>>>::default();
|
||||||
|
|
|
@ -1,33 +1,36 @@
|
||||||
use anyhow::*;
|
use anyhow::*;
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use northstar::{Server, Response, GEMINI_PORT, Document};
|
use kochab::{Server, Response, GEMINI_PORT, Document};
|
||||||
use northstar::document::HeadingLevel::*;
|
use kochab::document::HeadingLevel::*;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
env_logger::builder()
|
env_logger::builder()
|
||||||
.filter_module("northstar", LevelFilter::Debug)
|
.filter_module("kochab", LevelFilter::Debug)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
let response: Response = Document::new()
|
let response: Response = Document::new()
|
||||||
.add_preformatted(include_str!("northstar_logo.txt"))
|
.add_preformatted_with_alt("kochab", include_str!("kochab_logo.txt"))
|
||||||
.add_blank_line()
|
.add_blank_line()
|
||||||
.add_link("https://docs.rs/northstar", "Documentation")
|
.add_text(
|
||||||
.add_link("https://github.com/panicbit/northstar", "GitHub")
|
concat!(
|
||||||
|
"Kochab is an extension & a fork of the Gemini SDK [northstar]. Where",
|
||||||
|
" northstar creates an efficient and flexible foundation for Gemini projects,",
|
||||||
|
" kochab seeks to be as ergonomic and intuitive as possible, making it",
|
||||||
|
" possible to get straight into getting your ideas into geminispace, with no",
|
||||||
|
" worrying about needing to build the tools to get there."
|
||||||
|
)
|
||||||
|
)
|
||||||
.add_blank_line()
|
.add_blank_line()
|
||||||
.add_heading(H1, "Usage")
|
.add_link("https://github.com/Alch-Emi/kochab", "GitHub")
|
||||||
.add_blank_line()
|
.add_blank_line()
|
||||||
.add_text("Add the latest version of northstar to your `Cargo.toml`.")
|
.add_heading(H2, "Usage")
|
||||||
.add_blank_line()
|
.add_blank_line()
|
||||||
.add_heading(H2, "Manually")
|
.add_text("Add the latest version of kochab to your `Cargo.toml`.")
|
||||||
.add_blank_line()
|
.add_blank_line()
|
||||||
.add_preformatted_with_alt("toml", r#"northstar = "0.3.0" # check crates.io for the latest version"#)
|
.add_preformatted_with_alt("toml", r#"kochab = { git = "https://github.com/Alch-Emi/kochab.git" }"#)
|
||||||
.add_blank_line()
|
.add_blank_line()
|
||||||
.add_heading(H2, "Automatically")
|
.add_heading(H2, "Generating a key & certificate")
|
||||||
.add_blank_line()
|
|
||||||
.add_preformatted_with_alt("sh", "cargo add northstar")
|
|
||||||
.add_blank_line()
|
|
||||||
.add_heading(H1, "Generating a key & certificate")
|
|
||||||
.add_blank_line()
|
.add_blank_line()
|
||||||
.add_preformatted_with_alt("sh", concat!(
|
.add_preformatted_with_alt("sh", concat!(
|
||||||
"mkdir cert && cd cert\n",
|
"mkdir cert && cd cert\n",
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
*. ,.-*,,..
|
||||||
|
.` `. .,-'` ````--*,,,..
|
||||||
|
.` ;*` ```''-o
|
||||||
|
* ,' __ __ __
|
||||||
|
`. ,' / /______ _____/ /_ ____ _/ /_
|
||||||
|
⭐ / //_/ __ \/ ___/ __ \/ __ `/ __ \
|
||||||
|
/ ,< / /_/ / /__/ / / / /_/ / /_/ /
|
||||||
|
/_/|_|\____/\___/_/ /_/\__,_/_.___/
|
|
@ -1,5 +0,0 @@
|
||||||
__ __ __
|
|
||||||
____ ____ _____/ /_/ /_ _____/ /_____ ______
|
|
||||||
/ __ \/ __ \/ ___/ __/ __ \/ ___/ __/ __ `/ ___/
|
|
||||||
/ / / / /_/ / / / /_/ / / (__ ) /_/ /_/ / /
|
|
||||||
/_/ /_/\____/_/ \__/_/ /_/____/\__/\__,_/_/
|
|
|
@ -1,15 +1,13 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::*;
|
use anyhow::*;
|
||||||
use futures_core::future::BoxFuture;
|
|
||||||
use futures_util::FutureExt;
|
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use northstar::{Server, Request, Response, GEMINI_PORT, Document};
|
use kochab::{Server, Request, Response, GEMINI_PORT, Document};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
env_logger::builder()
|
env_logger::builder()
|
||||||
.filter_module("northstar", LevelFilter::Debug)
|
.filter_module("kochab", LevelFilter::Debug)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
Server::bind(("localhost", GEMINI_PORT))
|
Server::bind(("localhost", GEMINI_PORT))
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
use anyhow::*;
|
use anyhow::*;
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use northstar::{Document, document::HeadingLevel, Request, Response, GEMINI_PORT};
|
use kochab::{Document, document::HeadingLevel, Request, Response, GEMINI_PORT};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
env_logger::builder()
|
env_logger::builder()
|
||||||
.filter_module("northstar", LevelFilter::Debug)
|
.filter_module("kochab", LevelFilter::Debug)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
northstar::Server::bind(("localhost", GEMINI_PORT))
|
kochab::Server::bind(("localhost", GEMINI_PORT))
|
||||||
.add_route("/", handle_base)
|
.add_route("/", handle_base)
|
||||||
.add_route("/route", handle_short)
|
.add_route("/route", handle_short)
|
||||||
.add_route("/route/long", handle_long)
|
.add_route("/route/long", handle_long)
|
||||||
|
|
|
@ -2,12 +2,12 @@ use std::path::PathBuf;
|
||||||
|
|
||||||
use anyhow::*;
|
use anyhow::*;
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use northstar::{Server, GEMINI_PORT};
|
use kochab::{Server, GEMINI_PORT};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
env_logger::builder()
|
env_logger::builder()
|
||||||
.filter_module("northstar", LevelFilter::Debug)
|
.filter_module("kochab", LevelFilter::Debug)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
Server::bind(("localhost", GEMINI_PORT))
|
Server::bind(("localhost", GEMINI_PORT))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use anyhow::*;
|
use anyhow::*;
|
||||||
use log::LevelFilter;
|
use log::LevelFilter;
|
||||||
use northstar::{
|
use kochab::{
|
||||||
GEMINI_PORT,
|
GEMINI_PORT,
|
||||||
Document,
|
Document,
|
||||||
Request,
|
Request,
|
||||||
|
@ -23,7 +23,7 @@ use northstar::{
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
// Turn on logging
|
// Turn on logging
|
||||||
env_logger::builder()
|
env_logger::builder()
|
||||||
.filter_module("northstar", LevelFilter::Debug)
|
.filter_module("kochab", LevelFilter::Debug)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
Server::bind(("0.0.0.0", GEMINI_PORT))
|
Server::bind(("0.0.0.0", GEMINI_PORT))
|
||||||
|
@ -45,7 +45,7 @@ async fn main() -> Result<()> {
|
||||||
/// Displays the user's current secret string, or prompts the user to sign in if they
|
/// Displays the user's current secret string, or prompts the user to sign in if they
|
||||||
/// haven't. Includes links to update your string (`/update`) or your account
|
/// haven't. Includes links to update your string (`/update`) or your account
|
||||||
/// (`/account`). Even though we haven't added an explicit handler for `/account`, this
|
/// (`/account`). Even though we haven't added an explicit handler for `/account`, this
|
||||||
/// route is managed by northstar.
|
/// route is managed by kochab.
|
||||||
///
|
///
|
||||||
/// Because this route is registered as an authenticated route, any connections without a
|
/// Because this route is registered as an authenticated route, any connections without a
|
||||||
/// certificate will be prompted to add a certificate and register.
|
/// certificate will be prompted to add a certificate and register.
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
```
|
|
||||||
__ __ __
|
|
||||||
____ ____ _____/ /_/ /_ _____/ /_____ ______
|
|
||||||
/ __ \/ __ \/ ___/ __/ __ \/ ___/ __/ __ `/ ___/
|
|
||||||
/ / / / /_/ / / / /_/ / / (__ ) /_/ /_/ / /
|
|
||||||
/_/ /_/\____/_/ \__/_/ /_/____/\__/\__,_/_/
|
|
||||||
```
|
|
||||||
|
|
||||||
=> https://docs.rs/northstar Documentation
|
|
||||||
=> https://github.com/panicbit/northstar GitHub
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
|
|
||||||
Add the latest version of northstar to your `Cargo.toml`.
|
|
||||||
|
|
||||||
## Manually
|
|
||||||
|
|
||||||
```toml
|
|
||||||
northstar = "0.3.0" # check crates.io for the latest version
|
|
||||||
```
|
|
||||||
|
|
||||||
## Automatically
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cargo add northstar
|
|
||||||
```
|
|
||||||
|
|
||||||
# Generating a key & certificate
|
|
||||||
|
|
||||||
```sh
|
|
||||||
mkdir cert && cd cert
|
|
||||||
openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
|
|
||||||
```
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
```kochab
|
||||||
|
*. ,.-*,,..
|
||||||
|
.` `. .,-'` ````--*,,,..
|
||||||
|
.` ;*` ```''-o
|
||||||
|
* ,' __ __ __
|
||||||
|
`. ,' / /______ _____/ /_ ____ _/ /_
|
||||||
|
⭐ / //_/ __ \/ ___/ __ \/ __ `/ __ \
|
||||||
|
/ ,< / /_/ / /__/ / / / /_/ / /_/ /
|
||||||
|
/_/|_|\____/\___/_/ /_/\__,_/_.___/
|
||||||
|
```
|
||||||
|
|
||||||
|
Kochab is an extension & a fork of the Gemini SDK northstar. Where northstar creates an efficient and flexible foundation for Gemini projects, kochab seeks to be as ergonomic and intuitive as possible, making it possible to get straight into getting your ideas into geminispace, with no worrying about needing to build the tools to get there.
|
||||||
|
|
||||||
|
=> https://github.com/panicbit/northstar Northstar GitHub
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
It is currently only possible to use kochab through it's git repo, although it may wind up on crates.rs someday.
|
||||||
|
|
||||||
|
```toml
|
||||||
|
kochab = { git = "https://github.com/Alch-Emi/kochab.git" }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Generating a key & certificate
|
||||||
|
|
||||||
|
Run
|
||||||
|
```sh
|
||||||
|
mkdir cert && cd cert
|
||||||
|
openssl req -x509 -nodes -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
|
||||||
|
```
|
||||||
|
and enter your domain name (e.g. "localhost" for testing) as Common Name (CN).
|
||||||
|
|
||||||
|
Alternatively, if you want to include multiple domains add something like:
|
||||||
|
```
|
||||||
|
-addext "subjectAltName = DNS:localhost, DNS:example.org"
|
||||||
|
```
|
||||||
|
|
|
@ -273,7 +273,7 @@ impl<A: ToSocketAddrs> Builder<A> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the directory that northstar should look for TLS certs and keys into
|
/// Sets the directory that kochab should look for TLS certs and keys into
|
||||||
///
|
///
|
||||||
/// Northstar will look for files called `cert.pem` and `key.pem` in the provided
|
/// Northstar will look for files called `cert.pem` and `key.pem` in the provided
|
||||||
/// directory.
|
/// directory.
|
||||||
|
@ -288,7 +288,7 @@ impl<A: ToSocketAddrs> Builder<A> {
|
||||||
.set_key(dir.join("key.pem"))
|
.set_key(dir.join("key.pem"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the path to the TLS certificate northstar will use
|
/// Set the path to the TLS certificate kochab will use
|
||||||
///
|
///
|
||||||
/// This defaults to `cert/cert.pem`.
|
/// This defaults to `cert/cert.pem`.
|
||||||
///
|
///
|
||||||
|
@ -299,7 +299,7 @@ impl<A: ToSocketAddrs> Builder<A> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the path to the ertificate key northstar will use
|
/// Set the path to the ertificate key kochab will use
|
||||||
///
|
///
|
||||||
/// This defaults to `cert/key.pem`.
|
/// This defaults to `cert/key.pem`.
|
||||||
///
|
///
|
||||||
|
@ -509,7 +509,7 @@ pub const GEMINI_MIME_STR: &str = "text/gemini";
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// Mime for Gemini documents ("text/gemini")
|
/// Mime for Gemini documents ("text/gemini")
|
||||||
pub static ref GEMINI_MIME: Mime = GEMINI_MIME_STR.parse().expect("northstar BUG");
|
pub static ref GEMINI_MIME: Mime = GEMINI_MIME_STR.parse().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(note = "Use `GEMINI_MIME` instead", since = "0.3.0")]
|
#[deprecated(note = "Use `GEMINI_MIME` instead", since = "0.3.0")]
|
||||||
|
|
|
@ -25,7 +25,7 @@ use crate::types::Request;
|
||||||
/// considered to be the same route.
|
/// considered to be the same route.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use northstar::routing::RoutingNode;
|
/// # use kochab::routing::RoutingNode;
|
||||||
/// let mut routes = RoutingNode::<&'static str>::default();
|
/// let mut routes = RoutingNode::<&'static str>::default();
|
||||||
/// routes.add_route("/", "base");
|
/// routes.add_route("/", "base");
|
||||||
/// routes.add_route("/trans/rights/", "short route");
|
/// routes.add_route("/trans/rights/", "short route");
|
||||||
|
@ -171,7 +171,7 @@ impl<T> RoutingNode<T> {
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```
|
/// ```
|
||||||
/// # use std::collections::HashSet;
|
/// # use std::collections::HashSet;
|
||||||
/// # use northstar::routing::RoutingNode;
|
/// # use kochab::routing::RoutingNode;
|
||||||
/// let mut map = RoutingNode::<usize>::default();
|
/// let mut map = RoutingNode::<usize>::default();
|
||||||
/// map.add_route("/", 0);
|
/// map.add_route("/", 0);
|
||||||
/// map.add_route("/hello/world", 1312);
|
/// map.add_route("/hello/world", 1312);
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
//! # Examples
|
//! # Examples
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! use northstar::document::HeadingLevel::*;
|
//! use kochab::document::HeadingLevel::*;
|
||||||
//!
|
//!
|
||||||
//! let mut document = northstar::Document::new();
|
//! let mut document = kochab::Document::new();
|
||||||
//!
|
//!
|
||||||
//! document.add_heading(H1, "Heading 1");
|
//! document.add_heading(H1, "Heading 1");
|
||||||
//! document.add_heading(H2, "Heading 2");
|
//! document.add_heading(H2, "Heading 2");
|
||||||
|
@ -57,7 +57,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let document = northstar::Document::new();
|
/// let document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// assert_eq!(document.to_string(), "");
|
/// assert_eq!(document.to_string(), "");
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -73,7 +73,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```compile_fail
|
/// ```compile_fail
|
||||||
/// use northstar::document::{Document, Item, Text};
|
/// use kochab::document::{Document, Item, Text};
|
||||||
///
|
///
|
||||||
/// let mut document = Document::new();
|
/// let mut document = Document::new();
|
||||||
/// let text = Text::new_lossy("foo");
|
/// let text = Text::new_lossy("foo");
|
||||||
|
@ -95,7 +95,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```compile_fail
|
/// ```compile_fail
|
||||||
/// use northstar::document::{Document, Item, Text};
|
/// use kochab::document::{Document, Item, Text};
|
||||||
///
|
///
|
||||||
/// let mut document = Document::new();
|
/// let mut document = Document::new();
|
||||||
/// let items = vec!["foo", "bar", "baz"]
|
/// let items = vec!["foo", "bar", "baz"]
|
||||||
|
@ -120,7 +120,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_blank_line();
|
/// document.add_blank_line();
|
||||||
///
|
///
|
||||||
|
@ -141,7 +141,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_text("hello\n* world!");
|
/// document.add_text("hello\n* world!");
|
||||||
///
|
///
|
||||||
|
@ -168,7 +168,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_link("https://wikipedia.org", "Wiki\n\nWiki");
|
/// document.add_link("https://wikipedia.org", "Wiki\n\nWiki");
|
||||||
///
|
///
|
||||||
|
@ -198,7 +198,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_link_without_label("https://wikipedia.org");
|
/// document.add_link_without_label("https://wikipedia.org");
|
||||||
///
|
///
|
||||||
|
@ -230,7 +230,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_preformatted("a\n b\n c");
|
/// document.add_preformatted("a\n b\n c");
|
||||||
///
|
///
|
||||||
|
@ -251,7 +251,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_preformatted_with_alt("rust", "fn main() {\n}\n");
|
/// document.add_preformatted_with_alt("rust", "fn main() {\n}\n");
|
||||||
///
|
///
|
||||||
|
@ -282,9 +282,9 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use northstar::document::HeadingLevel::H1;
|
/// use kochab::document::HeadingLevel::H1;
|
||||||
///
|
///
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_heading(H1, "Welcome!");
|
/// document.add_heading(H1, "Welcome!");
|
||||||
///
|
///
|
||||||
|
@ -311,7 +311,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_unordered_list_item("milk");
|
/// document.add_unordered_list_item("milk");
|
||||||
/// document.add_unordered_list_item("eggs");
|
/// document.add_unordered_list_item("eggs");
|
||||||
|
@ -334,7 +334,7 @@ impl Document {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut document = northstar::Document::new();
|
/// let mut document = kochab::Document::new();
|
||||||
///
|
///
|
||||||
/// document.add_quote("I think,\ntherefore I am");
|
/// document.add_quote("I think,\ntherefore I am");
|
||||||
///
|
///
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl Meta {
|
||||||
|
|
||||||
let meta: String = match truncate_pos {
|
let meta: String = match truncate_pos {
|
||||||
None => meta.into(),
|
None => meta.into(),
|
||||||
Some(truncate_pos) => meta.get(..truncate_pos).expect("northstar BUG").into(),
|
Some(truncate_pos) => meta.get(..truncate_pos).unwrap().into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Self(meta)
|
Self(meta)
|
||||||
|
|
Loading…
Reference in New Issue