mirror of
https://codeberg.org/icewind/vdf-reader.git
synced 2026-06-03 10:04:08 +02:00
deref mut
This commit is contained in:
parent
ebb940847d
commit
31977b9340
2 changed files with 14 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ use serde::de::{DeserializeSeed, MapAccess};
|
|||
use serde::{Deserialize, Serialize, Serializer};
|
||||
use std::collections::hash_map;
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
/// A table of entries.
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
|
||||
|
|
@ -110,6 +110,12 @@ impl Deref for Table {
|
|||
}
|
||||
}
|
||||
|
||||
impl DerefMut for Table {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct TableSeq {
|
||||
iter: hash_map::IntoIter<String, Entry>,
|
||||
next_item: Option<Entry>,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use serde::de::{Error, Visitor};
|
|||
use serde::{Deserialize, Deserializer, Serialize};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Formatter;
|
||||
use std::ops::Deref;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize)]
|
||||
#[serde(transparent)]
|
||||
|
|
@ -55,6 +55,12 @@ impl Deref for Value {
|
|||
}
|
||||
}
|
||||
|
||||
impl DerefMut for Value {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Value {
|
||||
/// Try to convert the entry to the given type.
|
||||
pub fn to<T: ParseItem>(self) -> Result<T, ParseStringError> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue