1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2025-04-11 12:24:05 +00:00

removed changed from SessionInner actix/actix-web#943

This commit is contained in:
Jens Metzner 2019-06-26 11:08:53 +02:00
parent c0c71f82c0
commit 9f8b85f98f

View file

@ -101,7 +101,6 @@ impl UserSession for ServiceRequest {
#[derive(Default)]
struct SessionInner {
state: HashMap<String, String>,
changed: bool,
}
impl Session {
@ -117,7 +116,6 @@ impl Session {
/// Set a `value` from the session.
pub fn set<T: Serialize>(&self, key: &str, value: T) -> Result<(), Error> {
let mut inner = self.0.borrow_mut();
inner.changed = true;
inner
.state
.insert(key.to_owned(), serde_json::to_string(&value)?);
@ -127,14 +125,12 @@ impl Session {
/// Remove value from the session.
pub fn remove(&self, key: &str) {
let mut inner = self.0.borrow_mut();
inner.changed = true;
inner.state.remove(key);
}
/// Clear the session.
pub fn clear(&self) {
let mut inner = self.0.borrow_mut();
inner.changed = true;
inner.state.clear()
}