deleteResource method

void deleteResource({
  1. Timestamp? timestamp,
})

Sends a DELETE through this publisher.

An optional timestamp can be attached to the message; borrowed, not consumed.

Implementation

void deleteResource({Timestamp? timestamp}) {
  _ensureOpen();
  final loaned = bindings.zd_publisher_loan(_ptr.cast());
  final tsPtr = timestamp != null ? _timestampToNative(timestamp) : nullptr;
  try {
    final rc = bindings.zd_publisher_delete(loaned, tsPtr.cast());
    if (rc != 0) {
      throw ZenohException('Publisher delete failed', rc);
    }
  } finally {
    if (tsPtr != nullptr) calloc.free(tsPtr);
  }
}