zoe_client/frb_api/
for_std.rs1use flutter_rust_bridge::frb;
2use std::net::SocketAddr;
3
4#[frb]
6pub fn create_socket_addr(ip: String, port: u16) -> Result<SocketAddr, String> {
7 format!("{}:{}", ip, port)
8 .parse()
9 .map_err(|e| format!("Invalid socket address: {}", e))
10}
11
12#[frb]
13pub fn socket_addr_to_string(addr: &SocketAddr) -> String {
14 addr.to_string()
15}
16
17#[frb]
18pub fn socket_addr_ip(addr: &SocketAddr) -> String {
19 addr.ip().to_string()
20}
21
22#[frb]
23pub fn socket_addr_port(addr: &SocketAddr) -> u16 {
24 addr.port()
25}