# Uri

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/utilities/struct-uri/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct Uri
```

A uniform resource identifier.

Cloning is cheap (one reference count).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L44)

## Members

- [`new`](#function-new)
- [`absolute`](#function-absolute)
- [`try_create`](#function-try_create)
- [`combine`](#function-combine)
- [`is_absolute_uri`](#function-is_absolute_uri)
- [`original_string`](#function-original_string)
- [`scheme`](#function-scheme)
- [`absolute_uri`](#function-absolute_uri)
- [`absolute_path`](#function-absolute_path)
- [`query`](#function-query)
- [`local_path`](#function-local_path)
- [`ensure_absolute`](#function-ensure_absolute)

<a id="function-new"></a>

### new

```rust
fn new(uri_string: &str, kind: UriKind) -> Result<Uri, UriFormatError>
```

Parses a URI of the given kind (C# `new Uri(string, UriKind)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L73)

<a id="function-absolute"></a>

### absolute

```rust
fn absolute(uri_string: &str) -> Result<Uri, UriFormatError>
```

Parses an absolute URI (C# `new Uri(string)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L80)

<a id="function-try_create"></a>

### try_create

```rust
fn try_create(uri_string: &str, kind: UriKind) -> Option<Uri>
```

Parses a URI of the given kind (C# `Uri.TryCreate`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L85)

<a id="function-combine"></a>

### combine

```rust
fn combine(base: &Uri, relative: &Uri) -> Uri
```

Resolves `relative` against the absolute `base` (C# `new Uri(Uri, Uri)`).

Panics when `base` is not absolute. An absolute `relative` is returned unchanged.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L117)

<a id="function-is_absolute_uri"></a>

### is_absolute_uri

```rust
fn is_absolute_uri(self: &Self) -> bool
```

Whether the URI is absolute (C# `IsAbsoluteUri`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L174)

<a id="function-original_string"></a>

### original_string

```rust
fn original_string(self: &Self) -> &str
```

The string the URI was created from (C# `OriginalString`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L180)

<a id="function-scheme"></a>

### scheme

```rust
fn scheme(self: &Self) -> &str
```

The lower-cased scheme (C# `Scheme`).

Panics for a relative URI (C# throws `InvalidOperationException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L187)

<a id="function-absolute_uri"></a>

### absolute_uri

```rust
fn absolute_uri(self: &Self) -> &str
```

The canonical absolute text (C# `AbsoluteUri`).

Panics for a relative URI (C# throws `InvalidOperationException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L194)

<a id="function-absolute_path"></a>

### absolute_path

```rust
fn absolute_path(self: &Self) -> &str
```

The path component (C# `AbsolutePath`).

Panics for a relative URI (C# throws `InvalidOperationException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L201)

<a id="function-query"></a>

### query

```rust
fn query(self: &Self) -> &str
```

The query component including the leading `?`, or an empty string (C# `Query`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L212)

<a id="function-local_path"></a>

### local_path

```rust
fn local_path(self: &Self) -> String
```

The local operating-system representation of a file name (C# `LocalPath`):
the unescaped path, which for a file URI of a drive path (`file:///C:/dir`)
is the drive path with back slashes (`C:\dir`) and for a file URI with a
host is the UNC path (`\\host\share`).

Panics for a relative URI (C# throws `InvalidOperationException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L229)

<a id="function-ensure_absolute"></a>

### ensure_absolute

```rust
fn ensure_absolute(self: &Self, base_uri: Option<&Uri>) -> Uri
```

Makes a relative URI absolute using `base_uri`; absolute URIs are returned unchanged.

Panics when the URI is relative and `base_uri` is missing or relative
(C# throws `ArgumentException`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/uri.rs#L265)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `PartialEq`
- `Eq`
- `Hash`
- `Display`
- `Debug`
- `From<Url>`
- `TryFrom<&Uri>`
- `From<&UriRef>`
- `From<UriRef>`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
