moon/fory Apache Fory · MoonBit

API · struct

Shared

Messages · defined at codec.mbt:293

pub(all) struct Shared[T] {
  key : Int32
  value : T
}

A value that may be written more than once, or that takes part in a cycle.

MoonBit has no identity to infer sharing from — physical_equal is a hint and not a promise — so the key is the caller's, the way Rc is the caller's in Rust: two writes of the same key send the value once and point at it afterwards.

Fields

FieldMeaning
key : Int32

The name the caller gives the value.

value : T

The value itself.

Built in

derives Eq @debug.Debug

pub impl[T : Codec] Codec for Shared[T]

Generated from src/pkg.generated.mbti and the doc comments beside this declaration.