size of Error and ErrorKind is too large

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 2.0.0-beta
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None

      mongodb rust driver version: 2.0.0.alpha.1

      std::mem::size_of::<mongodb::error::Error>() = 320
      std::mem::size_of::<mongodb::error::ErrorKind>() = 296

      It's not recommend to pass large object between function,

      I think Error or ErrorKind should allocate in heap memory and return a reference on function return value type

       

      `pubkind: ErrorKind` on mongodb::error::Error should change to `pubkind: Box<ErrorKind>`

       

      It's not effective to transfer 320 bytes mongodb::error::Error on stack memory

              Assignee:
              Patrick Freed
              Reporter:
              rust matcher
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: