aboutsummaryrefslogtreecommitdiff
path: root/server/src/helper/node_id.rs
blob: f891d62c1c2767453b4fd2fb1a4966950540142e (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) 2025 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)
    }
}