Crate rbx_reflection_database

Crate rbx_reflection_database 

Source
Expand description

Contains an API to get a Roblox reflection database using the types from rbx_reflection. This crate embeds a database for this purpose, but also provides an API for dependents to get a reflection database from a consistent location.

The general way this crate should be used is via get. This method will search for a locally stored reflection database and return it if it’s found. If it isn’t, it will instead return the bundled one.

Additionally, this crate exposes get_local and get_bundled for only loading the locally stored database or only the bundled one respectively.

§Local Details

This crate will load a reflection database from the file system if one exists in the default location. This location varies upon the OS and is specified here:

OSLocation
Windows%localappdata%/.rbxreflection/database.msgpack
MacOS$HOME/Library/Application Support/.rbxreflection/database.msgpack
Linux$HOME/.rbxreflection/database.msgpack

Additionally, a location override may be specified via the RBX_DATABASE environment variable. The RBX_DATABASE variable points to the override database.msgpack file, not to an override .rbxreflection directory.

Both the default database.msgpack files and any files pointed to by RBX_DATABASE must be valid MessagePack serializations of a ReflectionDatabase if they’re present.

Structs§

Error

Constants§

LOCAL_DIR_NAME
The name of the directory used for the local location for a reflection database. The directory will be placed inside the current user’s local data folder on MacOS and Windows and inside the home directory on Linux.
OVERRIDE_PATH_VAR
The name of an environment variable that may be used to specify the location of a reflection database to use. The expected format of a file at this point is MessagePack.

Functions§

get
Returns a populated ReflectionDatabase. This will attempt to load one locally and if one can’t be found, it will return one that is bundled with this crate.
get_bundled
Returns the locally bundled ReflectionDatabase. This database may or may not be up to date, but it will always exist.
get_local
Returns a reflection database from the file system, if one can be found. This is loaded from a location set by the RBX_DATABASE environment variable if it’s set. Otherwise, the default location is checked.
get_local_location
Fetches the location a ReflectionDatabase is expected to be loaded from. This may return None if the local data directory cannot be found.