Commit Graph

320 Commits

Author SHA1 Message Date
Paul Stemmet 6025906719 ci/github: add lint workflow 2022-04-01 22:21:54 +01:00
Paul Stemmet 7d4e270aae ci/github: refactor tests workflow to use just 2022-04-01 22:21:54 +01:00
Paul Stemmet afa2a9e504 lib/event: fix module doc intra links
enum variants should use 'type@' not 'enum@' it seems.
2022-04-01 22:15:24 +01:00
Paul Stemmet b53e7e78a9 build/justfile: add recipes for just
Just is an improvement on Make/Makefiles for people that wish to use it
as a recipe runner rather than a build system.

We are introducing a dependency on it, as it gives us easy ways to run
arbitrarily complex commands in a composable fashion.

In particular, these recipes allow us 5 major gains:

1. Setting our repo's environment consistently (fresh-system, install-bins)
2. Run comprehensive checks on the local tree's code (lint, audit, fmt,
   test, test-all, lint-docs)
3. Utility commands for inspecting dependencies (deps, rdeps, udeps),
   documentation (docs) or git hygiene (git-branch-prune)
4. Provides extra environment vairables that can be used to control
   things like features and profile used when building, which are
   missing from Cargo and/or rustc
5. Provides a uniform interface for repo tasks, abstracting over many
   different underlying tools
2022-04-01 20:38:04 +01:00
Paul Stemmet 7d74a26507
chore: update lock file 2022-04-01 19:33:53 +00:00
Paul Stemmet ee8c93eb3d chore: bump v0.1.1
This is the first published version of this crate. Quite a milestone for
me, as I have started work on this library multiple times over the last
3 years, never getting enough traction to find something that worked for
my project goals.

This version contains the lowest level API that will be supported by
this crate: lib/event; which allows callers to directly consume YAML
stream events as the occur, with no help or storage apparatus.

I have some CI/CD issues to figure out -- testing docs, automating
crates.io publishes, improving test spread and speed, adding a recipe
runner (Make/just). After which I'll start working away on the in memory
graph representation of YAML, which will allow me to provide a Value
abstraction for handling arbitrary YAML, similar to serde_json::Value.

Its secondary purpose will be as storage for aliasing trees... during
serde::Deserialization, which will be a feature gated API that may
eventually take the place of serde_yaml.
2022-03-27 16:51:52 +01:00
Paul Stemmet 44d8b82129 chore: update deps 2022-03-27 16:51:52 +01:00
Paul Stemmet 10089e376b reader/error: fix doc link error 2022-03-27 15:36:57 +01:00
Paul Stemmet 6360463435 event/flag: fix doc link error 2022-03-27 15:36:57 +01:00
Paul Stemmet 96d4531054 lib/reader: document module 2022-03-27 15:36:57 +01:00
Paul Stemmet 5c4d3c4879 event/types: document all public items 2022-03-27 15:36:57 +01:00
Paul Stemmet d247b19068 lib/error: module doc 2022-03-27 15:36:57 +01:00
Paul Stemmet 74cf9a2ad4 lib: warn on missing public docs 2022-03-27 15:36:57 +01:00
Paul Stemmet fa84377ebb event/parser: use array_iterator in tests macros 2022-03-27 12:06:14 +01:00
Paul Stemmet ab2c0fd438 event/types: hide internal types
This commit modifies the former Scalar (now know as ScalarLike) enum to
hide the internal types inside local opaque wrappers. Rather than the
previous struct variants, ScalarLike now takes Eager(Scalar) and
Lazy(ScalarLazy) variants, both of which hide internal types involved.

This commit also removes the ScanResult return types from public view,
converting them to the library level Error type.
2022-03-27 11:51:02 +01:00
Paul Stemmet 76c547717d scanner/error: add From impl for ScanError to public Error 2022-03-27 11:51:02 +01:00
Paul Stemmet 04e07125e6 lib/scanner: make most types crate private 2022-03-27 11:51:02 +01:00
Paul Stemmet 742386b177 lib/reader: hide private types in Read methods
We place a small wrapper around all of the arguments provided to
Read::drive(), and return a wrapped error, both of which are opaque to
external libraries.
2022-03-27 11:51:02 +01:00
Paul Stemmet c2f20d7883 lib: move Slice, ScalarStyle, StreamEncoding enums
from lib/token to event/types, and add Copy derives for ScalarStyle +
StreamEncoding.
2022-03-27 11:51:02 +01:00
Paul Stemmet 51c7529f75 event/parser: use array_iterator() over ArrayIter::new
as the latter has been deprecated in a future Rust version, and is
causing lots of spurious warnings in CI.
2022-03-26 15:49:50 +00:00
Paul Stemmet 4f402ee38e lib/event: use public Error type for returned errors 2022-03-26 15:29:54 +00:00
Paul Stemmet b5fa2acc9e event/error: impl From local error type to public Error 2022-03-26 15:29:54 +00:00
Paul Stemmet 62f9cf53e0 lib/event: ensure private types are private
Including the local error type -- we'll be using that which is provided
in lib/error.
2022-03-26 15:29:54 +00:00
Paul Stemmet 2793e4cc00 lib/event: add error conversion to ErrorKind 2022-03-26 15:29:54 +00:00
Paul Stemmet fe09d7aa27 lib/reader: add top level public API
- from_utf8()
- from_read()
- try_from_bytes()

These cover the major areas we expect a user to use when handing us a
(potential) YAML stream.
2022-03-26 15:29:54 +00:00
Paul Stemmet 4a48ac1735 reader/error: impl From local error type to public Error 2022-03-26 15:29:54 +00:00
Paul Stemmet 46d088fa2d lib/reader: hide local error type 2022-03-26 15:29:54 +00:00
Paul Stemmet 519482f798 lib/reader: add error conversion to ErrorKind 2022-03-26 15:29:54 +00:00
Paul Stemmet fba5f934f5 lib/scanner: add error conversion to ErrorCode 2022-03-26 15:29:54 +00:00
Paul Stemmet a2741447ac lib/scanner: fix visibility of modules
pub -> pub(crate)
2022-03-26 15:29:54 +00:00
Paul Stemmet c8496b0216 lib/error: add mkError! macro
For internal use, handles the conversion chain up to a real external
Error, from other types.
2022-03-26 15:29:54 +00:00
Paul Stemmet ff1925fdd0 lib/error: add library error type for all public APIs
This type obscures the underlying classifications, providing a stable
enum, Category, for classification.

This doesn't particularly change the various module level errors, though
will will have to implement From<Self> for yary::Error.

I'll also need to make private and public versions of the initializer
functions for fallible public methods that can be used internally, e.g
lib/reader.
2022-03-26 15:29:54 +00:00
Paul Stemmet 8d20962640 lib: clippy lints 2022-03-26 15:29:54 +00:00
Paul Stemmet 8ee7b7bff6 docs: fix rustdoc links in lib/scanner & lib/token 2022-03-26 15:29:14 +00:00
Paul Stemmet fa821cbf81 build: add pre-publish fields to Cargo.toml
- readme
- description
- repository
- keywords
- categories

and reorganize field layout, better grouping important fields together.
2022-03-19 10:04:02 +00:00
Paul Stemmet 790b9b55d5 docs: add README, explaining library purpose and status 2022-03-18 15:40:12 +00:00
Paul Stemmet a8230f86f2 lib: stub library documentation 2022-03-18 15:26:45 +00:00
Paul Stemmet ba41069dc6 event/error: document ParseError variants 2022-03-18 15:26:45 +00:00
Paul Stemmet 95eeec30f5 lib: expose reader and event modules 2022-03-18 15:26:45 +00:00
Paul Stemmet 183dbc3b1b lib/event: expose public API for YAML event streams
This commit surfaces a public API for streaming YAML events from a read
source. It provides callers an Events{} type that can be generated from
any reader::Read implementation -- so for the moment, OwnedReader(s) and
BorrowReader(s) -- via the module functions from_reader() and
from_reader_with(). This type implements IntoIterator, and thus can be
integrated with any iterator based flows, and benefits from the entire,
extensive ecosystem around them.

That said, I expect this to be a relatively unused part of this library
in the long term, being the lowest level public API exposed by this
library.
2022-03-18 15:26:45 +00:00
Paul Stemmet 65f990872f event/flag: add public Flags exposed to callers
These define the configuration that library users are allowed to set
when iterating over Events.

It currently only has one meaningful option, O_LAZY which reflects the
behavior exposed by lib/scanner. This will likely change in the future,
if more customization is desired when working with Event streams.
2022-03-18 15:26:45 +00:00
Paul Stemmet 44759d458d event/parser: use relative paths in test macros 2022-03-18 15:26:45 +00:00
Paul Stemmet bdfafc057f event/parser: module doc 2022-03-18 15:26:45 +00:00
Paul Stemmet d2c25e2bd0 lib/event: add module doc
A large portion of this was split out from event/parser's module doc to
coerce git to rename files.
2022-03-18 15:26:45 +00:00
Paul Stemmet 76824e9db7 lib/event: move Parser to lib/event/parser 2022-03-18 15:26:45 +00:00
Paul Stemmet 2e77556dd1 reader: fix visibility of public readers 2022-03-18 15:26:45 +00:00
Paul Stemmet f7d75b836f lib: pin rust version to 1.53
This isn't a hard guarantee, if a new version of Rust offers something
useful, this will be moved with no warnings.
2022-03-18 15:26:45 +00:00
Paul Stemmet d3fd96ea31 ci/github: add MSRV == 1.52
This can be bumped as needed but I'd like to stop checking it myself
2022-01-09 21:45:59 +00:00
Paul Stemmet f288b71f83 ci/github: improve test naming
- Remove unnecessary words from task names
- Add rust version to action name :: [$os/$rustv] $taskname
2022-01-09 21:45:59 +00:00
Paul Stemmet c14ba7829c ci/github: improve toolchain install task
- set default rust version

instead of a folder override, as we always expect to use the provided
version globally per run.

- explicitly declare extra rustup components

rather than implicitly rely on the current defaults
2022-01-09 21:45:59 +00:00