wrap method

InterfaceHandle<T> wrap (T impl)

Implementation

InterfaceHandle<T> wrap(T impl) {
  if (!isUnbound) {
    throw FidlStateException("AsyncBinding<${$interfaceName}> isn't unbound");
  }
  ChannelPair pair = ChannelPair();
  if (pair.status != ZX.OK) {
    throw Exception(
        "AsyncBinding<${$interfaceName}> couldn't create channel: ${getStringForStatus(pair.status)}");
  }
  _impl = impl;
  _reader.bind(pair.first!);

  state = InterfaceState.bound;

  return InterfaceHandle<T>(pair.second);
}