5 min read

Examples

Discover the Slice syntax through a few examples.

This page offers a quick overview of the Slice syntax through examples.

slice
module Example
interface Widget {
spin(count: int32)
}
// An interface can extend one or more other interfaces
interface Gizmo : Widget {
walk(direction: Direction)
}
slice
module Example
interface Dns {
resolveName(name: string) -> Sequence<IPAddress>
}
interface Census {
getCityPopulation(state: string) -> Dictionary<string, int32>
}
slice
[cs::namespace("AttributeExample")]
module Example
[cs::identifier("WorldAtlas")]
interface Atlas {
getMainCities(country: string) -> [cs::type("HashSet<string>")] Sequence<string>
}
[cs::readonly]
compact struct Point { x: int32, y: int32 }

Was this page helpful?