Skip to main content

SMExtension

Derive Macro SMExtension 

Source
#[derive(SMExtension)]
{
    // Attributes available to this derive:
    #[extension]
}
Expand description

Creates the entry point for SourceMod to recognise this library as an extension and set the required metadata.

The #[extension] attribute recognises the following optional keys using the MetaListNameValueStr syntax:

  • name
  • description
  • url
  • author
  • version
  • tag
  • date

If not overridden, all extension metadata will be set to suitable values using the Cargo package metadata.

An instance of the struct this is applied to will be created with [Default::default()] to serve as the global singleton instance, and you can implement the [IExtensionInterface] trait on the type to handle SourceMod lifecycle callbacks.