Type Definition transmission_sys::tr_ctorMode

source ·
pub type tr_ctorMode = u32;
Expand description

@addtogroup tr_ctor Torrent Constructors @{

Instantiating a tr_torrent had gotten more complicated as features were added. At one point there were four functions to check metainfo and five to create a tr_torrent object.

To remedy this, a Torrent Constructor (struct tr_ctor) has been introduced:

  • Simplifies the API to two functions: tr_torrentParse () and tr_torrentNew ()
  • You can set the fields you want; the system sets defaults for the rest.
  • You can specify whether or not your fields should supercede resume’s.
  • We can add new features to tr_ctor without breaking tr_torrentNew ()’s API.

All the tr_ctor{Get,Set}* () functions with a return value return an error number, or zero if no error occurred.

You must call one of the SetMetainfo () functions before creating a torrent with a tr_ctor. The other functions are optional.

You can reuse a single tr_ctor to create a batch of torrents – just call one of the SetMetainfo () functions between each tr_torrentNew () call.

Every call to tr_ctorSetMetainfo* () frees the previous metainfo.