IronRDP/ffi/dotnet/Devolutions.IronRdp/Generated/Config.cs
2024-04-05 15:11:32 +00:00

75 lines
1.7 KiB
C#

// <auto-generated/> by Diplomat
#pragma warning disable 0105
using System;
using System.Runtime.InteropServices;
using Devolutions.IronRdp.Diplomat;
#pragma warning restore 0105
namespace Devolutions.IronRdp;
#nullable enable
public partial class Config: IDisposable
{
private unsafe Raw.Config* _inner;
/// <summary>
/// Creates a managed <c>Config</c> from a raw handle.
/// </summary>
/// <remarks>
/// Safety: you should not build two managed objects using the same raw handle (may causes use-after-free and double-free).
/// <br/>
/// This constructor assumes the raw struct is allocated on Rust side.
/// If implemented, the custom Drop implementation on Rust side WILL run on destruction.
/// </remarks>
public unsafe Config(Raw.Config* handle)
{
_inner = handle;
}
/// <returns>
/// A <c>ConfigBuilder</c> allocated on Rust side.
/// </returns>
public static ConfigBuilder GetBuilder()
{
unsafe
{
Raw.ConfigBuilder* retVal = Raw.Config.GetBuilder();
return new ConfigBuilder(retVal);
}
}
/// <summary>
/// Returns the underlying raw handle.
/// </summary>
public unsafe Raw.Config* AsFFI()
{
return _inner;
}
/// <summary>
/// Destroys the underlying object immediately.
/// </summary>
public void Dispose()
{
unsafe
{
if (_inner == null)
{
return;
}
Raw.Config.Destroy(_inner);
_inner = null;
GC.SuppressFinalize(this);
}
}
~Config()
{
Dispose();
}
}