Commit 13b1751d authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

zb: rename ProxyBuilder::new -> new_bare



We are going to re-introduce new() for the higher-level proxies
Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
parent 0ea7918a
......@@ -75,7 +75,7 @@ async fn run() -> Result<()> {
let conn = conn.clone();
async move {
let location: AsyncLocationProxy<'_> = ProxyBuilder::new(&conn).path(new)?.build();
let location: AsyncLocationProxy<'_> = ProxyBuilder::new_bare(&conn).path(new)?.build();
println!(
"Latitude: {}\nLongitude: {}",
location.latitude().await?,
......@@ -158,7 +158,7 @@ example again to receive multiple signals on different proxies:
// Everything else remains the same before this point.
client.set_desktop_id("org.freedesktop.zbus").await?;
let props: zbus::fdo::AsyncPropertiesProxy<'_> = zbus::azync::ProxyBuilder::new(&conn)
let props: zbus::fdo::AsyncPropertiesProxy<'_> = zbus::azync::ProxyBuilder::new_bare(&conn)
.destination("org.freedesktop.GeoClue2")
.path(client.path())?
.build();
......@@ -178,7 +178,7 @@ example again to receive multiple signals on different proxies:
let conn = conn.clone();
async move {
let location: AsyncLocationProxy<'_> = ProxyBuilder::new(&conn.clone().into())
let location: AsyncLocationProxy<'_> = ProxyBuilder::new_bare(&conn.clone().into())
.path(new)?
.build();
println!(
......
......@@ -261,7 +261,7 @@ client.set_desktop_id("org.freedesktop.zbus").unwrap();
client
.connect_location_updated(move |_old, new| {
let location: LocationProxy<'_> = ProxyBuilder::new(&conn.clone().into())
let location: LocationProxy<'_> = ProxyBuilder::new_bare(&conn.clone().into())
.path(new.as_str())?
.build();
println!(
......@@ -336,7 +336,7 @@ actually getting set:
let conn_clone = conn.clone();
client.connect_location_updated(move |_old, new| {
let location: LocationProxy<'_> = ProxyBuilder::new(&conn_clone.clone().into())
let location: LocationProxy<'_> = ProxyBuilder::new_bare(&conn_clone.clone().into())
.destination("org.freedesktop.GeoClue2")
.path(new.as_str())?
.build();
......@@ -349,7 +349,7 @@ client.connect_location_updated(move |_old, new| {
Ok(())
}).unwrap();
let props: zbus::fdo::PropertiesProxy<'_> = ProxyBuilder::new(&conn.clone().into())
let props: zbus::fdo::PropertiesProxy<'_> = ProxyBuilder::new_bare(&conn.clone().into())
.destination("org.freedesktop.GeoClue2")
.path(client.path()).unwrap()
.build();
......
......@@ -137,7 +137,7 @@ pub struct ProxyBuilder<'a, T = ()> {
impl<'a> ProxyBuilder<'a> {
/// Create a new [`ProxyBuilder`] for the given connection.
pub fn new(conn: &Connection) -> Self {
pub fn new_bare(conn: &Connection) -> Self {
Self {
conn: conn.clone(),
destination: None,
......@@ -229,7 +229,7 @@ impl<'a> Proxy<'a> {
where
Error: From<E>,
{
Ok(ProxyBuilder::new(conn)
Ok(ProxyBuilder::new_bare(conn)
.destination(destination)
.path(path)?
.interface(interface)
......@@ -247,7 +247,7 @@ impl<'a> Proxy<'a> {
where
Error: From<E>,
{
Ok(ProxyBuilder::new(&conn)
Ok(ProxyBuilder::new_bare(&conn)
.destination(destination)
.path(path)?
.interface(interface)
......@@ -278,7 +278,7 @@ impl<'a> Proxy<'a> {
///
/// See the [xml](xml/index.html) module for parsing the result.
pub async fn introspect(&self) -> fdo::Result<String> {
let proxy: AsyncIntrospectableProxy<'_> = ProxyBuilder::new(&self.inner.conn)
let proxy: AsyncIntrospectableProxy<'_> = ProxyBuilder::new_bare(&self.inner.conn)
.destination(self.inner.destination.as_ref())
.path(&self.inner.path)?
.build();
......@@ -293,7 +293,7 @@ impl<'a> Proxy<'a> {
where
T: TryFrom<OwnedValue>,
{
let proxy: AsyncPropertiesProxy<'_> = ProxyBuilder::new(&self.inner.conn)
let proxy: AsyncPropertiesProxy<'_> = ProxyBuilder::new_bare(&self.inner.conn)
.destination(self.inner.destination.as_ref())
.path(&self.inner.path)?
.build();
......@@ -312,7 +312,7 @@ impl<'a> Proxy<'a> {
where
T: Into<Value<'t>>,
{
let proxy: AsyncPropertiesProxy<'_> = ProxyBuilder::new(&self.inner.conn)
let proxy: AsyncPropertiesProxy<'_> = ProxyBuilder::new_bare(&self.inner.conn)
.destination(self.inner.destination.as_ref())
.path(&self.inner.path)?
.build();
......@@ -704,7 +704,7 @@ mod tests {
async fn test_builder() -> Result<()> {
let conn = Connection::new_session().await?;
let builder = ProxyBuilder::new(&conn)
let builder = ProxyBuilder::new_bare(&conn)
.destination("org.freedesktop.DBus")
.path("/some/path")?
.interface("org.freedesktop.Interface");
......
......@@ -606,7 +606,7 @@ mod tests {
) -> zbus::Result<(OwnedValue, OwnedObjectPath)>;
}
let proxy: SecretProxy<'_> = zbus::azync::ProxyBuilder::new(&conn.clone().into())
let proxy: SecretProxy<'_> = zbus::azync::ProxyBuilder::new_bare(&conn.clone().into())
.destination(&service_name)
.path("/org/freedesktop/secrets")
.unwrap()
......
......@@ -707,15 +707,16 @@ mod tests {
fn my_iface_test(tx: Sender<()>) -> std::result::Result<u32, Box<dyn Error>> {
let conn = Connection::new_session()?;
let proxy: MyIfaceProxy<'_> = ProxyBuilder::new(&conn.clone().into())
let proxy: MyIfaceProxy<'_> = ProxyBuilder::new_bare(&conn.clone().into())
.destination("org.freedesktop.MyService")
.path("/org/freedesktop/MyService")?
.build();
let props_proxy: zbus::fdo::PropertiesProxy<'_> = ProxyBuilder::new(&conn.clone().into())
.destination("org.freedesktop.MyService")
.path("/org/freedesktop/MyService")?
.build();
let props_proxy: zbus::fdo::PropertiesProxy<'_> =
ProxyBuilder::new_bare(&conn.clone().into())
.destination("org.freedesktop.MyService")
.path("/org/freedesktop/MyService")?
.build();
props_proxy
.connect_properties_changed(|_, changed, _| {
......@@ -774,7 +775,7 @@ mod tests {
let val = proxy.ping()?;
proxy.create_obj("MyObj")?;
let my_obj_proxy: MyIfaceProxy<'_> = ProxyBuilder::new(&conn.clone().into())
let my_obj_proxy: MyIfaceProxy<'_> = ProxyBuilder::new_bare(&conn.clone().into())
.destination("org.freedesktop.MyService")
.path("/zbus/test/MyObj")?
.build();
......
......@@ -172,7 +172,7 @@ mod tests {
let conn = Connection::new_session()?;
let mut receiver = SignalReceiver::new(conn.clone());
let proxy1: MultiSignalProxy<'_> = ProxyBuilder::new(&conn.clone().into())
let proxy1: MultiSignalProxy<'_> = ProxyBuilder::new_bare(&conn.clone().into())
.destination("org.freedesktop.zbus.MultiSignal")
.path("/org/freedesktop/zbus/MultiSignal/1")?
.build();
......@@ -185,7 +185,7 @@ mod tests {
})?;
receiver.receive_for(&proxy1)?;
let proxy2: MultiSignalProxy<'_> = ProxyBuilder::new(&conn.clone().into())
let proxy2: MultiSignalProxy<'_> = ProxyBuilder::new_bare(&conn.clone().into())
.destination("org.freedesktop.zbus.MultiSignal")
.path("/org/freedesktop/zbus/MultiSignal/2")?
.build();
......
......@@ -148,7 +148,7 @@ pub fn create_proxy(args: &[NestedMeta], input: &ItemTrait, azync: bool) -> Toke
/// Creates a new proxy with the default service & path.
pub fn new(conn: &#connection) -> Self {
let conn = &conn.clone().into();
::#zbus::azync::ProxyBuilder::new(conn).build()
::#zbus::azync::ProxyBuilder::new_bare(conn).build()
}
/// Consumes `self`, returning the underlying `zbus::Proxy`.
......@@ -264,7 +264,7 @@ fn gen_proxy_method_call(
&(#(#args),*),
)
#wait?;
let proxy: #proxy<'_> = ::#zbus::azync::ProxyBuilder::new(&self.0.connection().clone().into())
let proxy: #proxy<'_> = ::#zbus::azync::ProxyBuilder::new_bare(&self.0.connection().clone().into())
.path(object_path)?
.build();
Ok(proxy)
......
......@@ -20,7 +20,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let input_src;
let proxy = |conn: zbus::Connection, service, path| {
zbus::azync::ProxyBuilder::new(&conn.into())
zbus::azync::ProxyBuilder::new_bare(&conn.into())
.destination(service)
.path(path)
.expect("invalid path")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment