pub fn instantiate_range<I, F>(
        &self,
        min_version: u32,
        max_version: u32,
        implementor: F,
    ) -> Result<I, GlobalError>
    where
        I: Interface + From<Proxy<I>>,
        F: FnOnce(NewProxy<I>) -> I,
    {
        let inner = self.inner.lock().unwrap();
        for &(id, ref interface, version) in &inner.list {
            if interface == I::NAME {
                if version >= min_version {
                    return Ok(self
                        .registry
                        .bind(::std::cmp::min(version, max_version), id, implementor)
                        .unwrap());
                } else {
                    return Err(GlobalError::VersionTooLow(version));
                }
            }
        }
        Err(GlobalError::Missing)
    }
/// Instantiate a global from a version range
///
/// If you want to support several versions of a particular global, this method allows you to
/// specify a range of versions that you accept. It'll bind the highest possible version that
/// is between `min_version` and `max_version` inclusive, and return an error if the highest
/// version supported by the compositor is lower than `min_version`. As for
/// `instantiate_exact`, you should not use `I::VERSION` here: the versions your code support
/// do not change when the protocol files are updated.
///
/// When trying to support several versions of a protocol, you can check which version has
/// actually been used on any object using the `Proxy::version()` method.
///
/// As `instantiate_exact`, it should only be used for singleton globals, for the same reasons.
Instantiate a global from a version range
If you want to support several versions of a particular global, this method allows you to
specify a range of versions that you accept.

When trying to support several versions of a protocol, you can check which version has
actually been used on any object using the `Proxy::version()` method.

As `instantiate_exact`, it should only be used for singleton globals, for the same reasons.
Instantiate a global from a version range If you want to support several versions of a particular global this method allows you to specify a range of versions that you accept . When trying to support several versions of a protocol you can check which version has actually been used on any object using the ` Proxy :: version () ` method . As ` instantiate_exact ` it should only be used for singleton globals for the same reasons .
pub fn instantiate_range<I, F>(
        &self,
        min_version: u32,
        max_version: u32,
        implementor: F,
    ) -> Result<I, GlobalError>
    where
        I: Interface + From<Proxy<I>>,
        F: FnOnce(NewProxy<I>) -> I,
    {
        let inner = self.inner.lock().unwrap();
        for &(id, ref interface, version) in &inner.list {
            if interface == I::NAME {
                if version >= min_version {
                    return Ok(self
                        .registry
                        .bind(::std::cmp::min(version, max_version), id, implementor)
                        .unwrap());
                } else {
                    return Err(GlobalError::VersionTooLow(version));
                }
            }
        }
        Err(GlobalError::Missing)
    }
pub fn instantiate_range < I , F > ( & self , min_version : u32 , max_version : u32 , implementor : F , ) -> Result < I , GlobalError > where I : Interface + From < Proxy < I > > , F : FnOnce ( NewProxy < I > ) -> I , { let inner = self . inner . lock ( ) . unwrap ( ) ; for & ( id , ref interface , version ) in & inner . list { if interface == I :: NAME { if version >= min_version { return Ok ( self . registry . bind ( :: std :: cmp :: min ( version , max_version ) , id , implementor ) . unwrap ( ) ) ; } else { return Err ( GlobalError :: VersionTooLow ( version ) ) ; } } } Err ( GlobalError :: Missing ) }
Instantiate a global from a version range
If you want to support several versions of a particular global, this method allows you to
specify a range of versions that you accept.
Instantiate a global from a version range If you want to support several versions of a particular global this method allows you to specify a range of versions that you accept .
&self
min_version
u32
max_version
u32
implementor
F
&self
min_version
u32
max_version
u32
implementor
F