Giter Site home page Giter Site logo

libyaml-safer's Issues

Panic: TODO: What is expected here?

Minimal reproducer:

let mut data: &[u8] = b"[!,";
let mut parser = libyaml_safer::Parser::new();
parser.set_input_string(&mut data);
let _ = libyaml_safer::Document::load(&mut parser);

Panic: unexpected end of input

Minimal reproducer:

let mut data: &[u8] = b"a: ''|\n 0";
let mut parser = libyaml_safer::Parser::new();
parser.set_input_string(&mut data);
let _ = libyaml_safer::Document::load(&mut parser);

Fix for CRLF

Thanks for creating this library! I've been working with it for a couple of months, mostly using the event-based Parser API.

One thing I've noticed is that CRLF line endings are not working (I work on a Windows machine), in that they are resulting in double-line feeds (\n\n) in strings coming out of the library, and incorrect line numbers in Marks.

I believe the fix is very simple. Line 143 of scanner.rs (in read_line_break) should read:

if let ('\r', Some('\n')) = (front, self.buffer.get(1).copied()) {

Similar to line 111, and to the corresponding libyaml implementation (https://github.com/yaml/libyaml/blob/1e66c1e13a50577bd7ad76abec61ba436d0145bd/src/scanner.c#L533)

I cloned locally and made this change, and it did resolve my issue. I have not done any further testing. I'm happy to open a PR but I'm not sure if you're accepting contributions to this repo.

Implement Serializer/Deserializer

Now that serde_yaml is unmaintained, add implementations of serde::Serializer/Deserializer directly to libyaml-safer to provide an alternative.

The initial implementation should be 1:1 compatible with the behavior of serde_yaml.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.