fix API typing to match original implementation

Summary:
Cleanup Rust APIs and underlying Cxx FFI helpers to be more correct

- most u32 values are not valid ports (u16), end-user API must make it hard/impossible to pass garbage values

- fix other parameters that were i32 and should have been u32/u64 (+ reliance on implicit conversions on the Cxx side)

- update all users + sfcli Rust template

Reviewed By: dtolnay

Differential Revision: D28395107

fbshipit-source-id: 699253b04cfa03e3684bbd253116406fc658ed97
This commit is contained in:
Dan Forest 2021-05-19 18:47:38 -07:00 committed by Facebook GitHub Bot
parent 61865663ed
commit d8d78e7878

View File

@ -163,7 +163,7 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
let mut builder = ThriftServerBuilder::new(fb)
.with_name(SERVICE_NAME)
.expect("failed to set name")
.with_address(&host, port.into(), false)?
.with_address(&host, port, false)?
.with_tls()
.expect("failed to enable TLS")
.with_cancel_if_client_disconnected();
@ -172,7 +172,7 @@ fn main(fb: FacebookInit) -> Result<(), Error> {
let thrift: ThriftServer = builder.with_factory(exec, move || service).build();
let mut service_framework = ServiceFramework::from_server(SERVICE_NAME, thrift, port as u32)
let mut service_framework = ServiceFramework::from_server(SERVICE_NAME, thrift, port)
.context("Failed to create service framework server")?;
service_framework.add_module(BuildModule)?;