diff --git a/Makefile b/Makefile index 13ef4776d7..85e2dfa7ba 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,8 @@ MKDOCS := $(shell pwd)/$(VENV_DIR)/bin/mkdocs MAKO_SRC = src/mako RUST_SRC = src/rust +PREPROC_DIR = $(RUST_SRC)/preproc +PREPROC = target/release/preproc API_DEPS_TPL = $(MAKO_SRC)/deps.mako API_DEPS = .api.deps CLI_DEPS = .cli.deps @@ -36,8 +38,8 @@ endif API_JSON_FILES = $(shell find etc -type f -name '*-api.json') MAKO_LIB_DIR = $(MAKO_SRC)/lib MAKO_LIB_FILES = $(shell find $(MAKO_LIB_DIR) -type f -name '*.*') -MAKO = export PYTHONPATH=$(MAKO_LIB_DIR):$(PYTHONPATH); $(TPL) --template-dir '.' -MAKO_STANDARD_DEPENDENCIES = $(API_SHARED_INFO) $(MAKO_LIB_FILES) $(MAKO_RENDER) +MAKO = PREPROC=$(PREPROC) PYTHONPATH=$(MAKO_LIB_DIR):$(PYTHONPATH) $(TPL) --template-dir '.' +MAKO_STANDARD_DEPENDENCIES = $(API_SHARED_INFO) $(MAKO_LIB_FILES) $(MAKO_RENDER) $(PREPROC) help: $(info using template engine: '$(MAKO_RENDER)') @@ -58,6 +60,9 @@ help: $(info test - run all tests) $(info help - print this help) +$(PREPROC): $(PREPROC_DIR)/src/main.rs + cd "$(PREPROC_DIR)" && cargo build --release + $(VENV_BIN): wget -nv https://pypi.python.org/packages/source/v/virtualenv/virtualenv-$(VIRTUALENV_VERSION).tar.gz -O virtualenv-$(VIRTUALENV_VERSION).tar.gz tar -xzf virtualenv-$(VIRTUALENV_VERSION).tar.gz && mv virtualenv-$(VIRTUALENV_VERSION) ./.virtualenv && rm -f virtualenv-$(VIRTUALENV_VERSION).tar.gz diff --git a/gen/chat1/src/lib.rs b/gen/chat1/src/lib.rs index 18ec8a5433..92089683fb 100644 --- a/gen/chat1/src/lib.rs +++ b/gen/chat1/src/lib.rs @@ -731,9 +731,11 @@ impl Part for KeyValue {} /// empty messages in your APIs. A typical example is to use it as the request /// or the response type of an API method. For instance: /// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } +/// ````text +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// ```` /// /// The JSON representation for `Empty` is empty JSON object `{}`. /// @@ -743,7 +745,6 @@ impl Part for KeyValue {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [messages delete spaces](struct.SpaceMessageDeleteCall.html) (response) -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Empty { _never_set: Option } @@ -864,12 +865,14 @@ impl ResponseResult for ListMembershipsResponse {} /// Annotations associated with the plain-text body of the message. /// /// Example plain-text message body: -/// ``` +/// +/// ````text /// Hello @FooBot how are you!" -/// ``` +/// ```` /// /// The corresponding annotations metadata: -/// ``` +/// +/// ````text /// "annotations":[{ /// "type":"USER_MENTION", /// "startIndex":6, @@ -884,10 +887,9 @@ impl ResponseResult for ListMembershipsResponse {} /// "type":"MENTION" /// } /// }] -/// ``` +/// ```` /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Annotation { /// The metadata of user mention. diff --git a/gen/sheets4/src/lib.rs b/gen/sheets4/src/lib.rs index 976d73011b..665911a52c 100644 --- a/gen/sheets4/src/lib.rs +++ b/gen/sheets4/src/lib.rs @@ -515,32 +515,36 @@ impl Part for Editors {} /// be less than HistogramRule.end. For example, a pivot table showing /// average purchase amount by age that has 50+ rows: /// -/// +-----+-------------------+ -/// | Age | AVERAGE of Amount | -/// +-----+-------------------+ -/// | 16 | $27.13 | -/// | 17 | $5.24 | -/// | 18 | $20.15 | -/// ... -/// +-----+-------------------+ +/// ````text +/// +-----+-------------------+ +/// | Age | AVERAGE of Amount | +/// +-----+-------------------+ +/// | 16 | $27.13 | +/// | 17 | $5.24 | +/// | 18 | $20.15 | +/// ... +/// +-----+-------------------+ +/// ```` +/// /// could be turned into a pivot table that looks like the one below by /// applying a histogram group rule with a HistogramRule.start of 25, /// an HistogramRule.interval of 20, and an HistogramRule.end /// of 65. /// -/// +-------------+-------------------+ -/// | Grouped Age | AVERAGE of Amount | -/// +-------------+-------------------+ -/// | < 25 | $19.34 | -/// | 25-45 | $31.43 | -/// | 45-65 | $35.87 | -/// | > 65 | $27.55 | -/// +-------------+-------------------+ -/// | Grand Total | $29.12 | -/// +-------------+-------------------+ +/// ````text +/// +-------------+-------------------+ +/// | Grouped Age | AVERAGE of Amount | +/// +-------------+-------------------+ +/// | < 25 | $19.34 | +/// | 25-45 | $31.43 | +/// | 45-65 | $35.87 | +/// | > 65 | $27.55 | +/// +-------------+-------------------+ +/// | Grand Total | $29.12 | +/// +-------------+-------------------+ +/// ```` /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct HistogramRule { /// The minimum value at which items are placed into buckets @@ -833,31 +837,35 @@ impl Part for BasicChartSpec {} /// buckets with names of your choosing. For example, a pivot table that /// aggregates population by state: /// -/// +-------+-------------------+ -/// | State | SUM of Population | -/// +-------+-------------------+ -/// | AK | 0.7 | -/// | AL | 4.8 | -/// | AR | 2.9 | -/// ... -/// +-------+-------------------+ +/// ````text +/// +-------+-------------------+ +/// | State | SUM of Population | +/// +-------+-------------------+ +/// | AK | 0.7 | +/// | AL | 4.8 | +/// | AR | 2.9 | +/// ... +/// +-------+-------------------+ +/// ```` +/// /// could be turned into a pivot table that aggregates population by time zone /// by providing a list of groups (for example, groupName = 'Central', /// items = ['AL', 'AR', 'IA', ...]) to a manual group rule. /// Note that a similar effect could be achieved by adding a time zone column /// to the source data and adjusting the pivot table. /// -/// +-----------+-------------------+ -/// | Time Zone | SUM of Population | -/// +-----------+-------------------+ -/// | Central | 106.3 | -/// | Eastern | 151.9 | -/// | Mountain | 17.4 | -/// ... -/// +-----------+-------------------+ +/// ````text +/// +-----------+-------------------+ +/// | Time Zone | SUM of Population | +/// +-----------+-------------------+ +/// | Central | 106.3 | +/// | Eastern | 151.9 | +/// | Mountain | 17.4 | +/// ... +/// +-----------+-------------------+ +/// ```` /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManualRule { /// The list of group names and the corresponding items from the source data @@ -2061,22 +2069,15 @@ impl Part for BooleanCondition {} /// /// For example, if `"Sheet1"` is sheet ID 0, then: /// -/// `Sheet1!A1:A1 == sheet_id: 0, -/// start_row_index: 0, end_row_index: 1, -/// start_column_index: 0, end_column_index: 1` +/// `Sheet1!A1:A1 == sheet_id: 0, start_row_index: 0, end_row_index: 1, start_column_index: 0, end_column_index: 1` /// -/// `Sheet1!A3:B4 == sheet_id: 0, -/// start_row_index: 2, end_row_index: 4, -/// start_column_index: 0, end_column_index: 2` +/// `Sheet1!A3:B4 == sheet_id: 0, start_row_index: 2, end_row_index: 4, start_column_index: 0, end_column_index: 2` /// -/// `Sheet1!A:B == sheet_id: 0, -/// start_column_index: 0, end_column_index: 2` +/// `Sheet1!A:B == sheet_id: 0, start_column_index: 0, end_column_index: 2` /// -/// `Sheet1!A5:B == sheet_id: 0, -/// start_row_index: 4, -/// start_column_index: 0, end_column_index: 2` +/// `Sheet1!A5:B == sheet_id: 0, start_row_index: 4, start_column_index: 0, end_column_index: 2` /// -/// `Sheet1 == sheet_id:0` +/// `Sheet1 == sheet_id:0` /// /// The start index must always be less than or equal to the end index. /// If the start index equals the end index, then the range is empty. @@ -2084,7 +2085,6 @@ impl Part for BooleanCondition {} /// UI as `#REF!`. /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GridRange { /// The end row (exclusive) of the range, or not set if unbounded. @@ -3337,28 +3337,32 @@ impl Part for AddProtectedRangeResponse {} /// buckets based on selected parts of their date or time values. For example, /// consider a pivot table showing sales transactions by date: /// -/// +----------+--------------+ -/// | Date | SUM of Sales | -/// +----------+--------------+ -/// | 1/1/2017 | $621.14 | -/// | 2/3/2017 | $708.84 | -/// | 5/8/2017 | $326.84 | -/// ... -/// +----------+--------------+ +/// ````text +/// +----------+--------------+ +/// | Date | SUM of Sales | +/// +----------+--------------+ +/// | 1/1/2017 | $621.14 | +/// | 2/3/2017 | $708.84 | +/// | 5/8/2017 | $326.84 | +/// ... +/// +----------+--------------+ +/// ```` +/// /// Applying a date-time group rule with a DateTimeRuleType of YEAR_MONTH /// results in the following pivot table. /// -/// +--------------+--------------+ -/// | Grouped Date | SUM of Sales | -/// +--------------+--------------+ -/// | 2017-Jan | $53,731.78 | -/// | 2017-Feb | $83,475.32 | -/// | 2017-Mar | $94,385.05 | -/// ... -/// +--------------+--------------+ +/// ````text +/// +--------------+--------------+ +/// | Grouped Date | SUM of Sales | +/// +--------------+--------------+ +/// | 2017-Jan | $53,731.78 | +/// | 2017-Feb | $83,475.32 | +/// | 2017-Mar | $94,385.05 | +/// ... +/// +--------------+--------------+ +/// ```` /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DateTimeRule { /// The type of date-time grouping to apply. @@ -3635,14 +3639,15 @@ pub struct TextRotation { /// characters is unchanged. /// For example: /// - /// | V | - /// | e | - /// | r | - /// | t | - /// | i | - /// | c | - /// | a | - /// | l | + /// ````text + /// | V | + /// | e | + /// | r | + /// | t | + /// | i | + /// | c | + /// | a | + /// | l |```` pub vertical: Option, } @@ -3965,13 +3970,14 @@ pub struct ChartSourceRange { /// /// For example, these are valid configurations: /// - /// domain sources: A1:A5 - /// series1 sources: B1:B5 - /// series2 sources: D6:D10 + /// ````text + /// domain sources: A1:A5 + /// series1 sources: B1:B5 + /// series2 sources: D6:D10 /// - /// domain sources: A1:A5, C10:C12 - /// series1 sources: B1:B5, D10:D12 - /// series2 sources: C1:C5, E10:E12 + /// domain sources: A1:A5, C10:C12 + /// series1 sources: B1:B5, D10:D12 + /// series2 sources: C1:C5, E10:E12```` pub sources: Option>, } @@ -4986,113 +4992,118 @@ impl Part for AddBandingResponse {} /// /// Example (Java): /// -/// import com.google.type.Color; +/// ````text +/// import com.google.type.Color; /// -/// // ... -/// public static java.awt.Color fromProto(Color protocolor) { -/// float alpha = protocolor.hasAlpha() -/// ? protocolor.getAlpha().getValue() -/// : 1.0; +/// // ... +/// public static java.awt.Color fromProto(Color protocolor) { +/// float alpha = protocolor.hasAlpha() +/// ? protocolor.getAlpha().getValue() +/// : 1.0; /// -/// return new java.awt.Color( -/// protocolor.getRed(), -/// protocolor.getGreen(), -/// protocolor.getBlue(), -/// alpha); -/// } +/// return new java.awt.Color( +/// protocolor.getRed(), +/// protocolor.getGreen(), +/// protocolor.getBlue(), +/// alpha); +/// } /// -/// public static Color toProto(java.awt.Color color) { -/// float red = (float) color.getRed(); -/// float green = (float) color.getGreen(); -/// float blue = (float) color.getBlue(); -/// float denominator = 255.0; -/// Color.Builder resultBuilder = -/// Color -/// .newBuilder() -/// .setRed(red / denominator) -/// .setGreen(green / denominator) -/// .setBlue(blue / denominator); -/// int alpha = color.getAlpha(); -/// if (alpha != 255) { -/// result.setAlpha( -/// FloatValue -/// .newBuilder() -/// .setValue(((float) alpha) / denominator) -/// .build()); -/// } -/// return resultBuilder.build(); -/// } -/// // ... +/// public static Color toProto(java.awt.Color color) { +/// float red = (float) color.getRed(); +/// float green = (float) color.getGreen(); +/// float blue = (float) color.getBlue(); +/// float denominator = 255.0; +/// Color.Builder resultBuilder = +/// Color +/// .newBuilder() +/// .setRed(red / denominator) +/// .setGreen(green / denominator) +/// .setBlue(blue / denominator); +/// int alpha = color.getAlpha(); +/// if (alpha != 255) { +/// result.setAlpha( +/// FloatValue +/// .newBuilder() +/// .setValue(((float) alpha) / denominator) +/// .build()); +/// } +/// return resultBuilder.build(); +/// } +/// // ... +/// ```` /// /// Example (iOS / Obj-C): /// -/// // ... -/// static UIColor* fromProto(Color* protocolor) { -/// float red = [protocolor red]; -/// float green = [protocolor green]; -/// float blue = [protocolor blue]; -/// FloatValue* alpha_wrapper = [protocolor alpha]; -/// float alpha = 1.0; -/// if (alpha_wrapper != nil) { -/// alpha = [alpha_wrapper value]; -/// } -/// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; -/// } -/// -/// static Color* toProto(UIColor* color) { -/// CGFloat red, green, blue, alpha; -/// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { -/// return nil; -/// } -/// Color* result = [[Color alloc] init]; -/// [result setRed:red]; -/// [result setGreen:green]; -/// [result setBlue:blue]; -/// if (alpha <= 0.9999) { -/// [result setAlpha:floatWrapperWithValue(alpha)]; -/// } -/// [result autorelease]; -/// return result; +/// ````text +/// // ... +/// static UIColor* fromProto(Color* protocolor) { +/// float red = [protocolor red]; +/// float green = [protocolor green]; +/// float blue = [protocolor blue]; +/// FloatValue* alpha_wrapper = [protocolor alpha]; +/// float alpha = 1.0; +/// if (alpha_wrapper != nil) { +/// alpha = [alpha_wrapper value]; /// } -/// // ... +/// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; +/// } /// -/// Example (JavaScript): +/// static Color* toProto(UIColor* color) { +/// CGFloat red, green, blue, alpha; +/// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { +/// return nil; +/// } +/// Color* result = [[Color alloc] init]; +/// [result setRed:red]; +/// [result setGreen:green]; +/// [result setBlue:blue]; +/// if (alpha <= 0.9999) { +/// [result setAlpha:floatWrapperWithValue(alpha)]; +/// } +/// [result autorelease]; +/// return result; +/// } +/// // ... +/// ```` /// -/// // ... +/// Example (JavaScript): /// -/// var protoToCssColor = function(rgb_color) { -/// var redFrac = rgb_color.red || 0.0; -/// var greenFrac = rgb_color.green || 0.0; -/// var blueFrac = rgb_color.blue || 0.0; -/// var red = Math.floor(redFrac * 255); -/// var green = Math.floor(greenFrac * 255); -/// var blue = Math.floor(blueFrac * 255); +/// ````text +/// // ... /// -/// if (!('alpha' in rgb_color)) { -/// return rgbToCssColor_(red, green, blue); -/// } +/// var protoToCssColor = function(rgb_color) { +/// var redFrac = rgb_color.red || 0.0; +/// var greenFrac = rgb_color.green || 0.0; +/// var blueFrac = rgb_color.blue || 0.0; +/// var red = Math.floor(redFrac * 255); +/// var green = Math.floor(greenFrac * 255); +/// var blue = Math.floor(blueFrac * 255); /// -/// var alphaFrac = rgb_color.alpha.value || 0.0; -/// var rgbParams = [red, green, blue].join(','); -/// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); -/// }; +/// if (!('alpha' in rgb_color)) { +/// return rgbToCssColor_(red, green, blue); +/// } /// -/// var rgbToCssColor_ = function(red, green, blue) { -/// var rgbNumber = new Number((red << 16) | (green << 8) | blue); -/// var hexString = rgbNumber.toString(16); -/// var missingZeros = 6 - hexString.length; -/// var resultBuilder = ['#']; -/// for (var i = 0; i < missingZeros; i++) { -/// resultBuilder.push('0'); -/// } -/// resultBuilder.push(hexString); -/// return resultBuilder.join(''); -/// }; +/// var alphaFrac = rgb_color.alpha.value || 0.0; +/// var rgbParams = [red, green, blue].join(','); +/// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); +/// }; /// -/// // ... +/// var rgbToCssColor_ = function(red, green, blue) { +/// var rgbNumber = new Number((red << 16) | (green << 8) | blue); +/// var hexString = rgbNumber.toString(16); +/// var missingZeros = 6 - hexString.length; +/// var resultBuilder = ['#']; +/// for (var i = 0; i < missingZeros; i++) { +/// resultBuilder.push('0'); +/// } +/// resultBuilder.push(hexString); +/// return resultBuilder.join(''); +/// }; +/// +/// // ... +/// ```` /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Color { /// The amount of blue in the color as a value in the interval [0, 1]. @@ -5286,16 +5297,17 @@ pub struct PivotGroup { /// pivot table, please delete the existing pivot table and then create a new /// pivot table with same parameters. /// - /// +--------------+---------+-------+ - /// | SUM of Units | Product | | - /// | Region | Pen | Paper | - /// +--------------+---------+-------+ - /// | New York | 345 | 98 | - /// | Oregon | 234 | 123 | - /// | Tennessee | 531 | 415 | - /// +--------------+---------+-------+ - /// | Grand Total | 1110 | 636 | - /// +--------------+---------+-------+ + /// ````text + /// +--------------+---------+-------+ + /// | SUM of Units | Product | | + /// | Region | Pen | Paper | + /// +--------------+---------+-------+ + /// | New York | 345 | 98 | + /// | Oregon | 234 | 123 | + /// | Tennessee | 531 | 415 | + /// +--------------+---------+-------+ + /// | Grand Total | 1110 | 636 | + /// +--------------+---------+-------+```` pub label: Option, /// Metadata about values in the grouping. #[serde(rename="valueMetadata")] @@ -5316,13 +5328,14 @@ pub struct PivotGroup { /// it is redundant with previous rows. Setting repeat_headings to true /// would cause "Q1" to be repeated for "Feb" and "Mar". /// - /// +--------------+ - /// | Q1 | Jan | - /// | | Feb | - /// | | Mar | - /// +--------+-----+ - /// | Q1 Total | - /// +--------------+ + /// ````text + /// +--------------+ + /// | Q1 | Jan | + /// | | Feb | + /// | | Mar | + /// +--------+-----+ + /// | Q1 Total | + /// +--------------+```` #[serde(rename="repeatHeadings")] pub repeat_headings: Option, /// The group rule to apply to this row/column group. diff --git a/gen/spanner1/src/lib.rs b/gen/spanner1/src/lib.rs index a02394cc1b..6bd451f4af 100644 --- a/gen/spanner1/src/lib.rs +++ b/gen/spanner1/src/lib.rs @@ -502,14 +502,18 @@ impl ResponseResult for Instance {} /// /// For example, consider the following table definition: /// -/// CREATE TABLE UserEvents ( -/// UserName STRING(MAX), -/// EventDate STRING(10) -/// ) PRIMARY KEY(UserName, EventDate); +/// ````text +/// CREATE TABLE UserEvents ( +/// UserName STRING(MAX), +/// EventDate STRING(10) +/// ) PRIMARY KEY(UserName, EventDate); +/// ```` /// /// The following keys name rows in this table: /// -/// "Bob", "2014-09-23" +/// ````text +/// "Bob", "2014-09-23" +/// ```` /// /// Since the `UserEvents` table's `PRIMARY KEY` clause names two /// columns, each `UserEvents` key has two elements; the first is the @@ -520,8 +524,10 @@ impl ResponseResult for Instance {} /// sort order. For example, the following range returns all events for /// user `"Bob"` that occurred in the year 2015: /// -/// "start_closed": ["Bob", "2015-01-01"] -/// "end_closed": ["Bob", "2015-12-31"] +/// ````text +/// "start_closed": ["Bob", "2015-01-01"] +/// "end_closed": ["Bob", "2015-12-31"] +/// ```` /// /// Start and end keys can omit trailing key components. This affects the /// inclusion and exclusion of rows that exactly match the provided key @@ -532,54 +538,69 @@ impl ResponseResult for Instance {} /// For example, the following range includes all events for `"Bob"` that /// occurred during and after the year 2000: /// -/// "start_closed": ["Bob", "2000-01-01"] -/// "end_closed": ["Bob"] +/// ````text +/// "start_closed": ["Bob", "2000-01-01"] +/// "end_closed": ["Bob"] +/// ```` /// /// The next example retrieves all events for `"Bob"`: /// -/// "start_closed": ["Bob"] -/// "end_closed": ["Bob"] +/// ````text +/// "start_closed": ["Bob"] +/// "end_closed": ["Bob"] +/// ```` /// /// To retrieve events before the year 2000: /// -/// "start_closed": ["Bob"] -/// "end_open": ["Bob", "2000-01-01"] +/// ````text +/// "start_closed": ["Bob"] +/// "end_open": ["Bob", "2000-01-01"] +/// ```` /// /// The following range includes all rows in the table: /// -/// "start_closed": [] -/// "end_closed": [] +/// ````text +/// "start_closed": [] +/// "end_closed": [] +/// ```` /// /// This range returns all users whose `UserName` begins with any /// character from A to C: /// -/// "start_closed": ["A"] -/// "end_open": ["D"] +/// ````text +/// "start_closed": ["A"] +/// "end_open": ["D"] +/// ```` /// /// This range returns all users whose `UserName` begins with B: /// -/// "start_closed": ["B"] -/// "end_open": ["C"] +/// ````text +/// "start_closed": ["B"] +/// "end_open": ["C"] +/// ```` /// /// Key ranges honor column sort order. For example, suppose a table is /// defined as follows: /// -/// CREATE TABLE DescendingSortedTable { -/// Key INT64, -/// ... -/// ) PRIMARY KEY(Key DESC); +/// ````text +/// CREATE TABLE DescendingSortedTable { +/// Key INT64, +/// ... +/// ) PRIMARY KEY(Key DESC); +/// ```` /// /// The following range retrieves all rows with key values between 1 /// and 100 inclusive: /// -/// "start_closed": ["100"] -/// "end_closed": ["1"] +/// ````text +/// "start_closed": ["100"] +/// "end_closed": ["1"] +/// ```` /// /// Note that 100 is passed as the start, and 1 is passed as the end, /// because `Key` is a descending column in the schema. /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct KeyRange { /// If the end is open, then the range excludes rows whose first @@ -699,9 +720,11 @@ impl Part for ReplicaInfo {} /// empty messages in your APIs. A typical example is to use it as the request /// or the response type of an API method. For instance: /// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } +/// ````text +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// ```` /// /// The JSON representation for `Empty` is empty JSON object `{}`. /// @@ -718,7 +741,6 @@ impl Part for ReplicaInfo {} /// * [instances operations cancel projects](struct.ProjectInstanceOperationCancelCall.html) (response) /// * [instances databases sessions rollback projects](struct.ProjectInstanceDatabaseSessionRollbackCall.html) (response) /// * [instances databases sessions delete projects](struct.ProjectInstanceDatabaseSessionDeleteCall.html) (response) -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Empty { _never_set: Option } @@ -859,9 +881,9 @@ impl ResponseResult for Database {} /// Clients can determine whether all DML statements have run successfully, or if /// a statement failed, using one of the following approaches: /// -/// 1. Check if `'status'` field is `OkStatus`. -/// 2. Check if `result_sets_size()` equals the number of statements in -/// ExecuteBatchDmlRequest. +/// 1. Check if `'status'` field is `OkStatus`. +/// 1. Check if `result_sets_size()` equals the number of statements in +/// ExecuteBatchDmlRequest. /// /// Example 1: A request with 5 DML statements, all executed successfully. /// @@ -881,7 +903,6 @@ impl ResponseResult for Database {} /// The list links the activity name, along with information about where it is used (one of *request* and *response*). /// /// * [instances databases sessions execute batch dml projects](struct.ProjectInstanceDatabaseSessionExecuteBatchDmlCall.html) (response) -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ExecuteBatchDmlResponse { /// If all DML statements are executed successfully, status will be OK. @@ -1639,11 +1660,12 @@ pub struct ResultSetStats { /// the query is profiled. For example, a query could return the statistics as /// follows: /// - /// { - /// "rows_returned": "3", - /// "elapsed_time": "1.22 secs", - /// "cpu_time": "1.19 secs" - /// } + /// ````text + /// { + /// "rows_returned": "3", + /// "elapsed_time": "1.22 secs", + /// "cpu_time": "1.19 secs" + /// }```` #[serde(rename="queryStats")] pub query_stats: Option>, } @@ -1673,7 +1695,6 @@ impl ResponseResult for CommitResponse {} /// Defines an Identity and Access Management (IAM) policy. It is used to /// specify access control policies for Cloud Platform resources. /// -/// /// A `Policy` consists of a list of `bindings`. A `binding` binds a list of /// `members` to a `role`, where the members can be user accounts, Google groups, /// Google domains, and service accounts. A `role` is a named list of permissions @@ -1681,37 +1702,40 @@ impl ResponseResult for CommitResponse {} /// /// **JSON Example** /// +/// ````text +/// { +/// "bindings": [ /// { -/// "bindings": [ -/// { -/// "role": "roles/owner", -/// "members": [ -/// "user:mike@example.com", -/// "group:admins@example.com", -/// "domain:google.com", -/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" -/// ] -/// }, -/// { -/// "role": "roles/viewer", -/// "members": ["user:sean@example.com"] -/// } +/// "role": "roles/owner", +/// "members": [ +/// "user:mike@example.com", +/// "group:admins@example.com", +/// "domain:google.com", +/// "serviceAccount:my-other-app@appspot.gserviceaccount.com" /// ] +/// }, +/// { +/// "role": "roles/viewer", +/// "members": ["user:sean@example.com"] /// } +/// ] +/// } +/// ```` /// /// **YAML Example** /// -/// bindings: -/// - members: -/// - user:mike@example.com -/// - group:admins@example.com -/// - domain:google.com -/// - serviceAccount:my-other-app@appspot.gserviceaccount.com -/// role: roles/owner -/// - members: -/// - user:sean@example.com -/// role: roles/viewer -/// +/// ````text +/// bindings: +/// - members: +/// - user:mike@example.com +/// - group:admins@example.com +/// - domain:google.com +/// - serviceAccount:my-other-app@appspot.gserviceaccount.com +/// role: roles/owner +/// - members: +/// - user:sean@example.com +/// role: roles/viewer +/// ```` /// /// For a description of IAM and its features, see the /// [IAM developer's guide](https://cloud.google.com/iam/docs). @@ -1725,7 +1749,6 @@ impl ResponseResult for CommitResponse {} /// * [instances databases set iam policy projects](struct.ProjectInstanceDatabaseSetIamPolicyCall.html) (response) /// * [instances set iam policy projects](struct.ProjectInstanceSetIamPolicyCall.html) (response) /// * [instances databases get iam policy projects](struct.ProjectInstanceDatabaseGetIamPolicyCall.html) (response) -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Policy { /// Associates a list of `members` to a `role`. @@ -1920,10 +1943,11 @@ pub struct PlanNode { /// For example, a Parameter Reference node could have the following /// information in its metadata: /// - /// { - /// "parameter_reference": "param1", - /// "parameter_type": "array" - /// } + /// ````text + /// { + /// "parameter_reference": "param1", + /// "parameter_type": "array" + /// }```` pub metadata: Option>, } @@ -1932,7 +1956,6 @@ impl Part for PlanNode {} /// # Transactions /// -/// /// Each session can have at most one active transaction at a time. After the /// active transaction is completed, the session can immediately be /// re-used for the next transaction. It is not necessary to create a @@ -1942,24 +1965,24 @@ impl Part for PlanNode {} /// /// Cloud Spanner supports three transaction modes: /// -/// 1. Locking read-write. This type of transaction is the only way -/// to write data into Cloud Spanner. These transactions rely on -/// pessimistic locking and, if necessary, two-phase commit. -/// Locking read-write transactions may abort, requiring the -/// application to retry. +/// 1. Locking read-write. This type of transaction is the only way +/// to write data into Cloud Spanner. These transactions rely on +/// pessimistic locking and, if necessary, two-phase commit. +/// Locking read-write transactions may abort, requiring the +/// application to retry. /// -/// 2. Snapshot read-only. This transaction type provides guaranteed -/// consistency across several reads, but does not allow -/// writes. Snapshot read-only transactions can be configured to -/// read at timestamps in the past. Snapshot read-only -/// transactions do not need to be committed. +/// 1. Snapshot read-only. This transaction type provides guaranteed +/// consistency across several reads, but does not allow +/// writes. Snapshot read-only transactions can be configured to +/// read at timestamps in the past. Snapshot read-only +/// transactions do not need to be committed. /// -/// 3. Partitioned DML. This type of transaction is used to execute -/// a single Partitioned DML statement. Partitioned DML partitions -/// the key space and runs the DML statement over each partition -/// in parallel using separate, internal transactions that commit -/// independently. Partitioned DML transactions do not need to be -/// committed. +/// 1. Partitioned DML. This type of transaction is used to execute +/// a single Partitioned DML statement. Partitioned DML partitions +/// the key space and runs the DML statement over each partition +/// in parallel using separate, internal transactions that commit +/// independently. Partitioned DML transactions do not need to be +/// committed. /// /// For transactions that only read, snapshot read-only transactions /// provide simpler semantics and are almost always faster. In @@ -2062,9 +2085,9 @@ impl Part for PlanNode {} /// /// The types of timestamp bound are: /// -/// - Strong (the default). -/// - Bounded staleness. -/// - Exact staleness. +/// * Strong (the default). +/// * Bounded staleness. +/// * Exact staleness. /// /// If the Cloud Spanner database to be read is geographically distributed, /// stale read-only transactions can execute more quickly than strong @@ -2171,45 +2194,44 @@ impl Part for PlanNode {} /// That said, Partitioned DML is not a drop-in replacement for standard DML used /// in ReadWrite transactions. /// -/// - The DML statement must be fully-partitionable. Specifically, the statement -/// must be expressible as the union of many statements which each access only -/// a single row of the table. +/// * The DML statement must be fully-partitionable. Specifically, the statement +/// must be expressible as the union of many statements which each access only +/// a single row of the table. /// -/// - The statement is not applied atomically to all rows of the table. Rather, -/// the statement is applied atomically to partitions of the table, in -/// independent transactions. Secondary index rows are updated atomically -/// with the base table rows. +/// * The statement is not applied atomically to all rows of the table. Rather, +/// the statement is applied atomically to partitions of the table, in +/// independent transactions. Secondary index rows are updated atomically +/// with the base table rows. /// -/// - Partitioned DML does not guarantee exactly-once execution semantics -/// against a partition. The statement will be applied at least once to each -/// partition. It is strongly recommended that the DML statement should be -/// idempotent to avoid unexpected results. For instance, it is potentially -/// dangerous to run a statement such as -/// `UPDATE table SET column = column + 1` as it could be run multiple times -/// against some rows. +/// * Partitioned DML does not guarantee exactly-once execution semantics +/// against a partition. The statement will be applied at least once to each +/// partition. It is strongly recommended that the DML statement should be +/// idempotent to avoid unexpected results. For instance, it is potentially +/// dangerous to run a statement such as +/// `UPDATE table SET column = column + 1` as it could be run multiple times +/// against some rows. /// -/// - The partitions are committed automatically - there is no support for -/// Commit or Rollback. If the call returns an error, or if the client issuing -/// the ExecuteSql call dies, it is possible that some rows had the statement -/// executed on them successfully. It is also possible that statement was -/// never executed against other rows. +/// * The partitions are committed automatically - there is no support for +/// Commit or Rollback. If the call returns an error, or if the client issuing +/// the ExecuteSql call dies, it is possible that some rows had the statement +/// executed on them successfully. It is also possible that statement was +/// never executed against other rows. /// -/// - Partitioned DML transactions may only contain the execution of a single -/// DML statement via ExecuteSql or ExecuteStreamingSql. +/// * Partitioned DML transactions may only contain the execution of a single +/// DML statement via ExecuteSql or ExecuteStreamingSql. /// -/// - If any error is encountered during the execution of the partitioned DML -/// operation (for instance, a UNIQUE INDEX violation, division by zero, or a -/// value that cannot be stored due to schema constraints), then the -/// operation is stopped at that point and an error is returned. It is -/// possible that at this point, some partitions have been committed (or even -/// committed multiple times), and other partitions have not been run at all. +/// * If any error is encountered during the execution of the partitioned DML +/// operation (for instance, a UNIQUE INDEX violation, division by zero, or a +/// value that cannot be stored due to schema constraints), then the +/// operation is stopped at that point and an error is returned. It is +/// possible that at this point, some partitions have been committed (or even +/// committed multiple times), and other partitions have not been run at all. /// /// Given the above, Partitioned DML is good fit for large, database-wide, /// operations that are idempotent, such as deleting old rows from a very large /// table. /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TransactionOptions { /// Transaction may write. @@ -2293,12 +2315,13 @@ impl RequestValue for TestIamPermissionsRequest {} /// Represents an expression text. Example: /// -/// title: "User account presence" -/// description: "Determines whether the request has a user account" -/// expression: "size(request.user) > 0" +/// ````text +/// title: "User account presence" +/// description: "Determines whether the request has a user account" +/// expression: "size(request.user) > 0" +/// ```` /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { /// An optional description of the expression. This is a longer text which @@ -2380,60 +2403,64 @@ pub struct PartialResultSet { /// field. Two or more chunked values can be merged to form a /// complete value as follows: /// - /// * `bool/number/null`: cannot be chunked - /// * `string`: concatenate the strings - /// * `list`: concatenate the lists. If the last element in a list is a - /// `string`, `list`, or `object`, merge it with the first element in - /// the next list by applying these rules recursively. - /// * `object`: concatenate the (field name, field value) pairs. If a - /// field name is duplicated, then apply these rules recursively - /// to merge the field values. + /// * `bool/number/null`: cannot be chunked + /// * `string`: concatenate the strings + /// * `list`: concatenate the lists. If the last element in a list is a + /// `string`, `list`, or `object`, merge it with the first element in + /// the next list by applying these rules recursively. + /// * `object`: concatenate the (field name, field value) pairs. If a + /// field name is duplicated, then apply these rules recursively + /// to merge the field values. /// /// Some examples of merging: /// - /// # Strings are concatenated. - /// "foo", "bar" => "foobar" + /// ````text + /// # Strings are concatenated. + /// "foo", "bar" => "foobar" /// - /// # Lists of non-strings are concatenated. - /// [2, 3], [4] => [2, 3, 4] + /// # Lists of non-strings are concatenated. + /// [2, 3], [4] => [2, 3, 4] /// - /// # Lists are concatenated, but the last and first elements are merged - /// # because they are strings. - /// ["a", "b"], ["c", "d"] => ["a", "bc", "d"] + /// # Lists are concatenated, but the last and first elements are merged + /// # because they are strings. + /// ["a", "b"], ["c", "d"] => ["a", "bc", "d"] /// - /// # Lists are concatenated, but the last and first elements are merged - /// # because they are lists. Recursively, the last and first elements - /// # of the inner lists are merged because they are strings. - /// ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] + /// # Lists are concatenated, but the last and first elements are merged + /// # because they are lists. Recursively, the last and first elements + /// # of the inner lists are merged because they are strings. + /// ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] /// - /// # Non-overlapping object fields are combined. - /// {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} + /// # Non-overlapping object fields are combined. + /// {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} /// - /// # Overlapping object fields are merged. - /// {"a": "1"}, {"a": "2"} => {"a": "12"} + /// # Overlapping object fields are merged. + /// {"a": "1"}, {"a": "2"} => {"a": "12"} /// - /// # Examples of merging objects containing lists of strings. - /// {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} + /// # Examples of merging objects containing lists of strings. + /// {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} + /// ```` /// /// For a more complete example, suppose a streaming SQL query is /// yielding a result set whose rows contain a single string /// field. The following `PartialResultSet`s might be yielded: /// - /// { - /// "metadata": { ... } - /// "values": ["Hello", "W"] - /// "chunked_value": true - /// "resume_token": "Af65..." - /// } - /// { - /// "values": ["orl"] - /// "chunked_value": true - /// "resume_token": "Bqp2..." - /// } - /// { - /// "values": ["d"] - /// "resume_token": "Zx1B..." - /// } + /// ````text + /// { + /// "metadata": { ... } + /// "values": ["Hello", "W"] + /// "chunked_value": true + /// "resume_token": "Af65..." + /// } + /// { + /// "values": ["orl"] + /// "chunked_value": true + /// "resume_token": "Bqp2..." + /// } + /// { + /// "values": ["d"] + /// "resume_token": "Zx1B..." + /// } + /// ```` /// /// This sequence of `PartialResultSet`s encodes two rows, one /// containing the field value `"Hello"`, and a second containing the @@ -2701,13 +2728,13 @@ impl RequestValue for BeginTransactionRequest {} #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResultSetMetadata { /// Indicates the field names and types for the rows in the result - /// set. For example, a SQL query like `"SELECT UserId, UserName FROM - /// Users"` could return a `row_type` value like: + /// set. For example, a SQL query like `"SELECT UserId, UserName FROM Users"` could return a `row_type` value like: /// - /// "fields": [ - /// { "name": "UserId", "type": { "code": "INT64" } }, - /// { "name": "UserName", "type": { "code": "STRING" } }, - /// ] + /// ````text + /// "fields": [ + /// { "name": "UserId", "type": { "code": "INT64" } }, + /// { "name": "UserName", "type": { "code": "STRING" } }, + /// ]```` #[serde(rename="rowType")] pub row_type: Option, /// If the read or SQL query began a transaction as a side-effect, the @@ -3290,27 +3317,27 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Immediately upon completion of this request: /// - /// * For resource types for which a decrease in the instance's allocation - /// has been requested, billing is based on the newly-requested level. + /// * For resource types for which a decrease in the instance's allocation + /// has been requested, billing is based on the newly-requested level. /// /// Until completion of the returned operation: /// - /// * Cancelling the operation sets its metadata's - /// cancel_time, and begins - /// restoring resources to their pre-request values. The operation - /// is guaranteed to succeed at undoing all resource changes, - /// after which point it terminates with a `CANCELLED` status. - /// * All other attempts to modify the instance are rejected. - /// * Reading the instance via the API continues to give the pre-request - /// resource levels. + /// * Cancelling the operation sets its metadata's + /// cancel_time, and begins + /// restoring resources to their pre-request values. The operation + /// is guaranteed to succeed at undoing all resource changes, + /// after which point it terminates with a `CANCELLED` status. + /// * All other attempts to modify the instance are rejected. + /// * Reading the instance via the API continues to give the pre-request + /// resource levels. /// /// Upon completion of the returned operation: /// - /// * Billing begins for all successfully-allocated resources (some types - /// may have lower than the requested levels). - /// * All newly-reserved resources are available for serving the instance's - /// tables. - /// * The instance's new resource levels are readable via the API. + /// * Billing begins for all successfully-allocated resources (some types + /// may have lower than the requested levels). + /// * All newly-reserved resources are available for serving the instance's + /// tables. + /// * The instance's new resource levels are readable via the API. /// /// The returned long-running operation will /// have a name of the format `/operations/` and @@ -3681,23 +3708,23 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Immediately upon completion of this request: /// - /// * The instance is readable via the API, with all requested attributes - /// but no allocated resources. Its state is `CREATING`. + /// * The instance is readable via the API, with all requested attributes + /// but no allocated resources. Its state is `CREATING`. /// /// Until completion of the returned operation: /// - /// * Cancelling the operation renders the instance immediately unreadable - /// via the API. - /// * The instance can be deleted. - /// * All other attempts to modify the instance are rejected. + /// * Cancelling the operation renders the instance immediately unreadable + /// via the API. + /// * The instance can be deleted. + /// * All other attempts to modify the instance are rejected. /// /// Upon completion of the returned operation: /// - /// * Billing for all successfully-allocated resources begins (some types - /// may have lower than the requested levels). - /// * Databases can be created in the instance. - /// * The instance's allocated resource levels are readable via the API. - /// * The instance's state becomes `READY`. + /// * Billing for all successfully-allocated resources begins (some types + /// may have lower than the requested levels). + /// * Databases can be created in the instance. + /// * The instance's allocated resource levels are readable via the API. + /// * The instance's state becomes `READY`. /// /// The returned long-running operation will /// have a name of the format `/operations/` and @@ -3786,13 +3813,13 @@ impl<'a, C, A> ProjectMethods<'a, C, A> { /// /// Immediately upon completion of the request: /// - /// * Billing ceases for all of the instance's reserved resources. + /// * Billing ceases for all of the instance's reserved resources. /// /// Soon afterward: /// - /// * The instance and *all of its databases* immediately and - /// irrevocably disappear from the API. All data in the databases - /// is permanently deleted. + /// * The instance and *all of its databases* immediately and + /// irrevocably disappear from the API. All data in the databases + /// is permanently deleted. /// /// # Arguments /// @@ -7973,22 +8000,22 @@ impl<'a, C, A> ProjectInstanceListCall<'a, C, A> where C: BorrowMut The instance has a name. - /// * `name:Howl` --> The instance's name contains the string "howl". - /// * `name:HOWL` --> Equivalent to above. - /// * `NAME:howl` --> Equivalent to above. - /// * `labels.env:*` --> The instance has the label "env". - /// * `labels.env:dev` --> The instance has the label "env" and the value of - /// the label contains the string "dev". - /// * `name:howl labels.env:dev` --> The instance's name contains "howl" and - /// it has the label "env" with its value - /// containing "dev". + /// * `name:*` --> The instance has a name. + /// * `name:Howl` --> The instance's name contains the string "howl". + /// * `name:HOWL` --> Equivalent to above. + /// * `NAME:howl` --> Equivalent to above. + /// * `labels.env:*` --> The instance has the label "env". + /// * `labels.env:dev` --> The instance has the label "env" and the value of + /// the label contains the string "dev". + /// * `name:howl labels.env:dev` --> The instance's name contains "howl" and + /// it has the label "env" with its value + /// containing "dev". /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ProjectInstanceListCall<'a, C, A> { @@ -9218,27 +9245,27 @@ impl<'a, C, A> ProjectInstanceDatabaseSetIamPolicyCall<'a, C, A> where C: Borrow /// /// Immediately upon completion of this request: /// -/// * For resource types for which a decrease in the instance's allocation -/// has been requested, billing is based on the newly-requested level. +/// * For resource types for which a decrease in the instance's allocation +/// has been requested, billing is based on the newly-requested level. /// /// Until completion of the returned operation: /// -/// * Cancelling the operation sets its metadata's -/// cancel_time, and begins -/// restoring resources to their pre-request values. The operation -/// is guaranteed to succeed at undoing all resource changes, -/// after which point it terminates with a `CANCELLED` status. -/// * All other attempts to modify the instance are rejected. -/// * Reading the instance via the API continues to give the pre-request -/// resource levels. +/// * Cancelling the operation sets its metadata's +/// cancel_time, and begins +/// restoring resources to their pre-request values. The operation +/// is guaranteed to succeed at undoing all resource changes, +/// after which point it terminates with a `CANCELLED` status. +/// * All other attempts to modify the instance are rejected. +/// * Reading the instance via the API continues to give the pre-request +/// resource levels. /// /// Upon completion of the returned operation: /// -/// * Billing begins for all successfully-allocated resources (some types -/// may have lower than the requested levels). -/// * All newly-reserved resources are available for serving the instance's -/// tables. -/// * The instance's new resource levels are readable via the API. +/// * Billing begins for all successfully-allocated resources (some types +/// may have lower than the requested levels). +/// * All newly-reserved resources are available for serving the instance's +/// tables. +/// * The instance's new resource levels are readable via the API. /// /// The returned long-running operation will /// have a name of the format `/operations/` and @@ -13006,13 +13033,13 @@ impl<'a, C, A> ProjectInstanceDatabaseSessionListCall<'a, C, A> where C: BorrowM /// An expression for filtering the results of the request. Filter rules are /// case insensitive. The fields eligible for filtering are: /// - /// * `labels.key` where key is the name of a label + /// * `labels.key` where key is the name of a label /// /// Some examples of using filters are: /// - /// * `labels.env:*` --> The session has the label "env". - /// * `labels.env:dev` --> The session has the label "env" and the value of - /// the label contains the string "dev". + /// * `labels.env:*` --> The session has the label "env". + /// * `labels.env:dev` --> The session has the label "env" and the value of + /// the label contains the string "dev". /// /// Sets the *filter* query property to the given value. pub fn filter(mut self, new_value: &str) -> ProjectInstanceDatabaseSessionListCall<'a, C, A> { @@ -13384,23 +13411,23 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationListCall<'a, C, A> where C: Borro /// /// Immediately upon completion of this request: /// -/// * The instance is readable via the API, with all requested attributes -/// but no allocated resources. Its state is `CREATING`. +/// * The instance is readable via the API, with all requested attributes +/// but no allocated resources. Its state is `CREATING`. /// /// Until completion of the returned operation: /// -/// * Cancelling the operation renders the instance immediately unreadable -/// via the API. -/// * The instance can be deleted. -/// * All other attempts to modify the instance are rejected. +/// * Cancelling the operation renders the instance immediately unreadable +/// via the API. +/// * The instance can be deleted. +/// * All other attempts to modify the instance are rejected. /// /// Upon completion of the returned operation: /// -/// * Billing for all successfully-allocated resources begins (some types -/// may have lower than the requested levels). -/// * Databases can be created in the instance. -/// * The instance's allocated resource levels are readable via the API. -/// * The instance's state becomes `READY`. +/// * Billing for all successfully-allocated resources begins (some types +/// may have lower than the requested levels). +/// * Databases can be created in the instance. +/// * The instance's allocated resource levels are readable via the API. +/// * The instance's state becomes `READY`. /// /// The returned long-running operation will /// have a name of the format `/operations/` and @@ -14442,13 +14469,13 @@ impl<'a, C, A> ProjectInstanceDatabaseOperationDeleteCall<'a, C, A> where C: Bor /// /// Immediately upon completion of the request: /// -/// * Billing ceases for all of the instance's reserved resources. +/// * Billing ceases for all of the instance's reserved resources. /// /// Soon afterward: /// -/// * The instance and *all of its databases* immediately and -/// irrevocably disappear from the API. All data in the databases -/// is permanently deleted. +/// * The instance and *all of its databases* immediately and +/// irrevocably disappear from the API. All data in the databases +/// is permanently deleted. /// /// A builder for the *instances.delete* method supported by a *project* resource. /// It is not used directly, but through a `ProjectMethods` instance. diff --git a/gen/vision1/src/lib.rs b/gen/vision1/src/lib.rs index 563450a7fb..c4dd9a2383 100644 --- a/gen/vision1/src/lib.rs +++ b/gen/vision1/src/lib.rs @@ -509,14 +509,15 @@ pub struct Paragraph { /// is represented as around the top-left corner as defined when the text is /// read in the 'natural' orientation. /// For example: - /// * when the text is horizontal it might look like: - /// 0----1 - /// | | - /// 3----2 - /// * when it's rotated 180 degrees around the top-left corner it becomes: - /// 2----3 - /// | | - /// 1----0 + /// + /// * when the text is horizontal it might look like: + /// 0----1 + /// | | + /// 3----2 + /// * when it's rotated 180 degrees around the top-left corner it becomes: + /// 2----3 + /// | | + /// 1----0 /// and the vertex order will still be (0, 1, 2, 3). #[serde(rename="boundingBox")] pub bounding_box: Option, @@ -569,14 +570,13 @@ impl Part for WebLabel {} /// TextAnnotation contains a structured representation of OCR extracted text. /// The hierarchy of an OCR extracted text structure is like this: -/// TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol +/// TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol /// Each structural component, starting from Page, may further have their own /// properties. Properties describe detected languages, breaks etc.. Please refer /// to the TextAnnotation.TextProperty message definition below for more /// detail. /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct TextAnnotation { /// UTF-8 text detected on the pages. @@ -840,17 +840,21 @@ pub struct Block { /// For example: /// /// * when the text is horizontal it might look like: - /// - /// 0----1 - /// | | - /// 3----2 + /// + /// ````text + /// 0----1 + /// | | + /// 3----2 + /// ```` /// /// * when it's rotated 180 degrees around the top-left corner it becomes: - /// - /// 2----3 - /// | | - /// 1----0 - /// + /// + /// ````text + /// 2----3 + /// | | + /// 1----0 + /// ```` + /// /// and the vertex order will still be (0, 1, 2, 3). #[serde(rename="boundingBox")] pub bounding_box: Option, @@ -1469,14 +1473,14 @@ pub struct ImportProductSetsGcsSource { /// The format of the input csv file should be one image per line. /// In each line, there are 8 columns. /// - /// 1. image-uri - /// 2. image-id - /// 3. product-set-id - /// 4. product-id - /// 5. product-category - /// 6. product-display-name - /// 7. labels - /// 8. bounding-poly + /// 1. image-uri + /// 1. image-id + /// 1. product-set-id + /// 1. product-id + /// 1. product-category + /// 1. product-display-name + /// 1. labels + /// 1. bounding-poly /// /// The `image-uri`, `product-set-id`, `product-id`, and `product-category` /// columns are required. All other columns are optional. @@ -1504,7 +1508,9 @@ pub struct ImportProductSetsGcsSource { /// The `labels` column (optional) is a line containing a list of /// comma-separated key-value pairs, in the following format: /// - /// "key_1=value_1,key_2=value_2,...,key_n=value_n" + /// ````text + /// "key_1=value_1,key_2=value_2,...,key_n=value_n" + /// ```` /// /// The `bounding-poly` column (optional) identifies one region of /// interest from the image in the same manner as `CreateReferenceImage`. If @@ -1831,14 +1837,15 @@ pub struct Word { /// is represented as around the top-left corner as defined when the text is /// read in the 'natural' orientation. /// For example: - /// * when the text is horizontal it might look like: - /// 0----1 - /// | | - /// 3----2 - /// * when it's rotated 180 degrees around the top-left corner it becomes: - /// 2----3 - /// | | - /// 1----0 + /// + /// * when the text is horizontal it might look like: + /// 0----1 + /// | | + /// 3----2 + /// * when it's rotated 180 degrees around the top-left corner it becomes: + /// 2----3 + /// | | + /// 1----0 /// and the vertex order will still be (0, 1, 2, 3). #[serde(rename="boundingBox")] pub bounding_box: Option, @@ -1880,9 +1887,11 @@ impl ResponseResult for ListProductsResponse {} /// empty messages in your APIs. A typical example is to use it as the request /// or the response type of an API method. For instance: /// -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } +/// ````text +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// ```` /// /// The JSON representation for `Empty` is empty JSON object `{}`. /// @@ -1898,7 +1907,6 @@ impl ResponseResult for ListProductsResponse {} /// * [locations products reference images delete projects](struct.ProjectLocationProductReferenceImageDeleteCall.html) (response) /// * [locations product sets add product projects](struct.ProjectLocationProductSetAddProductCall.html) (response) /// * [locations product sets remove product projects](struct.ProjectLocationProductSetRemoveProductCall.html) (response) -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Empty { _never_set: Option } @@ -1935,14 +1943,15 @@ pub struct Symbol { /// is represented as around the top-left corner as defined when the text is /// read in the 'natural' orientation. /// For example: - /// * when the text is horizontal it might look like: - /// 0----1 - /// | | - /// 3----2 - /// * when it's rotated 180 degrees around the top-left corner it becomes: - /// 2----3 - /// | | - /// 1----0 + /// + /// * when the text is horizontal it might look like: + /// 0----1 + /// | | + /// 3----2 + /// * when it's rotated 180 degrees around the top-left corner it becomes: + /// 2----3 + /// | | + /// 1----0 /// and the vertice order will still be (0, 1, 2, 3). #[serde(rename="boundingBox")] pub bounding_box: Option, @@ -2227,113 +2236,118 @@ impl Part for Page {} /// /// Example (Java): /// -/// import com.google.type.Color; +/// ````text +/// import com.google.type.Color; /// -/// // ... -/// public static java.awt.Color fromProto(Color protocolor) { -/// float alpha = protocolor.hasAlpha() -/// ? protocolor.getAlpha().getValue() -/// : 1.0; +/// // ... +/// public static java.awt.Color fromProto(Color protocolor) { +/// float alpha = protocolor.hasAlpha() +/// ? protocolor.getAlpha().getValue() +/// : 1.0; /// -/// return new java.awt.Color( -/// protocolor.getRed(), -/// protocolor.getGreen(), -/// protocolor.getBlue(), -/// alpha); -/// } +/// return new java.awt.Color( +/// protocolor.getRed(), +/// protocolor.getGreen(), +/// protocolor.getBlue(), +/// alpha); +/// } /// -/// public static Color toProto(java.awt.Color color) { -/// float red = (float) color.getRed(); -/// float green = (float) color.getGreen(); -/// float blue = (float) color.getBlue(); -/// float denominator = 255.0; -/// Color.Builder resultBuilder = -/// Color -/// .newBuilder() -/// .setRed(red / denominator) -/// .setGreen(green / denominator) -/// .setBlue(blue / denominator); -/// int alpha = color.getAlpha(); -/// if (alpha != 255) { -/// result.setAlpha( -/// FloatValue -/// .newBuilder() -/// .setValue(((float) alpha) / denominator) -/// .build()); -/// } -/// return resultBuilder.build(); -/// } -/// // ... +/// public static Color toProto(java.awt.Color color) { +/// float red = (float) color.getRed(); +/// float green = (float) color.getGreen(); +/// float blue = (float) color.getBlue(); +/// float denominator = 255.0; +/// Color.Builder resultBuilder = +/// Color +/// .newBuilder() +/// .setRed(red / denominator) +/// .setGreen(green / denominator) +/// .setBlue(blue / denominator); +/// int alpha = color.getAlpha(); +/// if (alpha != 255) { +/// result.setAlpha( +/// FloatValue +/// .newBuilder() +/// .setValue(((float) alpha) / denominator) +/// .build()); +/// } +/// return resultBuilder.build(); +/// } +/// // ... +/// ```` /// /// Example (iOS / Obj-C): /// -/// // ... -/// static UIColor* fromProto(Color* protocolor) { -/// float red = [protocolor red]; -/// float green = [protocolor green]; -/// float blue = [protocolor blue]; -/// FloatValue* alpha_wrapper = [protocolor alpha]; -/// float alpha = 1.0; -/// if (alpha_wrapper != nil) { -/// alpha = [alpha_wrapper value]; -/// } -/// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; -/// } -/// -/// static Color* toProto(UIColor* color) { -/// CGFloat red, green, blue, alpha; -/// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { -/// return nil; -/// } -/// Color* result = [[Color alloc] init]; -/// [result setRed:red]; -/// [result setGreen:green]; -/// [result setBlue:blue]; -/// if (alpha <= 0.9999) { -/// [result setAlpha:floatWrapperWithValue(alpha)]; -/// } -/// [result autorelease]; -/// return result; +/// ````text +/// // ... +/// static UIColor* fromProto(Color* protocolor) { +/// float red = [protocolor red]; +/// float green = [protocolor green]; +/// float blue = [protocolor blue]; +/// FloatValue* alpha_wrapper = [protocolor alpha]; +/// float alpha = 1.0; +/// if (alpha_wrapper != nil) { +/// alpha = [alpha_wrapper value]; /// } -/// // ... +/// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; +/// } /// -/// Example (JavaScript): +/// static Color* toProto(UIColor* color) { +/// CGFloat red, green, blue, alpha; +/// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { +/// return nil; +/// } +/// Color* result = [[Color alloc] init]; +/// [result setRed:red]; +/// [result setGreen:green]; +/// [result setBlue:blue]; +/// if (alpha <= 0.9999) { +/// [result setAlpha:floatWrapperWithValue(alpha)]; +/// } +/// [result autorelease]; +/// return result; +/// } +/// // ... +/// ```` /// -/// // ... +/// Example (JavaScript): /// -/// var protoToCssColor = function(rgb_color) { -/// var redFrac = rgb_color.red || 0.0; -/// var greenFrac = rgb_color.green || 0.0; -/// var blueFrac = rgb_color.blue || 0.0; -/// var red = Math.floor(redFrac * 255); -/// var green = Math.floor(greenFrac * 255); -/// var blue = Math.floor(blueFrac * 255); +/// ````text +/// // ... /// -/// if (!('alpha' in rgb_color)) { -/// return rgbToCssColor_(red, green, blue); -/// } +/// var protoToCssColor = function(rgb_color) { +/// var redFrac = rgb_color.red || 0.0; +/// var greenFrac = rgb_color.green || 0.0; +/// var blueFrac = rgb_color.blue || 0.0; +/// var red = Math.floor(redFrac * 255); +/// var green = Math.floor(greenFrac * 255); +/// var blue = Math.floor(blueFrac * 255); /// -/// var alphaFrac = rgb_color.alpha.value || 0.0; -/// var rgbParams = [red, green, blue].join(','); -/// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); -/// }; +/// if (!('alpha' in rgb_color)) { +/// return rgbToCssColor_(red, green, blue); +/// } /// -/// var rgbToCssColor_ = function(red, green, blue) { -/// var rgbNumber = new Number((red << 16) | (green << 8) | blue); -/// var hexString = rgbNumber.toString(16); -/// var missingZeros = 6 - hexString.length; -/// var resultBuilder = ['#']; -/// for (var i = 0; i < missingZeros; i++) { -/// resultBuilder.push('0'); -/// } -/// resultBuilder.push(hexString); -/// return resultBuilder.join(''); -/// }; +/// var alphaFrac = rgb_color.alpha.value || 0.0; +/// var rgbParams = [red, green, blue].join(','); +/// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); +/// }; /// -/// // ... +/// var rgbToCssColor_ = function(red, green, blue) { +/// var rgbNumber = new Number((red << 16) | (green << 8) | blue); +/// var hexString = rgbNumber.toString(16); +/// var missingZeros = 6 - hexString.length; +/// var resultBuilder = ['#']; +/// for (var i = 0; i < missingZeros; i++) { +/// resultBuilder.push('0'); +/// } +/// resultBuilder.push(hexString); +/// return resultBuilder.join(''); +/// }; +/// +/// // ... +/// ```` /// /// This type is not used in any activity, and only used as *part* of another schema. -/// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Color { /// The amount of blue in the color as a value in the interval [0, 1]. diff --git a/src/mako/api/lib/lib.mako b/src/mako/api/lib/lib.mako index f92c36d3e8..e5ec566ccc 100644 --- a/src/mako/api/lib/lib.mako +++ b/src/mako/api/lib/lib.mako @@ -7,7 +7,7 @@ REQUEST_MARKER_TRAIT, RESPONSE_MARKER_TRAIT, supports_scopes, to_api_version, to_fqan, METHODS_RESOURCE, ADD_PARAM_MEDIA_EXAMPLE, PROTOCOL_TYPE_INFO, enclose_in, upload_action_fn, unique_type_name, schema_doc_format, METHODS_BUILDER_MARKER_TRAIT, - to_extern_crate_name) + to_extern_crate_name, rust_doc_sanitize) def pretty_name(name): return ' '.join(split_camelcase_s(name).split('.')) @@ -341,7 +341,7 @@ You can read the full text at the repository's [license file][repo-license]. #[derive(PartialEq, Eq, Hash)] pub enum Scope { % for url, scope in auth.oauth2.scopes.items(): - ${scope.description | rust_doc_comment} + ${scope.description | rust_doc_sanitize, rust_doc_comment} ${scope_url_to_variant(name, url, fully_qualified=False)}, % if not loop.last: diff --git a/src/mako/api/lib/mbuild.mako b/src/mako/api/lib/mbuild.mako index 5438286bd9..b854339972 100644 --- a/src/mako/api/lib/mbuild.mako +++ b/src/mako/api/lib/mbuild.mako @@ -11,7 +11,7 @@ DELEGATE_PROPERTY_NAME, struct_type_bounds_s, scope_url_to_variant, re_find_replacements, ADD_PARAM_FN, ADD_PARAM_MEDIA_EXAMPLE, upload_action_fn, METHODS_RESOURCE, method_name_to_variant, unique_type_name, size_to_bytes, method_default_scope, - is_repeated_property, setter_fn_name, ADD_SCOPE_FN) + is_repeated_property, setter_fn_name, ADD_SCOPE_FN, rust_doc_sanitize) def get_parts(part_prop): if not part_prop: @@ -58,7 +58,7 @@ parts = get_parts(part_prop) %>\ % if 'description' in m: -${m.description | rust_doc_comment} +${m.description | rust_doc_sanitize, rust_doc_comment} /// % endif % if m.get('supportsMediaDownload', False): @@ -82,7 +82,7 @@ ${m.description | rust_doc_comment} /// It is not used directly, but through a `${rb_type(resource)}` instance. /// % if part_desc: -${part_desc | rust_doc_comment} +${part_desc | rust_doc_sanitize, rust_doc_comment} /// % if m.get('scopes'): /// # Scopes @@ -220,7 +220,7 @@ ${self._setter_fn(resource, method, m, p, part_prop, ThisType, c)}\ # end part description %>\ % if 'description' in p: - ${p.description | rust_doc_comment, indent_all_but_first_by(1)} + ${p.description | rust_doc_sanitize, rust_doc_comment, indent_all_but_first_by(1)} % endif % if is_repeated_property(p): /// @@ -244,7 +244,7 @@ ${self._setter_fn(resource, method, m, p, part_prop, ThisType, c)}\ % endif % if part_desc: /// - ${part_desc | rust_doc_comment, indent_all_but_first_by(1)} + ${part_desc | rust_doc_sanitize, rust_doc_comment, indent_all_but_first_by(1)} % endif pub fn ${mangle_ident(setter_fn_name(p))}(mut self, ${value_name}: ${InType}) -> ${ThisType} { % if p.get('repeated', False): @@ -875,7 +875,7 @@ if enable_resource_parsing \ } % for p in media_params: - ${p.description | rust_doc_comment, indent_all_but_first_by(1)} + ${p.description | rust_doc_sanitize, rust_doc_comment, indent_all_but_first_by(1)} /// % for item_name, item in p.info.iteritems(): /// * *${split_camelcase_s(item_name)}*: ${isinstance(item, (list, tuple)) and put_and(enclose_in("'", item)) or str(item)} diff --git a/src/mako/api/lib/rbuild.mako b/src/mako/api/lib/rbuild.mako index 33288f81d7..f87d3378ae 100644 --- a/src/mako/api/lib/rbuild.mako +++ b/src/mako/api/lib/rbuild.mako @@ -6,7 +6,7 @@ rust_copy_value_s, organize_params, REQUEST_VALUE_PROPERTY_NAME, build_all_params, rb_type_params_s, hub_type_params_s, mb_type_params_s, mb_additional_type_params, struct_type_bounds_s, METHODS_RESOURCE, SPACES_PER_TAB, prefix_all_but_first_with, - METHODS_BUILDER_MARKER_TRAIT, remove_empty_lines, method_default_scope) + METHODS_BUILDER_MARKER_TRAIT, remove_empty_lines, method_default_scope, rust_doc_sanitize) %>\ <%namespace name="util" file="../../lib/util.mako"/>\ <%namespace name="lib" file="lib.mako"/>\ @@ -80,7 +80,7 @@ impl${rb_params} ${ThisType} { % if 'description' in m: /// Create a builder to help you perform the following task: /// - ${m.description | rust_doc_comment, indent_all_but_first_by(1)} + ${m.description | rust_doc_sanitize, rust_doc_comment, indent_all_but_first_by(1)} % endif % if required_props: /// diff --git a/src/mako/api/lib/schema.mako b/src/mako/api/lib/schema.mako index 977c7c64b0..0484b5c40b 100644 --- a/src/mako/api/lib/schema.mako +++ b/src/mako/api/lib/schema.mako @@ -2,7 +2,8 @@ from util import (schema_markers, rust_doc_comment, mangle_ident, to_rust_type, put_and, IO_TYPES, activity_split, enclose_in, REQUEST_MARKER_TRAIT, mb_type, indent_all_but_first_by, NESTED_TYPE_SUFFIX, RESPONSE_MARKER_TRAIT, split_camelcase_s, METHODS_RESOURCE, unique_type_name, - PART_MARKER_TRAIT, canonical_type_name, TO_PARTS_MARKER, UNUSED_TYPE_MARKER, is_schema_with_optionals) + PART_MARKER_TRAIT, canonical_type_name, TO_PARTS_MARKER, UNUSED_TYPE_MARKER, is_schema_with_optionals, + rust_doc_sanitize) %>\ ## Build a schema which must be an object ################################################################################################################### @@ -12,7 +13,7 @@ % if properties: ${struct} { % for pn, p in properties.iteritems(): - ${p.get('description', 'no description provided') | rust_doc_comment, indent_all_but_first_by(1)} + ${p.get('description', 'no description provided') | rust_doc_sanitize, rust_doc_comment, indent_all_but_first_by(1)} % if pn != mangle_ident(pn): #[serde(rename="${pn}")] % endif @@ -28,7 +29,7 @@ ${struct}(${to_rust_type(schemas, s.id, NESTED_TYPE_SUFFIX, s, allow_optionals=a %>\ pub enum ${et} { % for p in s.variant.map: - ${p.get('description', 'no description provided') | rust_doc_comment, indent_all_but_first_by(1)} + ${p.get('description', 'no description provided') | rust_doc_sanitize, rust_doc_comment, indent_all_but_first_by(1)} % if variant_type(p) != p.type_value: #[serde(rename="${p.type_value}")] % endif @@ -72,7 +73,7 @@ ${struct} { _never_set: Option } s_type = unique_type_name(s.id) %>\ -<%block filter="rust_doc_comment">\ +<%block filter="rust_doc_sanitize, rust_doc_comment">\ ${doc(s, c)}\ #[derive(${', '.join(traits)})] diff --git a/src/mako/lib/util.py b/src/mako/lib/util.py index b0bd6ba3c0..1db7d601f8 100644 --- a/src/mako/lib/util.py +++ b/src/mako/lib/util.py @@ -3,10 +3,12 @@ import os from random import (randint, random, choice, seed) import collections from copy import deepcopy +import subprocess seed(1337) re_linestart = re.compile('^', flags=re.MULTILINE) +re_spaces_after_newline = re.compile('^ {4}', flags=re.MULTILINE) re_first_4_spaces = re.compile('^ {1,4}', flags=re.MULTILINE) re_desc_parts = re.compile("((the part (names|properties) that you can include in the parameter value are)|(supported values are ))(.*?)\.", flags=re.IGNORECASE|re.MULTILINE) @@ -125,6 +127,22 @@ def rust_module_doc_comment(s): def rust_doc_comment(s): return re_linestart.sub('/// ', s) +# returns true if there is an indication for something that is interpreted as doc comment by rustdoc +def has_markdown_codeblock_with_indentation(s): + return re_spaces_after_newline.search(s) != None + +def preprocess(s): + p = subprocess.Popen([os.environ['PREPROC']], close_fds=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + res = p.communicate(s) + return res[0] + +# runs the preprocessor in case there is evidence for code blocks using indentation +def rust_doc_sanitize(s): + if has_markdown_codeblock_with_indentation(s): + return preprocess(s) + else: + return s + # rust comment filter def rust_comment(s): return re_linestart.sub('// ', s) diff --git a/src/rust/preproc/src/main.rs b/src/rust/preproc/src/main.rs index 2edfd66c11..d58150c144 100644 --- a/src/rust/preproc/src/main.rs +++ b/src/rust/preproc/src/main.rs @@ -13,7 +13,6 @@ fn main() { }; let mut output = String::with_capacity(2048); - cmark( Parser::new_ext(&md, pulldown_cmark::Options::all()).map(|e| { use pulldown_cmark::Event::*; @@ -21,7 +20,7 @@ fn main() { Start(ref tag) => { use pulldown_cmark::Tag::*; match tag { - CodeBlock(code) => Start(CodeBlock(format!("ignore{}", code).into())), + CodeBlock(code) => Start(CodeBlock(format!("text{}", code).into())), _ => e, } }