Skip to content

Commit 1851aa0

Browse files
authored
Merge pull request #181 from jsturtevant/update-client-api
Add new api for creating client
2 parents ebbb58e + 6639bca commit 1851aa0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/sync/client.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,25 @@ impl Client {
5050

5151
#[cfg(unix)]
5252
/// Initialize a new [`Client`] from raw file descriptor.
53+
#[deprecated(since="0.8.0", note="please use `new_from_fd` instead")]
5354
pub fn new(fd: RawFd) -> Client {
5455
let conn = ClientConnection::new(fd);
5556

56-
// TODO: upgrade the API of Client::new and remove this panic for the major version release
5757
Self::new_client(conn).unwrap_or_else(|e| {
5858
panic!(
5959
"client was not successfully initialized: {}", e
6060
)
6161
})
6262
}
6363

64+
#[cfg(unix)]
65+
/// Initialize a new [`Client`] from raw file descriptor.
66+
pub fn new_from_fd(fd: RawFd) -> Result<Client> {
67+
let conn = ClientConnection::new(fd);
68+
69+
Self::new_client(conn)
70+
}
71+
6472
fn new_client(pipe_client: ClientConnection) -> Result<Client> {
6573
let client = Arc::new(pipe_client);
6674

0 commit comments

Comments
 (0)