// SPDX-License-Identifier: AGPL-3.0-or-later
// There is NO WARRANTY.
-use super::*;
+pub use super::*;
type WRC = WhatResponseToClientOp;
pub struct AbbrevPresentationLayout(pub PresentationLayout);
-impl<'r> FromParam<'r> for AbbrevPresentationLayout {
+/*
+impl<'r> FromParam<'r> for PresentationLayout {
type Error = strum::ParseError;
fn from_param(param: &'r RawStr) -> Result<Self, Self::Error> {
- AbbrevPresentationLayout(param.as_str().parse())
+ param.as_str().parse()
}
}
+*/
impl<'r> FromParam<'r> for AbbrevPresentationLayout {
type Error = ();
type Error = OE;
#[throws(OE)]
fn from_form_value(param: &'r RawStr) -> Self {
- let g = Id::global_tokens(PRIVATE_Y).read().unwrap();
let token = RawTokenVal::from_str(param.as_str());
- let i = g.get(token).ok_or(Id::ERROR)?;
- InstanceAccess { raw_token : token, i : i.clone() }
+ let i = InstanceAccessDetails::from_token(&token);
+ InstanceAccess { raw_token : token, i }
}
}
pub use rocket_contrib::templates::Engines;
pub use rocket_contrib::templates::Template;
-pub use crate::api::{AbbrevPresentationLayout};
-pub use crate::api::{ApiPieceOpError, Lens, TransparentLens};
+pub use crate::api::{AbbrevPresentationLayout, InstanceAccess};
pub use crate::cmdlistener::*;
use rocket::fairing;
// ---------- Player and token functionality ----------
+impl<Id> InstanceAccessDetails<Id>
+ where Id: AccessId, OE: From<Id::Error>
+{
+ #[throws(OE)]
+ pub fn from_token(token: &RawToken) -> InstanceAccessDetails<Id> {
+ let g = Id::global_tokens(PRIVATE_Y).read().unwrap();
+ let i = g.get(token).ok_or(Id::ERROR)?;
+ i.clone()
+ }
+}
+
impl<'ig> InstanceGuard<'ig> {
/// caller is responsible for logging; threading it through
/// proves the caller has a log entry.