1
1
mirror of https://github.com/tweag/nickel.git synced 2024-09-20 16:08:14 +03:00

Implment Into<String> for Ident

This commit is contained in:
Yannik Sander 2021-11-08 17:06:18 +01:00
parent 2653a69fff
commit 3f87e3052f

View File

@ -4,8 +4,9 @@ use std::{fmt, hash::Hash};
use crate::position::TermPos;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Ident(pub String, #[serde(skip)] pub Option<TermPos>);
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(into = "String", from = "String")]
pub struct Ident(pub String, pub Option<TermPos>);
impl PartialOrd for Ident {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
@ -48,3 +49,9 @@ where
Ident(String::from(val), None)
}
}
impl Into<String> for Ident {
fn into(self) -> String {
self.0
}
}