Trait swipl::blob::CloneBlobImpl

source ·
pub trait CloneBlobImpl: CloneBlobBase + Sized + Sync + Clone {
    // Provided methods
    fn compare(&self, _other: &Self) -> Ordering { ... }
    fn write(&self, stream: &mut PrologStream) -> Result<()> { ... }
}
Expand description

Supertype of CloneBlob that allows implementation of compare and write.

When defining a CloneBlob through the clone_blob! attribute macro without the ‘defaults’ argument, you’re required to implement this trait for your type. This allows you to modify how comparison and writing will happen.

Provided Methods§

source

fn compare(&self, _other: &Self) -> Ordering

Compare two values, returning an Ordering.

This is used from SWI-Prolog when sorting lists. The default implementation returns Ordering::Equal, effectively providing no sorting information.

source

fn write(&self, stream: &mut PrologStream) -> Result<()>

Write a description of this ArcBlob.

The given stream implements Write, and therefore can be used with the write! macro.

The normal way of implementing this is to print something like "<blob_name ..blob_data..>". The default implementation simply prints "<blob_name>".

Object Safety§

This trait is not object safe.

Implementors§