aboutsummaryrefslogtreecommitdiff
path: root/server/src/helper/node_id.rs
blob: 5c2e52a9c6b7dd42660f3a00b624fc77f9a88cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2026 metamuffin <metamuffin.org>
*/

use super::A;
use jellycommon::NodeID;
use rocket::request::FromParam;
use std::str::FromStr;

impl<'a> FromParam<'a> for A<NodeID> {
    type Error = ();
    fn from_param(param: &'a str) -> Result<Self, Self::Error> {
        NodeID::from_str(param).map_err(|_| ()).map(A)
    }
}