Hi there ๐
Finding my examples
https://github.com/search?q=user%3AKodrAus+topic%3Aexample
Any example repositories I put together should turn up with a user:KodrAus topic:example
GitHub search query.
Rust library for tidy json string literals
License: Apache License 2.0
https://github.com/search?q=user%3AKodrAus+topic%3Aexample
Any example repositories I put together should turn up with a user:KodrAus topic:example
GitHub search query.
Take another look at supporting simple replacements for serde::Serialize
values. They can just be spliced in line.
This means json_str
will depend on serde
, but that's not the end of the world.
This kind of thing will be important for building json strings that aren't purely constant data.
This is giving a slice error, so there's an issue parsing empty strings.
It doesn't really need to be there. We can just run it locally so CI doesn't break.
Make sure strings like "\""
are supported. Right now I suspect that will break the sanitiser because it'll hit the first "
and not realise it's escaped within the string.
cargo new --bin json-str-test
cd json-str-test
echo 'json_str = "*"' >> Cargo.toml
// main.rs
#[macro_use]
extern crate json_str;
fn main() {
println!("Hello, world!");
}
cargo run
# Compiling json-str-test v0.1.0 (file:///Users/mange/tmp/json-str-test)
# Finished debug [unoptimized + debuginfo] target(s) in 0.10 secs
# Running `target/debug/json-str-test`
# Hello, world!
rustup run stable ./target/debug/json-str-test
# Hello, world!
./target/debug/json-str-test
# dyld: Library not loaded: @rpath/libstd-f5a209a9.dylib
# Referenced from: /Users/mange/tmp/json-str-test/./target/debug/json-str-test
# Reason: image not found
# zsh: trace trap ./target/debug/json-str-test
Removing the extern crate json_str
, this problem does not appear.
> otool -L ./target/debug/json-str-test
./target/debug/json-str-test:
/Users/mange/tmp/json-str-test/target/debug/deps/libjson_str-01e27c904eba6a7a.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libstd-f5a209a9.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
> uname -a
Darwin Naiad.local 14.5.0 Darwin Kernel Version 14.5.0: Sun Sep 25 22:07:15 PDT 2016; root:xnu-2782.50.9~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,3 Darwin
> rustc --version
rustc 1.14.0 (e8a012324 2016-12-16)
> rustup show
Default host: x86_64-apple-darwin
installed toolchains
--------------------
stable-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin
active toolchain
----------------
stable-x86_64-apple-darwin (default)
rustc 1.14.0 (e8a012324 2016-12-16)
> cargo --version
cargo 0.15.0-nightly (298a012 2016-12-20)
> cat Cargo.lock
[root]
name = "json-str-test"
version = "0.1.0"
dependencies = [
"json_str 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "json_str"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum json_str 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "73d699063dfc2ee05f524a9dc49a77906e675c90580f4b7551545328ed14b961"
Is there anything else I can help you with? Is there something I need to do? It feels like I should be able to run the built executable without having a Rust ecosystem installed.
This happens in release mode too.
Token
has moved, this should be a simple fix.
On nightly, add a new method that returns b"json"
so there's static bytes to borrow.
This library is using a kind of home-grown sanitising parser. That was ok when it was simple but it's getting a bit more complex now.
For future maintainability, and potential performance improvements, we should replace the parser with something like nom
.
The current json_fn
impl on nightly
could be much clearer. The various bits could be split into separate methods so it's more obvious what's going on.
There could also be a way to parse just the set of closure arguments using the Parser
instead of doing it manually.
The cheese has been shifted so this library needs to be updated. See: https://doc.rust-lang.org/book/compiler-plugins.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.