|  | // Copyright 2020 The Fuchsia Authors. All rights reserved. | 
|  | // Use of this source code is governed by a BSD-style license that can be | 
|  | // found in the LICENSE file. | 
|  | // [START library-overview] | 
|  | /// Library containing example FIDL used throughout the Fuchsia documentation. | 
|  | library fuchsia.examples.docs; | 
|  | // [END library-overview] | 
|  |  | 
|  | using fuchsia.mem; | 
|  | using zx; | 
|  |  | 
|  | // [START primitive-alias] | 
|  | alias vaddr = uint64; | 
|  | // [END primitive-alias] | 
|  |  | 
|  | // [START constants] | 
|  | const MAX_NAMES uint64 = 32; | 
|  | // [END constants] | 
|  |  | 
|  | // [START good-docs] | 
|  | /// A representation of violins displayed on the screen. | 
|  | type Widget = struct { | 
|  | /// A monotonically increasing id, uniquely identifying the widget. | 
|  | id uint64; | 
|  | /// Location of the top left corner of the widget. | 
|  | location Point; | 
|  | }; | 
|  | // [END good-docs] | 
|  |  | 
|  | protocol Node {}; | 
|  |  | 
|  | // [START good-docs-2] | 
|  | /// An abstract representation of a [`fuchsia.io/Node`] whose layout is flat. | 
|  | protocol File { | 
|  | compose Node; | 
|  |  | 
|  | /// Acquires a [`fuchsia.mem/Buffer`] representing this file, if | 
|  | /// there is one, with the requested access rights. | 
|  | /// | 
|  | /// ## Rights | 
|  | /// | 
|  | /// This method requires the following rights: | 
|  | /// | 
|  | /// * [`fuchsia.io/OPEN_RIGHT_WRITABLE`] if `flags` includes | 
|  | ///   [`fuchsia.io/VMO_FLAG_WRITE`]. | 
|  | /// * [`fuchsia.io/OPEN_RIGHT_READABLE`] if `flags` includes | 
|  | ///   [`fuchsia.io/VMO_FLAG_READ`] or [`fuchsia.io/VMO_FLAG_EXEC`]. | 
|  | /// | 
|  | /// + request `flags` a bit field composing any of | 
|  | ///     `VMO_FLAG_READ`, `VMO_FLAG_WRITE`, or `VMO_FLAG_EXEC`. | 
|  | /// - response `buffer` the requested `fuchsia.mem/Buffer`, or | 
|  | ///     null if there was an error, or the buffer does not exist. | 
|  | /// * error a zx_status value indicating success or failure. | 
|  | /// * see [`fuchsia.mem/Buffer`] | 
|  | /// [`fuchsia.mem/Buffer`]: | 
|  | ///    https://fuchsia.googlesource.com/fuchsia/+/HEAD/sdk/fidl/fuchsia.io/ | 
|  | GetBuffer(struct { | 
|  | flags uint32; | 
|  | }) -> (resource struct { | 
|  | buffer box<fuchsia.mem.Buffer>; | 
|  | }) error zx.status; | 
|  | }; | 
|  | // [END good-docs-2] | 
|  |  | 
|  | // [START comments-combined] | 
|  | /// A widget displaying violins on the screen. | 
|  | // TODO -- widgets should use UUIDs instead of sequential ids | 
|  | type ViolinWidget = struct { | 
|  | /// A monotonically increasing id, uniquely identifying the widget. | 
|  | id uint64; | 
|  | /// Location of the top left corner of the widget. | 
|  | location Point; | 
|  | }; | 
|  | // [END comments-combined] |