Files
build/tools/aconfig/templates/rust.template
Mårten Kongstad 066575b95f aconfig: add namespace field to flag_declaration and parsed_flag
Add a new field to the proto messages flag_declaration and parsed_flag.

The new field will be used verbatim as a parameter when calling
DeviceConfig.getBoolean to read the value of a READ_WRITE flag. See the
DeviceConfig API for more info.

Note: not to be confused with the old namespace field, which has been
renamed to package.

Bug: 285211724
Test: atest aconfig.test
Change-Id: I2181be7b5e98fc334e5277fb5f7e386f1fe0b550
2023-06-08 11:27:57 +02:00

30 lines
676 B
Plaintext

{{- for mod in modules -}}
pub mod {mod} \{
{{ endfor -}}
{{- for parsed_flag in parsed_flags -}}
{{- if parsed_flag.is_read_only_disabled -}}
#[inline(always)]
pub const fn r#{parsed_flag.name}() -> bool \{
false
}
{{ endif -}}
{{- if parsed_flag.is_read_only_enabled -}}
#[inline(always)]
pub const fn r#{parsed_flag.name}() -> bool \{
true
}
{{ endif -}}
{{- if parsed_flag.is_read_write -}}
#[inline(always)]
pub fn r#{parsed_flag.name}() -> bool \{
flags_rust::GetServerConfigurableFlag("{parsed_flag.device_config_namespace}", "{parsed_flag.device_config_flag}", "false") == "true"
}
{{ endif -}}
{{- endfor -}}
{{- for mod in modules -}}
}
{{ endfor -}}