dynamo_llm/local_model/
network_name.rs

1// SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::discovery::MODEL_ROOT_PATH;
5
6#[derive(Debug, Clone)]
7pub struct ModelNetworkName(String);
8
9impl ModelNetworkName {
10    pub fn new() -> Self {
11        ModelNetworkName(format!("{MODEL_ROOT_PATH}/{}", uuid::Uuid::new_v4()))
12    }
13}
14
15impl Default for ModelNetworkName {
16    fn default() -> Self {
17        Self::new()
18    }
19}
20
21impl std::fmt::Display for ModelNetworkName {
22    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23        write!(f, "{}", self.0)
24    }
25}
26
27impl AsRef<str> for ModelNetworkName {
28    fn as_ref(&self) -> &str {
29        &self.0
30    }
31}
32
33impl std::ops::Deref for ModelNetworkName {
34    type Target = str;
35    fn deref(&self) -> &Self::Target {
36        &self.0
37    }
38}