-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Itemlists2 #24
Open
stappersg
wants to merge
56
commits into
tailhook:serde
Choose a base branch
from
unknown repository
base: serde
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Itemlists2 #24
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
21beef2
Deserializing unit structs implemented
tailhook db3f06f
Implements decoding mappings
tailhook e05b59d
Deserializes struct values
tailhook d679dfb
Implements deserialisation of enums
tailhook f67f519
Fixes final test
tailhook 2b4c327
Merge branch 'serde': all original tests work
tailhook f84217f
vagga.yaml: upgrades rust and other things
tailhook 21dae11
Removes old decode module (rustc_serialize) and fixes all tests
tailhook d50c2cd
Fixes tests for paths on windows
tailhook 0671734
Adds `duration` and `regex` helper modules
tailhook 32241e0
Fixes `deserialize_str` (fixes `regex` and `duration` modules)
tailhook b467588
Also test build without modules on travis
tailhook a314885
More options for booleans supported
tailhook 6452d89
Renames json tests to transcode tests, fixes them
tailhook 048896b
Shows path in errors again
tailhook 62e883a
Hides `Error` type under a newtype
tailhook 9e795bc
Exposed error constructors again (for use in include handlers)
tailhook 237a0d4
Revert "More options for booleans supported"
tailhook 2b630bf
Tweaks error messages
tailhook d1d88b6
Deserializing newtype structs is implemented
tailhook 5dd2f3f
Fixes deserializing non-string mapping keys
tailhook db0ff2e
Upgrades rust to 1.20, adds packaging stuff
tailhook 7d8c995
Version bumped to v0.3.0
tailhook b897eda
Custom errors for validators
anti-social 1240b17
Refactor Error's constructors names
anti-social 78bf7f2
Merge pull request #11 from anti-social/dev/custom-error
tailhook 3e32f14
Adds "config" category to Cargo.toml
tailhook c2e792d
Converted README.rst -> README.md
tailhook d43953d
Version bumped to v0.3.1
tailhook 8a6d8a3
vagga.yaml: Upgrade rust to v1.22.1, remove cargo-outdated from conta…
tailhook a767538
Eliminate few warnings
tailhook a412bcb
[breaking] Add support of IncludeSeq and IncludeMap
tailhook 265511a
Allow tag and anchor in any order
tailhook 9e75f86
Fix empty lines in literals when CRLF newlines are used
tailhook 221cbdb
Better error reporting for nonimplemented things
tailhook c1d8464
[breaking] Remove regex module (use serde_regex), remove json module
tailhook 9d247ed
Fix most warnings
tailhook ceb6b03
Remove unused attributes of Deserializer
tailhook 7438579
Fix more warnings
tailhook 3fbcb63
Remove duration parser (use humantime directly)
tailhook d1e7bdf
Implement debug for everything
tailhook bca4800
Make Error implement Send + Sync
tailhook cbdfe17
Fix duration test
tailhook 1012d42
Version bumped to v0.4.0
tailhook 3caa66d
Fix typo
tailhook 1963992
vagga.yaml: upgrade containers
tailhook ea44229
Upgrade dependencies
tailhook 91ad284
Error on tag or anchor before alias
tailhook a6dc2f6
Version bumped to v0.4.1
tailhook 47f1489
Document there is more documentation
stappersg 7167bfe
Bumped the year in sphinx-doc
tailhook f7b046d
Working example for lib.rs
stappersg 4a431f8
Merge pull request #18 from stappersg/libRSexample
tailhook db76602
Merge pull request #16 from stappersg/bumpDocYear
tailhook 1c0f06d
Merge pull request #13 from stappersg/moreDoc
tailhook a5f8179
Example with item lists
stappersg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,34 @@ | ||
sudo: false | ||
dist: trusty | ||
language: rust | ||
rust: | ||
- stable | ||
- beta | ||
- nightly | ||
script: | ||
- cargo build --verbose | ||
- cargo test --verbose | ||
|
||
cache: | ||
- cargo | ||
|
||
before_cache: | ||
- rm -r $TRAVIS_BUILD_DIR/target/debug | ||
|
||
jobs: | ||
include: | ||
- os: linux | ||
rust: stable | ||
- os: linux | ||
rust: beta | ||
- os: linux | ||
rust: nightly | ||
|
||
# deploy | ||
- stage: publish | ||
os: linux | ||
rust: stable | ||
env: | ||
# CARGO_TOKEN | ||
- secure: "IPm2lHXAtXUY8pJtUMRV+jgLSCPKRJQyP3ax5aUhyaGlR83w4krEOcIpqQgu5a4rgw3SZUjDhxQMsRbzRZIehU+C3u2LTDpn0yycPnGmFRKVqnoS5dHdFMQ6IKLDZQK99MFZ/vMThipImnS9WFm2D1X/8XS31Mpn81Y7o54rIHk=" | ||
install: true | ||
script: true | ||
|
||
deploy: | ||
- provider: script | ||
script: 'cargo publish --verbose --token=$CARGO_TOKEN' | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
minimum-bulk: v0.4.5 | ||
|
||
versions: | ||
|
||
- file: Cargo.toml | ||
block-start: ^\[package\] | ||
block-end: ^\[.*\] | ||
regex: ^version\s*=\s*"(\S+)" | ||
|
||
- file: doc/conf.py | ||
regex: ^version\s*=\s*'(\S+)' | ||
partial-version: ^\d+\.\d+ | ||
|
||
- file: doc/conf.py | ||
regex: ^release\s*=\s*'(\S+)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
doc/ | ||
==== | ||
|
||
In this directory documentation in [sphinx-doc][1] format. | ||
|
||
Type `make html` to get HTML generated. Expect to get errors | ||
when *sphinx-doc* is not installed on your system. | ||
|
||
With `make` you get a list of possible output formats. | ||
|
||
[1]: http://www.sphinx-doc.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
extern crate quire; | ||
#[macro_use] extern crate serde_derive; | ||
use quire::{parse_config, Options}; | ||
use quire::validate::{Structure, Scalar, Sequence}; | ||
//e quire::validate::{Structure, Scalar, Sequence, Enum}; | ||
// TODO Marker_002 Validate against known vehicles | ||
|
||
|
||
#[derive(Deserialize)] | ||
#[allow(dead_code)] | ||
struct Journey { | ||
name: String, | ||
year: String, | ||
team: Members, | ||
vehicles: Vehicles, | ||
locations: Locations, | ||
} | ||
|
||
#[derive(Debug,Deserialize)] | ||
struct Members(Vec<String>); | ||
|
||
|
||
/* TODO Marker_002 Validate against known vehicles | ||
enum KnownVehicles { | ||
Bobcat, | ||
Jeep, | ||
Landrover, | ||
Unimog, | ||
} | ||
// TODO Marker_002 Validate against known vehicles | ||
*/ | ||
|
||
#[derive(Deserialize)] | ||
struct Vehicles(Vec<String>); | ||
// TODO Marker_002 Validate against known vehicles | ||
|
||
//#[derive(Deserialize)] | ||
#[derive(Debug,Deserialize)] | ||
struct Locations(Vec<String>); | ||
|
||
|
||
// give it a method | ||
// so we can create a iterator for it | ||
#[allow(dead_code)] | ||
impl Members { | ||
fn new() -> Members { | ||
Members(Vec::new()) | ||
} | ||
} | ||
|
||
// and implement IntoIterator | ||
impl IntoIterator for Members { | ||
type Item = String; | ||
type IntoIter = ::std::vec::IntoIter<Self::Item>; | ||
|
||
fn into_iter(self) -> Self::IntoIter { | ||
self.0.into_iter() | ||
} | ||
} | ||
|
||
fn validator() -> Structure<'static> { | ||
Structure::new() | ||
.member("name", Scalar::new()) | ||
.member("year", Scalar::new()) | ||
.member("team", Sequence::new(Scalar::new())) | ||
.member("vehicles", Sequence::new(Scalar::new())) | ||
.member("locations", Sequence::new(Scalar::new())) | ||
} | ||
|
||
fn work(jrny: &Journey) { | ||
println!("name is {}.", jrny.name); | ||
println!("year is {}.", jrny.year); | ||
/* | ||
for tm in jrny.team { | ||
println!("team member {}.", tm); | ||
} | ||
TODO make team iterable | ||
*/ | ||
println!("team members {:?} DBG.", jrny.team); // TODO make team iterable | ||
println!("{:?} DBG a.k.a. DeBuG", jrny.locations); | ||
// | ||
// TODO show more of what has been read from the YAML configuration | ||
// | ||
} | ||
|
||
fn main() { | ||
let jrny: Journey; | ||
jrny = parse_config("examples/journey.yaml", | ||
&validator(), &Options::default()) | ||
.expect("valid config"); | ||
work(&jrny) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
# journey.yaml | ||
# "configuration" for item_lists | ||
|
||
--- | ||
name: Voyage Voyage | ||
year: 2020 | ||
team: | ||
- Alice | ||
- Bob | ||
- Claire | ||
- David | ||
vehicles: | ||
- Jeep | ||
- Landrover | ||
# Beware: TODO Marker_002 Validate against known vehicles | ||
locations: | ||
- Home | ||
- Sweet | ||
- Home | ||
|
||
... | ||
# l l |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be something like
Or does
rust-quire
that already and have I no clue how to use it? ( Yes,I'm the person that opened #21, Item lists example:-/
)