mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 05:51:01 +00:00
Remove the syntex example
This commit is contained in:
@@ -19,8 +19,6 @@ script:
|
|||||||
- (cd testing && travis-cargo --only nightly test -- --features unstable-testing)
|
- (cd testing && travis-cargo --only nightly test -- --features unstable-testing)
|
||||||
- (cd serde_derive && travis-cargo --only nightly test)
|
- (cd serde_derive && travis-cargo --only nightly test)
|
||||||
- (cd serde_derive/no-std-tests && travis-cargo --only nightly build)
|
- (cd serde_derive/no-std-tests && travis-cargo --only nightly build)
|
||||||
#- (cd examples/serde-syntex-example && travis-cargo --skip nightly run)
|
|
||||||
#- (cd examples/serde-syntex-example && travis-cargo --only nightly run -- --no-default-features --features unstable)
|
|
||||||
- (cd serde && travis-cargo --only stable doc)
|
- (cd serde && travis-cargo --only stable doc)
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
target
|
|
||||||
Cargo.lock
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "serde-syntex-example"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
|
|
||||||
build = "build.rs"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["serde_codegen"]
|
|
||||||
unstable = ["serde_derive"]
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
serde_codegen = { version = "^0.8", optional = true, path = "../../serde_codegen" }
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
serde = "^0.8"
|
|
||||||
serde_derive = { version = "^0.8", optional = true, path = "../../serde_derive" }
|
|
||||||
serde_json = "^0.8"
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
This example demonstrates how to use Serde with Syntex. On stable or nightly
|
|
||||||
with Syntex, it can be built with:
|
|
||||||
|
|
||||||
```
|
|
||||||
% rustup run stable cargo run
|
|
||||||
Running `target/debug/serde-syntex-example`
|
|
||||||
{"x":1,"y":2}
|
|
||||||
Point { x: 1, y: 2 }
|
|
||||||
|
|
||||||
% rustup run nightly cargo run
|
|
||||||
Running `target/debug/serde-syntex-example`
|
|
||||||
{"x":1,"y":2}
|
|
||||||
Point { x: 1, y: 2 }
|
|
||||||
```
|
|
||||||
|
|
||||||
On nightly, it can use a plugin with:
|
|
||||||
|
|
||||||
```
|
|
||||||
% rustup run nightly cargo run --features unstable --no-default-features
|
|
||||||
```
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#[cfg(not(feature = "serde_derive"))]
|
|
||||||
mod inner {
|
|
||||||
extern crate serde_codegen;
|
|
||||||
|
|
||||||
use std::env;
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
|
||||||
|
|
||||||
let src = Path::new("src/main.rs.in");
|
|
||||||
let dst = Path::new(&out_dir).join("main.rs");
|
|
||||||
|
|
||||||
serde_codegen::expand(&src, &dst).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "serde_derive")]
|
|
||||||
mod inner {
|
|
||||||
pub fn main() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
inner::main();
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#[cfg(feature = "serde_derive")]
|
|
||||||
#[macro_use]
|
|
||||||
extern crate serde_derive;
|
|
||||||
|
|
||||||
extern crate serde;
|
|
||||||
extern crate serde_json;
|
|
||||||
|
|
||||||
#[cfg(feature = "serde_derive")]
|
|
||||||
include!("main.rs.in");
|
|
||||||
|
|
||||||
#[cfg(not(feature = "serde_derive"))]
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/main.rs"));
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#[derive(Serialize, Deserialize, Debug)]
|
|
||||||
struct Point {
|
|
||||||
x: i32,
|
|
||||||
y: i32,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let point = Point { x: 1, y: 2 };
|
|
||||||
let serialized = serde_json::to_string(&point).unwrap();
|
|
||||||
|
|
||||||
println!("{}", serialized);
|
|
||||||
|
|
||||||
let deserialized: Point = serde_json::from_str(&serialized).unwrap();
|
|
||||||
|
|
||||||
println!("{:?}", deserialized);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user