Skip to content
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

Parse RPSL into borrowing ObjectView convertible to owned Object #50

Merged
merged 38 commits into from
Dec 9, 2023

Conversation

SRv6d
Copy link
Owner

@SRv6d SRv6d commented Dec 9, 2023

Parse RPSL into types that contain references to the original text instead of creating assignments for each attribute during parsing. This PR also contains an object! macro, making it easier to create an Object, as well as complete input validation for creating owned types.

SRv6d added 30 commits November 20, 2023 23:44
* Return `rpsl::Attribute` directly from attribute parser, simplifying code and improving performance

* Create enum `AttributeValue` for single and multiline RPSL values

* Add `From<Vec<(&str, &str)>> for Object`

* Add doctests for `From` implementaions

* Replace for loop with an iterator

* Ensure attributes with empty names cannot be constructed and remove imperfect conversions

* Rename `AttributeValue` to `Value`

* Make NonEmptyString public within crate

* Simplify and organize RPSL module

* Make `Object::new` public to crate

* Cleanup parser module

* Replace `tag("\n")` with `newline`

* Fix visibility

* Add `parse_whois_response` without implementation

* Add `impl From<Vec<Attribute>> for Object`

* Add `#[derive(Debug, PartialEq)]` to `Object`

* Make attribute and object constructors public

* Add constructor to create empty attributes

* Refactor parser to add parse_whois_response

* Adjust benchmark to API

* Add benchmark for parsing of AS3257 whois response

* Fix typo

* derive `Eq` on all public structs

* Implement `PartialEq<&str>` for `Name`

* `impl fmt::Display for Name`

* Add some examples

* Update README

* Add examples to `Object`

* impl Index<usize> for Object

* Move private doctests to unit tests

* Implement `IntoIterator` and len for `Object`

* Simplify `pub fn parse_whois_response`

* Add some examples

* Add continuation_char parser

* Optimize attribute parser

* Don't use `super` in subcomponent module

* Use delimited instead of tuple in `continuation_line` parser

* Flatten tests

* Add tests for RPSL Object representation

* Implement `Display` trait for `Object`

* Add `InvalidNameError` error type

* Disallow use of `panic!` using clippy

* Fix some clippy lints

* Add `AttributeError` error type

* Remove unneeded `#[must_use]`

* Add `Error` section to parser docs

* Add `InvalidValueError`

* Adjust doctests

* Add object text representation

* Add (doc)tests for desired object `get` behavior

* Add empty `get` fn to `Object`

* Add get implementation that passes tests

* Expose `rpsl::attribute` module within crate instead of `rpsl::attribute::Value`

* Derive `Clone` on `Object` and contained types

* Replace `TryFrom<&str>` for `Name` with `FromStr`

* Remove assets related to python bindings
To be re-implemented in dedicated repository

* Make `rpsl::error` public instead of exposing `rpsl::error::AttributeError` directly

* Re add codespell configuration removed with pyproject.toml

* Fix typos
Copy link

codspeed-hq bot commented Dec 9, 2023

CodSpeed Performance Report

Merging #50 will improve performances by ×2.3

Comparing view-types (4c4f1f6) with main (d13b875)

Summary

⚡ 1 improvements

Benchmarks breakdown

Benchmark main view-types Change
parse AS3257 40.5 ms 17.7 ms ×2.3

@SRv6d SRv6d merged commit 9f6f0d4 into main Dec 9, 2023
5 checks passed
@SRv6d SRv6d deleted the view-types branch December 9, 2023 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant