mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-25 03:27:56 +00:00
@@ -27,6 +27,8 @@ use std::path;
|
||||
use core::str;
|
||||
#[cfg(feature = "std")]
|
||||
use std::ffi::CString;
|
||||
#[cfg(all(feature = "std", feature="unstable"))]
|
||||
use std::ffi::CStr;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::rc::Rc;
|
||||
@@ -300,6 +302,16 @@ impl Deserialize for String {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(all(feature = "std", feature="unstable"))]
|
||||
impl Deserialize for Box<CStr> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer
|
||||
{
|
||||
let s = try!(CString::deserialize(deserializer));
|
||||
Ok(s.into_boxed_c_str())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Deserialize for CString {
|
||||
fn deserialize<D>(deserializer: D) -> Result<CString, D::Error>
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@
|
||||
|
||||
#![doc(html_root_url="https://docs.serde.rs")]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(feature = "unstable", feature(inclusive_range, nonzero, specialization, zero_one))]
|
||||
#![cfg_attr(feature = "unstable", feature(inclusive_range, nonzero, specialization, zero_one, into_boxed_c_str))]
|
||||
#![cfg_attr(feature = "alloc", feature(alloc))]
|
||||
#![cfg_attr(feature = "collections", feature(collections))]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(linkedlist, type_complexity, doc_markdown))]
|
||||
|
||||
Reference in New Issue
Block a user