pub struct CfgAddr(AddrInner);
address
only.Expand description
A variation of [general::SocketAddr
] that allows shell expansions in Unix paths.
The string representation for these addresses is the same as for [general::SocketAddr
];
but the shell expansion syntax is the same as for CfgPath
.
Shell expansion is only supported within paths: Even if the user has set ${HOME}
to 127.0.0.1
, the address inet:${HOME}:9999
is a syntax error.
In addition to the “inet:” and “unix:” schemas supported by general::SocketAddr
,
This type also supports a “unix-literal” schema,
to indicate that no shell expansion should occur.
Tuple Fields§
§0: AddrInner
Implementations§
Source§impl CfgAddr
impl CfgAddr
Sourcepub fn new_unix(path: CfgPath) -> Self
pub fn new_unix(path: CfgPath) -> Self
Create a new CfgAddr
that will produce an AF_UNIX
address
corresponding to the provided path.
Note that not all platforms support AF_UNIX addresses; on Windows, notably, expanding this path will produce an error.
Sourcepub fn address(
&self,
path_resolver: &CfgPathResolver,
) -> Result<SocketAddr, CfgAddrError>
pub fn address( &self, path_resolver: &CfgPathResolver, ) -> Result<SocketAddr, CfgAddrError>
Return the [general::SocketAddr
] produced by expanding this CfgAddr
.
Sourcepub fn substitutions_will_apply(&self) -> bool
pub fn substitutions_will_apply(&self) -> bool
Return true if this address is of a type to which variable substitutions will apply.
Currently, substitutions apply to AF_UNIX addresses but not to Inet addresses.
Sourcefn try_to_string(&self) -> Result<String, &PathBuf>
fn try_to_string(&self) -> Result<String, &PathBuf>
Helper: if possible, format this address as a String.
(This will return Err(p) if this path is a literal unix domain socket path that can’t be represented as a string.)