pub struct NetworkProfile {
pub name: String,
pub rpc_url: String,
pub network_passphrase: String,
pub friendbot_url: Option<String>,
pub description: Option<String>,
}Expand description
A named network profile with RPC endpoint and network passphrase.
Fields§
§name: StringHuman-readable name for this profile
rpc_url: StringRPC endpoint URL
network_passphrase: StringNetwork passphrase (e.g., “Test SDF Network ; September 2015”)
friendbot_url: Option<String>Optional: default friendbot URL for test networks
description: Option<String>Optional: description or notes
Implementations§
Source§impl NetworkProfile
impl NetworkProfile
Sourcepub fn new(
name: impl Into<String>,
rpc_url: impl Into<String>,
network_passphrase: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, rpc_url: impl Into<String>, network_passphrase: impl Into<String>, ) -> Self
Create a new network profile.
Sourcepub fn with_friendbot(self, url: impl Into<String>) -> Self
pub fn with_friendbot(self, url: impl Into<String>) -> Self
Set the friendbot URL.
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Set the description.
Sourcepub fn validate(&self) -> Result<(), StorageError>
pub fn validate(&self) -> Result<(), StorageError>
Validate the profile’s required fields.
Returns StorageError::ConfigError if the name or RPC URL is empty,
or if the name contains a path separator (which would break the
on-disk filename). The network passphrase is allowed to be empty only
for local dev networks, but a missing RPC URL is always invalid.
Trait Implementations§
Source§impl Clone for NetworkProfile
impl Clone for NetworkProfile
Source§impl Debug for NetworkProfile
impl Debug for NetworkProfile
Source§impl<'de> Deserialize<'de> for NetworkProfile
impl<'de> Deserialize<'de> for NetworkProfile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for NetworkProfile
impl RefUnwindSafe for NetworkProfile
impl Send for NetworkProfile
impl Sync for NetworkProfile
impl Unpin for NetworkProfile
impl UnsafeUnpin for NetworkProfile
impl UnwindSafe for NetworkProfile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more