18
18
Console .WriteLine ($" Variable '{name }' set to '{value }'." );
19
19
```
20
20
21
- Rust is providing the same functionality of accessing an environment variable at
21
+ Rust provides the same environment variable access functionality at
22
22
runtime via the ` var ` and ` var_os ` functions from the ` std::env ` module.
23
23
24
- ` var ` function is returning a ` Result<String, VarError> ` , either returning the
25
- variable if set or returning an error if the variable is not set or it is not
24
+ The ` var ` function will return a ` Result<String, VarError> ` , and either returns the
25
+ variable if it is set or returns an error if the variable is either not set or is not
26
26
valid Unicode.
27
27
28
28
` var_os ` has a different signature giving back an ` Option<OsString> ` , either
@@ -54,7 +54,7 @@ fn main() {
54
54
}
55
55
```
56
56
57
- Rust is also providing the functionality of accessing an environment variable at
57
+ Rust also provides environment variable access functionality at
58
58
compile time. The ` env! ` macro from ` std::env ` expands the value of the variable
59
59
at compile time, returning a ` &'static str ` . If the variable is not set, an
60
60
error is emitted.
@@ -68,15 +68,15 @@ fn main() {
68
68
}
69
69
```
70
70
71
- In .NET a compile time access to environment variables can be achieved, in a
71
+ In .NET compile time access to environment variables can be achieved, albeit in a
72
72
less straightforward way, via [ source generators] [ source-gen ] .
73
73
74
74
[ source-gen ] : https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview
75
75
76
76
## Configuration
77
77
78
- Configuration in .NET is possible with configuration providers. The framework is
79
- providing several provider implementations via
78
+ Configuration in .NET is possible with configuration providers. The framework
79
+ provides several provider implementations via
80
80
` Microsoft.Extensions.Configuration ` namespace and NuGet packages.
81
81
82
82
Configuration providers read configuration data from key-value pairs using
@@ -100,7 +100,7 @@ class Example {
100
100
}
101
101
```
102
102
103
- Other providers examples can be found in the official documentation
103
+ Other provider examples can be found in the official documentation
104
104
[ Configurations provider in .NET] [ conf-net ] .
105
105
106
106
A similar configuration experience in Rust is available via use of third-party
0 commit comments